Coding Comment Handling
Editing source code files for a computer language invariably involves entering comments into the code. Various languages use various syntax forms for these comments, but there is a general similarity.
The COMMENT support in SPFLite is designed to support one of the commonest styles - comments entered on the right hand side of a coding line, normally aligned at a particular starting columns.
But column alignment has it's problems. Editing the actual coding text, (inserting and deleting characters) typically messes up the alignment of any existing comments. This require fiddly adjustments to correct. Not fun!
What will comment support do for me?
- Once setup, you will have a KB key assigned which will:
- On a blank line, it will position the cursor to your specified comment column and enter any required comment identifier. (e.g. // or /* or ' etc. )
- On a line with some coding, but no current comments, it will also position to your specified comment column and enter any required comment identifier.
- On a line which currently has existing comments, it will re-align those comments based on your column criteria.
- If you use right-hand comments, this command will quickly become a favorite.
What does it take to set this up?
For the SPFLite support to work, the following must be set up:
- The Profile for the file must have HILITE AUTO ON to activate auto-colorization support. This support provides the support to identify comments for different programming languages.
- The AUTO file used by auto-colorization support itself must, of course, properly specify the criteria for identifying comments.
- The COMMENTS command must be issued to specify how you want the comment support to handle the alignment of your comments.
Looking at each requirement:
- While editing a source code file, issue a HILITE AUTO ON command.
- Create/Edit/Modify the .AUTO file that matches your source language. Full details are in auto-colorization.
- Verify the .AUTO file is working properly by editing one of the source files and ensuring that comments are properly identified and colorized.
- Issue the COMMENTS command to specify your desired comment column alignments.
- Using KEYMAP, assign the (Comments) KB primitive to your desired key combination.
That's it.