-
Notifications
You must be signed in to change notification settings - Fork 338
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
improvement: Try to use scala CLI format if it exists #5559
Conversation
Should we run |
3772372
to
afe9ece
Compare
I think it's better we stay consistent. If we want to have the |
Yea I'm thinking sort of along the same thing. Consistency is important here. Maybe you have, but I haven't heard complaints about Metals prompting you to create a
If they choose 1, then we do what we did before and create one in the root. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I only wonder if we should always fallback to .scala-cli
or only if scala-cli
is the build tool in use. Can it happen that .scala-build/.scalafmt.conf
exists but is completely outdated since the user doesn't use scala-cli
anymore? I feel like that's both unlikely and still .scala-build
is a fallback for searching for config, so it's fine to use it always.
afe9ece
to
3ef771b
Compare
Scalafmt needs to habe a config file to run formatting. Previously, metals required it to be in the main workspace directory or to be defined via configuration. Now, we will also try to use the default scalafmt config from Scala CLI
3ef771b
to
2cae1fe
Compare
@ckipp01 @kasiaMarek I reworked it using your suggestions. Now when the file doesn't exist we get: No .scalafmt.conf file detected. How would you like to proceed:
I removed the last option as 4 was too much for the message request and wasn't too visible. In case of 2 we will create .scalafmt.conf file in .metals. That will also be reported via message to the user. Then we have 3 options, first scalafmt config will the one from root, next the one from scala-build and lastly from .metals. |
…reating a hidden conf file
29c5efe
to
ae681ac
Compare
metals/src/main/scala/scala/meta/internal/metals/FormattingProvider.scala
Outdated
Show resolved
Hide resolved
metals/src/main/scala/scala/meta/internal/metals/FormattingProvider.scala
Outdated
Show resolved
Hide resolved
…ger relevant option
793152e
to
dd566ac
Compare
Scalafmt needs to habe a config file to run formatting. Previously, metals required it to be in the main workspace directory or to be defined via configuration. Now, we will also try to use the default scalafmt config from Scala CLI