Add filters in global search, like "only in string literal" #61124
dcaillibaud
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
What are you proposing?
When doing a search on all files, there is already filters like "only search open files" or "also search files ignored by configuration", but others like "only in string literals" or "only in comments" or "except comments" would be really usefull…
Why does this matter?
Searching a common word can lead to a huge list, and in such case I generally search for code occurrence (variable or method) but I don't care about string or comment occurrences, or I want this word in labels only but I don't care about variables or comment.
What problem does this solve?
Without such a filter, it's sometimes possible to use regexp, but string delimiters can be difficult to catch, for example in js/ts there is
'and"but also the backtick `, and a regexp like /['"`][^'"`]+my words[^'"`]['"`]/ doesn't match all because in a string delimited by"you can have'and vice-versa, so you need back-reference and a really complex regexp (and string delimiters vary on language, there is also heredoc<<<in shell scripts or C or php).What becomes easier or possible?
refactoring big legacy codebase becomes really easier !
Are there any examples or context?
Here is the filter menu in jetbrains IDE
Beta Was this translation helpful? Give feedback.
All reactions