joshmu / periscope

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

Add ability to fuzzy search the files inside the workspace #65

Closed Aleksandaar closed 1 month ago

Aleksandaar commented 2 months ago

The PR adds a new option to search the files in the workspace by adding a new option searchFiles shortcut. It also adds one more configuration option showWorkspaceFolderInFilePath to display or hide workspace folder name from file path in both types of searches.

joshmu commented 1 month ago

Hey @Aleksandaar

Thanks for putting in the time for determining how FZF could be integrated in to Periscope and glad to hear you enjoy the extension! :)

Unfortunately moving forward Periscope will primarily scoped to supporting ripgrep features for advanced search. This is due to vscode now natively supporting both "File Search" and "Quick Search" which both are fuzzy search capable.

Truly appreciate the time you put in to this.

If there is a way to improve Periscope's ripgrep search for file contents lookup with the added benefited of fuzziness then that would definitely be something worth bringing in.

As for the addition of showWorkspaceFolderInFilePath that seems like a logical update. If you could raise another PR for this I would be happy to bring this in!

Thanks again!

Aleksandaar commented 1 month ago

Hey @joshmu :)

Thanks also for looking into this issue and the pull request. I have made a new issue for the workspace folder path https://github.com/joshmu/periscope/issues/68 and I have attached the PR to it.

As for the "Quick Search" and "File Search" options - I know, but I have really hoping it would get to the plugin :) as I have to say using with your plugin (and with this change) it is much more nicer and enjoyable compared to the VS Code's Quick Search, at least to me.

It could have a preview while you are searching. Not sure if the "Quick Search" had it in a way implemented like I wanted - moreover "Quick Search" wasn't finding some files in the project folder. Can't remember what types, but I know I had to open a file from the file system, or to find in manually through the file structure in some projects.

The second thing that you plugin provided is that you could add a custom options to the search. For example: If I had some ignored folders in VS Code, I couldn't find it via Quick Search. I would have to go to settings, and remove that folder from the ignored folders, and then I could search for files inside folders that I usually keep hidden, like node_modules (or .bundle more often in my case):

file-options-image node_modules-preview

Unfortunately, I want to access those files more often than I would like, in which case, I have to go to settings, disable folder, add it again etc. every time.

I don't want this to end up like a comment to plead you to reconsider merging it :D but just saying additional use-cases, and that your extension provided a very nice structure to make that search possible in case you decide adding these changes :)

P.S. I have to say - very nice code, to be frank. Very well structured, expandable, and nicely isolated the responsibilities

joshmu commented 1 month ago

Hey @Aleksandaar

Quick Search is for grep across the workspace. You are right though I find it buggy and misses results. :)

In regards to file search you raise some good points in terms of filtering.

There are a few thoughts I have before bringing something like that in:

My preference is to avoid additional dependencies (FZF) and leverage as much as possible the existing codebase (utilising ripgrep) to achieve file search support. I like the fact that Periscope is set up in such a way ripgrep comes as a npm package rather than forcing a pre-requisite step for all users.

It may even be worthwhile seeing if only a few small changes are required in terms of arguments passed to the ripgrep command to achieve the file search feature.

With the above approach the footprint on the codebase would be smaller, leverage more of the existing logic and would probably achieve 90% of what you are wanting.

If this is possible then I'm totally open for bringing it in.