Skip to content
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 {} #169422

Closed
andreamah opened this issue Dec 16, 2022 · 1 comment · Fixed by #169885
Closed

FindTextInFiles doesn't support comma-separated globs with {} #169422

andreamah opened this issue Dec 16, 2022 · 1 comment · Fixed by #169885
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders search Search widget and operation issues search-api verified Verification succeeded
Milestone

Comments

@andreamah
Copy link
Contributor

andreamah commented Dec 16, 2022

Try extension with:

const disposable = vscode.commands.registerCommand('extension.helloWorld', async () => {
	const results: string[] = [];
	const glob = await vscode.window.showInputBox({ prompt: 'Glob pattern' });
	await vscode.workspace.findTextInFiles({ pattern: 'foo' }, {
		include: new vscode.RelativePattern(vscode.workspace.workspaceFolders![0], glob!),
	}, r => results.push(r.uri.toString()));
	vscode.window.showInformationMessage(JSON.stringify(results));
});

...and a workspace with files a/hello.txt and b/hello.txt both containing foo. Entering a glob for a/*.* or b/*.* will work, but {a/*.*,b/*.*} will return no results.

{a/*.*,b/*.*} is a valid glob and should work

@andreamah andreamah added bug Issue identified by VS Code Team member as probable bug search Search widget and operation issues search-api labels Dec 16, 2022
@andreamah andreamah added this to the On Deck milestone Dec 16, 2022
@andreamah andreamah self-assigned this Dec 16, 2022
@andreamah
Copy link
Contributor Author

I believe that the main reason that this happens is because of a performance optimization that we make with text search here:

function spreadGlobComponents(globArg: string): string[] {

We need to find a way to support {} (no nesting, since ripgrep doesn't support it) while keeping this optimization

@andreamah andreamah modified the milestones: On Deck, January 2023 Dec 20, 2022
@andreamah andreamah modified the milestones: January 2023, February 2023 Jan 20, 2023
andreamah added a commit that referenced this issue Feb 7, 2023
)

* `FindTextInFiles` doesn't support comma-separated globs with {}
Fixes #169422
@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Feb 7, 2023
c-claeys pushed a commit to c-claeys/vscode that referenced this issue Feb 16, 2023
…osoft#169885)

* `FindTextInFiles` doesn't support comma-separated globs with {}
Fixes microsoft#169422
@connor4312 connor4312 added the verified Verification succeeded label Feb 23, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders search Search widget and operation issues search-api verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants