mikaeljorhult / brackets-todo

Brackets/Edge Code extension that displays all TODO comments in current document or project.
144 stars 37 forks source link

Get comment syntax from LanguageManager by default #112

Open petetnt opened 9 years ago

petetnt commented 9 years ago

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

mikaeljorhult commented 9 years ago

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! =)