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

Make --no-config for ripgrep optional #149727

Closed
bartroozendaal opened this issue May 17, 2022 · 5 comments
Closed

Make --no-config for ripgrep optional #149727

bartroozendaal opened this issue May 17, 2022 · 5 comments
Assignees

Comments

@bartroozendaal
Copy link

In

src\vs\workbench\services\search\node\ripgrepFileSearch.ts:74

there is a command line flag for ripgrep to exclude any defined config files for ripgrep

args.push('--no-config');

Can using this argument be made optional through a setting? There are use cases where users would want to have some settings in the config file to apply.

FYI: I'm asking this question because I have a lot of excluded folders (managed by my own extension) in my vscode files.exclude setting, which causes the ripgrep command to fail because of the lenght of the command for all the added ignored folders. I want to add these excluded files to a ripgrep configuration file, but due to the mentioned code that configuration is ignored.

@roblourens
Copy link
Member

Sorry, we can't do this. We have to use ripgrep in a specific configuration, and changing that could break vscode's integration with it. In my view, the ripgrep config file is for a user using ripgrep directly. You can add excluded files to a .gitignore or a .ignore file (actually I think there is an open issue for me to write exclude patterns to a file like this to avoid this exact problem.)

@bartroozendaal
Copy link
Author

We are not using a plain .ignore file, so for my use case, that might be an option. I'll give that a go.

@bartroozendaal
Copy link
Author

bartroozendaal commented May 17, 2022

Ah, no, it won't help, since the files.exclude is always read it seems.

So, I think I would need a split in that particular setting.

  1. Optionally use file.exclude to exclude files (I think this is always done, and it doesn't look at the setting at all)
  2. Optionally use .gitignore
  3. Optionally use .ignore

In my case I would only select options 2 and 3, leaving the long list of file.exclude settings out of the equation.... I think from the code I read that ripgrep itself is reading the ignore files, so we should probably be ok with it using that.

Can't see how to re-open the case. If that's not possible, I'll add a new one....

@roblourens
Copy link
Member

I do have #98514 open for this same issue.

Not sure what you are asking for, I guess you still want to use files.exclude to hide folders in vscode but the presence of that setting breaks search?

How many patterns do you have?

@bartroozendaal
Copy link
Author

I have about 1000 patters in the files.exclude setting. I'm constructing that list from a code-owners file in a mono repository, filtering between all files and only files/folders a team owns.

And yes, I'd like to have those files excluded in vscode and preferably be able to switch between searching all files and only the owned files. But, these 1000 patterns break ripgrep. I guess it would work if I could maintain a .ignore file from my extension.

So, a setting to not add the excluded files in the search command would probably fix it for me.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants