vscode-hide-comments icon indicating copy to clipboard operation
vscode-hide-comments copied to clipboard

Does it work with Better Comments extension?

Open SanjayVyas opened this issue 3 years ago • 3 comments

This extension seems to work with comments like // This is a comment

I also use an extension called Better Comments, where comments can be colours by adding extra characters //! This will be in red //* This will be in green

However, this extension doesnt hide comment if the first character after // is not a letter

SanjayVyas avatar Oct 25 '21 09:10 SanjayVyas

Probably it doesn't, as it is an extension that adds its own syntax, but we could take a look into adding support.

estruyf avatar Nov 03 '21 09:11 estruyf

Probably it doesn't, as it is an extension that adds its own syntax, but we could take a look into adding support.

That would be great to have, if you could, adding some code comments would help someone like me or its creator to more easily implement support and submit a pull request as well, right now im still trying to get used to vscode extension programming so a lot of it is unfamiliar to me.

Zxynine avatar Jul 16 '22 14:07 Zxynine

You could make use of the regex feature of this extension to this end. For example,

{ "hideComments.regex": [ { "regex": "console\.log\(([^)]+)\).*", "flags": "igm" } ] }

is the example proposed by the developper and it suffices to replace the long complex part after "regex":, i.d. "console\\.log\\(([^)]+)\\).*", with, let's say, "%! .*" so that you could hide all the comments beginning with %! by means of a new star icon slashed beside the default eye icon. I take this as an example because I just figured out how to use it to hide my "better-comments" used in LaTeX. I'm not sure how to express what you need to hide with regex but I think it is not difficult to find a solution. However, it still leaves me a little question about the part "flags": "igm" and I wonder what this serves for. At first I thought this was just like a label to distinguish between different regex but when I changed it, this feature failed to work. Hopefully the developper could see this question and make it more clear.

P.S. I am not sure if you had already found the same solution as me, since this issue has been proposed for around 3 years but, if anyone had the same question, maybe this expedient would give a little help :)

yuanyang11510 avatar Sep 12 '24 13:09 yuanyang11510