joshmu / periscope

Ripgrep powered peek search in VSCode 🫧
https://marketplace.visualstudio.com/items?itemName=joshmu.periscope
Other
18 stars 5 forks source link

Rg menu with predefined and preselected folders #69

Open Aleksandaar opened 4 weeks ago

Aleksandaar commented 4 weeks ago

This is just an idea. As rg search respects .gitignore and similar files sometimes there could be a need to search the files and/or directories that are in the .gitignore. There is an override to set the additional menu option --no-ignore but it would search all folders, which sometimes could be too much.

There could be an option for example to list all the files and folders in the rg menu by default, that are listed in files.exclude or search.exclude in the VS Code, and users could disable one of those options when needed. For example it could look something like this:

periscope-feature-1

There could be an option to either respect .gitignore or VS Code's files.exclude option

joshmu commented 3 weeks ago

I see where you are coming from with this :)

Can this not be achieved by the user through defining rgMenuActions ? Or via rgQueryParams ?

If I were to rewrite Periscope (and even now), my general preference is to focus as much as possible on an open interface pattern where the users can manipulate their search criteria as much as they like and the extension is generic enough to handle it. All they would need to know are some basic patterns Periscope uses for the setup and the rest is their knowledge on ripgrep.

Currently the extension doesn't support all ripgrep possibilities due to the arrangement of the ripgrep arguments.

Aleksandaar commented 2 weeks ago

Heh, I also now see where are you coming from :D You want it to be universal, and I could've added --glob "!**/tmp" to the rgQueryParams instead of generating it like in the image above.

Now I understood move what you meant, but sadly (again) I was mostly exploring the option of searching those files outside of default scope.

And sadly not really possible in that use case, as if you would want by default to look for all files you would have to --no-ignore and see --hidden files, but also by default you would have to exclude some of the files/directories. You could exclude using rgQueryParams, as you said, but you can't re-enable them using rgMenuActions as excluding a folder from a search and then including it in the same command will not include it (I've tried it. It doesn't cancel each other out) - so had to have an option to "disable" some of the "excludes" rather than to "include" it afterwards.

I mean, everything could be done, but this seemed also a possible approach.