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

"Organize Imports" breaks build.sbt #7041

Open
cl-alexk opened this issue Dec 17, 2024 · 2 comments
Open

"Organize Imports" breaks build.sbt #7041

cl-alexk opened this issue Dec 17, 2024 · 2 comments

Comments

@cl-alexk
Copy link

Describe the bug

To Reproduce Steps to reproduce the behavior:

  1. Open build.sbt, ensure it has this:
import NativePackagerHelper.*
  1. Invoke "Organize Imports"
  2. Watch build.sbt become:
import NativePackagerHelper.`*`
  1. Now SBT can't build due to a syntax error.

Expected behavior

For import NativePackageHelper.* in build.sbt to be left as is.

Installation:

  • Operating system: macOS
  • VSCode version: 1.96.0
  • VSCode extension version: 1.44.0
  • Metals version: 1.4.1

Additional context

Additionally, repeated application of "Organize Imports" are not idempotent:

// save built.sbt like this
import NativePackagerHelper._

// run "organize imports" once:
import NativePackagerHelper.*

// run "organize imports" AGAIN
import NativePackagerHelper.`*`
@tgodzik tgodzik transferred this issue from scalameta/metals-vscode Dec 17, 2024
@tgodzik
Copy link
Contributor

tgodzik commented Dec 17, 2024

We should try to warn when dialect is not correct (target doesn't contain -Xsource 3)

@kasiaMarek
Copy link
Contributor

In ScalafixProvider we add -Xsource:3 for !isScala3 && isSource3, maybe we should also add for .sbt files always.

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