Enable "smart case" for search #41119
Labels
feature-request
Request for new features or functionality
search
Search widget and operation issues
verification-needed
Verification of issue is requested
verified
Verification succeeded
"Smart case" is a ripgrep feature that will handle a query as case-sensitive if it contains uppercase characters, and case-insensitive if it doesn't.
For example, a document contains
With "smart case" enabled, the query
asdf
matches line 1 and line 2. And the queryasdF
only matches line 2.It also works for regular expressions. The regex query
asd\S
matches line 1 and line 2. The queryasd[A-Z]
only matches line 2.We should introduce a setting,
search.smartCase
oreditor.find.smartCase
. This is easy to hook up for ripgrep, but we also need to implement it for when results are provided by the editor, and for when ripgrep is not used. This is easy for non-regex queries. For regex queries, ripgrep previously attempted to tell whether the regex would match any uppercase characters. But this had unintended consequences, like\w
triggering case-sensitivity, so now it only checks whether the regex text has any unescaped uppercase characters (BurntSushi/ripgrep#717). Fortunately this is easy for us to match.editor.find
settings but not all?cc @rebornix
Alternately, the "case sensitive" toggle button could be a 3-mode switch which also can enable smart case.
The text was updated successfully, but these errors were encountered: