Sublime Forum

Adding an additional "class" of comments

#1

I would like to write a Sublime Text plugin that allows annotating source code, without actually modifying the original code.

I audit a lot of source code for work, and I don’t want to modify the original source (since I don’t want my annotations to modify the source) and adding regular comments gets lost in the noise of existing comments.

Is there any way to add an additional class of comments, perhaps with some kind of popover / message window that tracks the line the comment was added to? This feature is somewhat inspired by the ability to add comments in IDA Pro, but I’d like this for Sublime Text.

The information for the file/line/comment pairs can be kept in a separate database (and accessed via Python), and would be displayed / hidden based on some hotkey (or command palette option).

I’m not sure if Sublime Text supports floating annotations like what would be needed to implement this.

My original thought was to extend the syntax definitions for e.g. C\C++ to support a “new” comment type (e.g. // foo is a normal comment, /// bar is also a comment, but would be displayed in a different color.

How can I go about adding this type of support (using either approach)?

0 Likes

#2

You could utilize so-called phantoms and have them be displayed under the relevant region of text.

0 Likes