Gruntfuggly / todo-tree

Use ripgrep to find TODO tags and display the results in a tree view
Other
1.42k stars 137 forks source link

Cannot recognize MATLAB script file *.m #612

Closed Nowlinsuk closed 2 years ago

Nowlinsuk commented 2 years ago

Usually, I use VScode as the editor of MATLAB script file by this extension: https://github.com/Gimly/vscode-matlab When I install the "Todo Tree" extension, I find it cannot recognize%todo in *.m* file (MATLAB language) And I test #todo in .py file (Python language), and I find it works well. The extension "TODO Highlight"** does not exist this problem but it does not own the function of tree-management, So I prefer this extension, but this problem bothers me a lot. Also, I check the settings of this extension but I just find the "filter" of file but not "include", So I don't know how to fix it. Is there somebody help me ?

maxdit commented 2 years ago

This may not be a repo issue but I will assist, had the same issue, default regular expression for the extension does not have a percentage sign that some languages use to indicate a comment. You can add it yourself if you want.

This is what you can change the expressions to, in the settings JSON file (just add this line):

"todo-tree.regex.regex": "(//|#|%|<!--|;|/\\*|^|^[ \\t]*(-|\\d+.))\\s*($TAGS)"

Remember also to add a "**/*.m" include glob as well.

Now it should work perfectly.

allefeld commented 1 year ago

Instead of using an explicit match for the comment marker, wouldn't it be better to use the respective language server's classification as "comment"?

Gruntfuggly commented 1 year ago

That wouldn't work for the workspace scan - it's basically a simple file search. It would be much more complex (and much slower) to process each file one by one and work out what language it contains.