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

Let auto-import respect already-imported package aliases #6567

Closed
windymelt opened this issue Jul 5, 2024 · 1 comment · Fixed by #6575
Closed

Let auto-import respect already-imported package aliases #6567

windymelt opened this issue Jul 5, 2024 · 1 comment · Fixed by #6575
Assignees
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3
Milestone

Comments

@windymelt
Copy link

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

If we have import alias like this:

import verylong.pkg.so.we.treat.it as it

And supposing that verylong.pkg.so.we.treat.it has foo member.

Then we use auto-completion like this:

foo<TAB>

Thus Metals automatically imports foo:

import verylong.pkg.so.we.treat.it as it
import verylong.pkg.so.we.treat.it.foo

Describe the solution you'd like

Auto-import should respect import alias it.

So I want lines like this:

import verylong.pkg.so.we.treat.it as it
import it.foo

Describe alternatives you've considered

I have no alternatives. I'm removing redundant part every time.

Additional context

I'm using Besom, and it has many deep package structure like this:

import besom.api.kubernetes.core.v1.ConfigMap
import besom.api.kubernetes.core.v1.ConfigMapArgs
import besom.api.kubernetes.core.v1.Pod
import besom.api.kubernetes.core.v1.PodArgs
import besom.api.kubernetes.core.v1.Secret
import besom.api.kubernetes.core.v1.SecretArgs
import besom.api.kubernetes.core.v1.Service
import besom.api.kubernetes.core.v1.ServiceArgs
import besom.api.kubernetes.core.v1.inputs.ConfigMapVolumeSourceArgs
import besom.api.kubernetes.core.v1.inputs.ContainerArgs
import besom.api.kubernetes.core.v1.inputs.ContainerPortArgs
import besom.api.kubernetes.core.v1.inputs.HttpGetActionArgs
import besom.api.kubernetes.core.v1.inputs.KeyToPathArgs
import besom.api.kubernetes.core.v1.inputs.PersistentVolumeClaimSpecArgs
import besom.api.kubernetes.core.v1.inputs.PodSpecArgs
import besom.api.kubernetes.core.v1.inputs.ProbeArgs
import besom.api.kubernetes.core.v1.inputs.SecretVolumeSourceArgs
import besom.api.kubernetes.core.v1.inputs.ServicePortArgs
import besom.api.kubernetes.core.v1.inputs.ServiceSpecArgs
import besom.api.kubernetes.core.v1.inputs.VolumeArgs
import besom.api.kubernetes.core.v1.inputs.VolumeMountArgs
import besom.api.kubernetes.core.v1.inputs.VolumeResourceRequirementsArgs
import besom.api.kubernetes.meta.v1.inputs.ObjectMetaArgs

Search terms

auto, import, completion, alias, package

@tgodzik
Copy link
Contributor

tgodzik commented Jul 8, 2024

Thanks for reporting! This rather looks like a bug, I will move it to the main repo

@tgodzik tgodzik transferred this issue from scalameta/metals-feature-requests Jul 8, 2024
@tgodzik tgodzik added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 labels Jul 8, 2024
@kasiaMarek kasiaMarek self-assigned this Jul 9, 2024
@kasiaMarek kasiaMarek moved this from Triage to In progress in Metals Issue Board Jul 9, 2024
@github-project-automation github-project-automation bot moved this from In progress to Done in Metals Issue Board Jul 10, 2024
@tgodzik tgodzik added this to the Metals v1.3.3 milestone Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants