Vscode: Feature request: 'Ignore comments' checkbox in the 'Find' dialog

Created on 8 Sep 2016  路  16Comments  路  Source: microsoft/vscode

Wide popularity of the embedded documentation conventions like JSDoc and C#'s XML comments leads to a situation where comments often constitute the bigger part of a source file (e.g. look at the source of angular.js: the whole API documentation is there!). This abundance of comments makes it extremely difficult to find anything in the source code proper. For example, reading someone's code, we might want to know how and where a certain function is used. However, if we decide to conduct a search by its name, we might get lost in dozens of code samples in the comments and overlook some important case of its real usage. Shift-F12 often helps in such situations, but not always. This undermines the habitual workflow of those who are used to rely a lot on the search to read the code. Not sure if any other editor has this feature, but it would be great to have the 'Ignore comments' option in VS Code's search dialog.

editor-find feature-request help wanted

Most helpful comment

Also include "Only comments" option

All 16 comments

Is there any way to get the list of comment tokens from all the grammar's (including extensions) installed in vscode?

I think this will become just a matter of using a strong default regex to exclude comments. I can try and implement this.

Any news on this feature request?

I'll take a look at this feature once I finish the enhancement of Find Widget. It's a valid feature request. The only technical problem we need to solve is actually detecting comment area.

@rebornix A better way could be to allow the language extension authors to implement this. Most language extensions perform some parsing and hence can figure out what the comment area is. Will need a new API in VSCode to be able to plug into it.

It also helps to future proof the implementation and that way it will work for all other languages which have a method of parsing.

Any news on this feature !!?

Any news on this feature request?

I'm starting to wonder if anyone really uses VS Code... Webstorm has it and I use it all the time. As soon as you have a mid size project, this is a must have!

Is there any progress going on with this feature request? Its a MUST-HAVE as the only way around is using regex, which is a painful way wrt simpler ways like a checkbox of ignore comments.

As I mentioned above, this is an interesting feature which takes syntax into account for both find widget and search viewlet. WebStorm puts this feature in a filter dropdown list

image

We don't necessarily need to make it an UI element but a setting where users can control whether to filter out string or comments while searching. The challenge here is we are making search/find language agnostic. Currently we rely on TextMate to do the tokenization, whose most grammars are complex and beautiful but not fast enough for simple searches. When we consider sementic highlighting, we can probably think about this feature as well. The language service provides ranges for comments and strings real quick and then we can quickly filter them out.

The same technique can be used for spell checker as well, but again, relies on a fast tokenizer.

cc @roblourens

It would be great if this was added to some milestone :grimacing:

Also include "Only comments" option

Please add search in comments along with search everything but comments. Missing IntelliJ Idea today.

So is this even going to be a thing or is it something Microsoft is going to do as a wont-fix ??
It's been 3 years, with multiple people requesting it, but this is the only thing that is not "closed"

I hope this features.

4 years and no response... Is there an extension that can add this feature?

Possibly useful but not nearly as simple as requested feature https://github.com/nikaspran/vscode-ast-query (uses syntax from https://github.com/estools/esquery )

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trstringer picture trstringer  路  3Comments

vsccarl picture vsccarl  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

lukehoban picture lukehoban  路  3Comments