-
Notifications
You must be signed in to change notification settings - Fork 30k
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
FindTextInFiles
doesn't support comma-separated globs with {}
#169885
Conversation
function spreadGlobComponents(globArg: string): string[] { | ||
const components = splitGlobAware(globArg, '/'); | ||
return components.map((_, i) => components.slice(0, i + 1).join('/')); | ||
function spreadGlobComponents(globComponent: string): string[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the glob processing gets more complicated, it would probably be helpful to break out the code in getRgArgs
with the !*
etc that handles glob patterns and write a unit test for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for now, just added unit tests for that part of getRgArgs
src/vs/base/common/glob.ts
Outdated
escaped = false; | ||
} else { | ||
if (inBraces) { | ||
// ripgrep treats this as attempting to do an alternating group, which is invalid. Return with pattern including changes from escaped braces. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear, this shouldn't be a ripgrep-specific function. glob.ts is our implementation of glob patterns and we should do what's right for our implementation. If it's really "expandBracePatternsForRipgrep" then it can live somewhere else
src/vs/base/common/glob.ts
Outdated
escaped = false; | ||
} else if (inBraces) { | ||
// we found an end bracket to a valid opening bracket. Return the appropriate strings. | ||
return { fixedStart, strInBraces, fixedEnd: pattern.substring(i + 1) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean you can only have one {}
pattern per glob? Is that the rule in glob.ts in general or in ripgrep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function finds the first valid {
and }
pair, but the caller calls this function again on the trailing part of the string to parse the rest of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good!
…osoft#169885) * `FindTextInFiles` doesn't support comma-separated globs with {} Fixes microsoft#169422
Fixes #169422
note: doesn't support
..
notation within braces.