jgclark / vscode-todo-highlight

VSCode Extension to highlight TODOs etc.
MIT License
103 stars 22 forks source link

Missed opportunity #99

Open MWVirid opened 1 week ago

MWVirid commented 1 week ago

Hi, It is good to see that the older version of TODO highlight has been taken over for future dev. It is a shame that the new version still has the limitation that using todohighlight.keywordsPattern switches off todohighlight.keywords. I would like to highlight sections of code between two tags with isWholeLine set to true (to pick out code in a particular language) AND also have the facility to pick out keywords for different special formatting. This could also be achieved by allowing repeated todohighlight.keywordsPattern object keys so you can set different formats for differet regex patterns. Why would you make this clever tool a single use feature - unless I'm missing something, you can choose one format to apply to one set of items and then you are done. Wouldn't it be simple enought to cycle through the object array and apply all changes rather than stopping at one? Do you know of a more comprehensive tool that will allow more choice and versatility. Thanks.

jgclark commented 1 week ago

I don't follow your point. You can have many todohighlight.keywords set, including some which are isWholeLine, and others which aren't, so more suitable for tags. See the long example in the documentation. If you're still having trouble, please post your relevant settings.

MWVirid commented 1 week ago

Thanks for the reply. If I understand it, using 'keywordPattern' disables 'keywords'. I don't see why this limitation is put on the tool; why remove this flexibility. I think I need both or alternatively the option to use 'keyowrdPattern' several times to create different formatting styles for different instances.

Specifically, I am trying to replicate some of the formatting of notepad++ in VS code. As such, I would like to highlight all javascript areas in my php code files (some background color ideally and wholeline affected, like notepad++ does), hence I need to use regex to seek the multiline areas that are between the script open and close tags using 'keywordsPattern'. I also want to find and highlight e.g. opening an closing tags for php within markup along with other things, but with a different format set than the javascript sections above. Because 'keywordPattern' disables 'keywords' I can't do both tools and because you can only have one instance of 'keywordPattern' which must have a single set of parameters (one only format set) you can't specify.

Perhaps I read it wrong or have an error in my setup. Is it possible to repeat part of 'keywordPatten' declaration in order to use it multiple times with different formatting settings? [I had an error when I tried a few things].

Thanks again. Sorry for the misunderstanding.

jgclark commented 3 days ago

Please see the example in the documentation. keywordsPattern is a simple setting that just picks up the single default style. But keywords allows you to set many styles, each of which can be defined either by regex or simple string match.