tomrijndorp/vscode-finditfaster

Is there a quick way to add new file type for pre-filtering?

TimDreamer opened this issue ยท 3 comments

This plugin indeed is awesome. I am new to these terminal stuff, so I am still struggling here.

The problem I have is that I have some graphql schema files in my project, but this type is not available for searching with pre-filtering.

I want to add this type so that I can use the feature. How can I do that or maybe it is impossible right now?

Hi, thanks for the kind words. It's a good question. The type list comes directly from rg (the extension queries Ripgrep with --type-list to create the dialog you're referring to).
I thought this list was a fixed set, but it turns out it's not so there's hope :) I just learned that:

  1. you can call --type-add to add a new spec (e.g. graphql)
  2. while that flag is not persistent, you can set it from a configuration file

Since the extension is definitely more targeted towards power users like yourself, and I can't ever support every type spec (rg already tried to do something like this and provided this solution), I'd recommend changing your rg configuration to add that type spec. It should just work as the extension simply invokes rg just like you yourself would in the terminal.

Since you said you're new to terminal stuff, let me give some more pointers as some of this might not be obvious (forgive me if you already know this stuff):

  • man rg shows all the documentation for rg including everything I just learned
  • it gives this example regarding configuration files: RIPGREP_CONFIG_PATH=wherever/.ripgreprc rg foo
  • so you need to ensure your environment contains RIPGREP_CONFIG_PATH and have it set to e.g. ~/.ripgreprc, which should then contain the configuration data.
  • this file should then contain the required incantation to add the graphql extension to rg
  • try this in the terminal first, before trying it in the extension. If it works, try it in the extension. If it fails, it's because VS Code happens to not have the same environment as your terminal (which depends on how you start VS Code). In that case see this StackOverflow post for instructions on how to set environment variables for the VS Code terminal.

Hope this helps, good luck!

Thank you! I finally make it work.

As a non-native speaker, these documentations and commands are really overwhelming.
I guess I need to take times to learn more shell commands to be better with terminal stuff.
This journey is kind of frustrating but helpful in the long run, or I hope so.

The given pointers are really helpful. Have a nice day!

For what it's worth you seem to be doing great on both English as well as terminal stuff so keep it up! I know dealing with the terminal can be a pain, but diving in and learning lots of things about it will make you far more productive if that's what you aspire :)