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

Allow exclusion of some classes when considering imports #370

Open
udalrich opened this issue Jan 24, 2024 · 1 comment
Open

Allow exclusion of some classes when considering imports #370

udalrich opened this issue Jan 24, 2024 · 1 comment

Comments

@udalrich
Copy link

Is your feature request related to a problem? Please describe.

There are certain packages from which I never want to make an import, even though they are on my class path. For example, Akka has various *.javadsl and *.scaladsl packages, intended for use with java and scala. Obviously, if I'm using metals, I'm programming in scala and never want the javadsl version.

Other common names, like Logger or Node often appear in multiple packages. Being able to exclude that packages that I never want to import makes the interface easier to use: sometimes there is only one surviving option and I do not have to choose. Even if there are multiple options, fewer of them mean that the one that I want is likely easier to get to.

Describe the solution you'd like

The ability to specify a list of regular expressions to metals would be ideal. When metals attempts to find possible imports, and import that matches one of the regexes would be filtered out.

One corner case to consider is what to do if all of the matches are filtered out. In that case, I think returning no results would be best, but I can see the argument for returning the full, unfiltered list.

Describe alternatives you've considered

I use metals via lsp-metals in emacs. The filtering could be implemented there, but if it is added in metals, then people who use it via another interface would also benefit.

Additional context

No response

Search terms

filter import package

@tgodzik
Copy link
Contributor

tgodzik commented Jan 24, 2024

Thanks for reporting, did you try metals.excludedPackages setting?

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

2 participants