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

Gentle auto-import that respects Scala CLI's directives #7071

Open
windymelt opened this issue Dec 27, 2024 · 1 comment
Open

Gentle auto-import that respects Scala CLI's directives #7071

windymelt opened this issue Dec 27, 2024 · 1 comment
Labels
bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 scala-cli Relates to the scala-cli tool

Comments

@windymelt
Copy link

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

When I auto-import by completion in Scala Script for Scala CLI, Metals always adds import line top of my file. However, I want to keep Scala CLI directives top of the file...

e.g.

Before auto-import:

//> using scala 3.6.2

val d = FiniteDuration/* press TAB to complete! */

After auto-import:

import scala.concurrent.duration.FiniteDuration // aww〜〜
//> using scala 3.6.2

val d = FiniteDuration

Describe the solution you'd like

  • Metals recognizes Scala CLI directives.
  • Metals places imports below directives when auto-import.

Describe alternatives you've considered

Cut and paste

Additional context

I'm using Metals 1.4.1 on Emacs.

Search terms

autoimport auto-import import

@tgodzik
Copy link
Contributor

tgodzik commented Dec 27, 2024

This looks like an error when no imports are added yet.

@tgodzik tgodzik transferred this issue from scalameta/metals-feature-requests Dec 27, 2024
@tgodzik tgodzik added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 scala-cli Relates to the scala-cli tool labels Dec 27, 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 scala-cli Relates to the scala-cli tool
Projects
None yet
Development

No branches or pull requests

2 participants