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

Support fuzzy searching of members in dependencies #423

Open
harpocrates opened this issue Mar 6, 2025 · 4 comments
Open

Support fuzzy searching of members in dependencies #423

harpocrates opened this issue Mar 6, 2025 · 4 comments

Comments

@harpocrates
Copy link

I'm not sure whether it is too expensive, but I would like a way to do some sort of Ctrl-T-like search over the full compile classpath that includes method names in particular.

Right now, the best alternatives I have are:

  • grepping through source code deps (either with Github/gitlab/bitbuckets's subpar search or by cloning and grepping for real)
  • searching scaladocs (when those are published)

Neither of those feels like a good solution.

@tgodzik
Copy link
Contributor

tgodzik commented Mar 7, 2025

For VS Code there is metals.find-text-in-dependency-jars command that can look through all of your sources. You just have to write the mask to be .scala. That is not optimal for your use case, but I think better than having to clone things. We tested indexing methods as well and it turned out to be quite expensive for indexing. We could try to cache and optimize it better for sure.

There is always an option of adding a flag here, since it's already implemented. At least if I remember correctly @kasiaMarek ?

@kasiaMarek
Copy link

kasiaMarek commented Mar 7, 2025

since it's already implemented

We index all symbols with members using ScalaTopLevelMtags for e.g. tree view, if that's what you mean.

But the fuzzy search uses bloom filters to figure out which files we even need to search. So... possibly if we included members there might be too many hits... Maybe decreasing the bucket size could help here. I don't remember the details of how this whole thing works.

Bottom line: I think it might turn out to be a nightmare without some adjustments.

@harpocrates
Copy link
Author

harpocrates commented Mar 7, 2025

Yeah, I'm not surprised to hear this might blow up the size of the bloom filters. An option would be nice to at least try it out...

I also would not mind being forced to explicitly specify patterns for packages where I want methods indexed (similar to how I exclude packages form any indexing today).

I did not know about metals.find-text-in-dependency-jars - that is indeed so much faster than cloning! Is the search argument to that command a pattern or always just a literal substring?

@tgodzik
Copy link
Contributor

tgodzik commented Mar 7, 2025

Is the search argument to that command a pattern or always just a literal substring?

It's currently a literal substring, but it should be possible to make it a regex, we could potentially make it the default 🤔

The biggest issue to figure out here is the UI, we could possibly improve it on the VS Code side and reuse the normal search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants