brackets-todo icon indicating copy to clipboard operation
brackets-todo copied to clipboard

Get comment syntax from LanguageManager by default

Open petetnt opened this issue 10 years ago • 1 comments

Currently the default comment syntax is defined by the .todo file as C-style comments:

Todo will by default recognize C-style comments using the tags TODO, NOTE, FIXME, CHANGES or FUTURE as shown in examples below.

To solve issues like #110 , #111, we could use the LanguageManagers .getLineCommentPrefixes()-method to determine which kind of comments to use per file type

var file = brackets.getModule("document/DocumentManager").getCurrentDocument(),
    fileLanguage = file.getLanguage(),
    lineCommentPrefixes = fileLanguage.getLineCommentPrefixes();

console.log(lineCommentPrefixes); //For JavaScript, for example, logs an Array of ["//"]

Also acts as an solution for #96

petetnt avatar Feb 17 '15 10:02 petetnt

That sounds like a really interesting idea. The only drawback I can think of is that relying solely on LanguageManagers methods won't allow us to recognizing DocBlock comments so there will probably need to be some fallback to defining your own regular expressions.

That said it will solve a lot of the support request so I'm all for it! =)

mikaeljorhult avatar Feb 19 '15 18:02 mikaeljorhult