-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ripgrep: can't search for a query containing a space, using the 'whole word' flag #23534
Comments
If you enable the regex switch, then these work - the problem is actually that |
Possibly March. @bpasero Do you know why this function escapes whitespace (\s), and is it safe to have it not do that? src/vs/base/common/strings.ts
export function escapeRegExpCharacters(value: string): string {
return value.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g, '\\$&');
} Maybe for march I can clone it without \s just for ripgrep, and remove it for everything else in April. |
@roblourens For ripgrep, I don't think you want to escape commas either. The full list of allowable escape characters isn't particularly well documented, but you can see them here: https://github.com/rust-lang/regex/blob/master/regex-syntax/src/parser.rs#L1225 |
@roblourens Popping up a level, if you want to disable regex entirely, then you can pass the |
Comma also triggers this issue. And that can be a special char in a regex, but only sometimes. JS takes it escaped or unescaped when you want to match a comma, so it seems like that could be removed too. I use |
@roblourens Nope! |
Hm, I could have sworn there was a case where it didn't work right, because I went out of my way to do it that way. But now it seems to work fine like you say, so maybe I just don't need to escape those chars. |
The number of matches using 'match whole word' is still less than before, because we are tricky about adding the \b flags when the query starts with something like a special character: https://github.com/Microsoft/vscode/blob/master/src/vs/base/common/strings.ts#L211 We can get the same effect by not using the |
Verified that searches or 'Remove ' and 'Remove on' work well, but '${1:' somehow got worse. I annotated #23624 |
Testing #23319
Version 1.11.0-insider
Commit 646d0f9
Date 2017-03-28T12:36:25.374Z
Linux
In the vscode repo, search with
whole word
enabledI agree it's discussable what it 'whole word' means for a search term that is more than a word. But just wanted to bring it to your attention.
The text was updated successfully, but these errors were encountered: