Documenting Code

With the Pieces Copilot in the Pieces for Sublime Text Plugin, you can easily generate comments that capture your code's functionality and intent.


Commenting Code Selections with Pieces Copilot

Pieces Copilot can review and comment on any selected portion of your code, providing line-by-line explanations to ensure it is not only readable but also easy for others to understand.

via Right-Click Menu

To get started:

  1. Select a portion of the code

  2. Right-click

  3. Hover over Ask Copilot

  4. Select Add Code Comments from the tertiary menu

Pieces Copilot will then generate clear, contextual comments for the selected code and give you the option to Accept or Reject the suggested comments.

This is particularly useful for maintaining code readability and ensuring your codebase is well-documented.

Why Use Code Comments?

Code comments are essential for maintaining a clean and well-documented codebase.

They offer context, enabling reviewers to focus on functionality while making complex logic transparent, ensuring the code is easier to follow and maintain.

Good documentation enhances code readability and speeds up onboarding for those new to the codebase. This dual benefit supports both current and future development, creating a solid foundation for upgrades and iterations.

That’s what makes this feature so impactful. Need a few hundred lines of code documented? No problem—just use Add Code Comments.

Updated on