3

I am using: Linux, VS Code, Dotty, Metals, SBT, scalafmt

From the shell sbt scalaftm formats my files.

From the editor I can do ctrl + shift + I, I get an error message:

There is no formatter for 'scala' files installed.

It allows me to install a formatter, then shows a list with "Better Comments", "Spotless Gradle", and a number of things that I do not want.

I have enabled the setting of formating on save, but it does not work.

The easiest test is ctrl + shift + I. Metals should be finding scalafmt, how can I see what is not working?

BTW: bottom left corner shows the interpreter for Python, which I find odd in a Scala project.

Trylks
  • 1,458
  • 2
  • 18
  • 31
  • I am not sure if metals supports **Dotty** yet. Have you tried with a **Scala** `2.13.2` project? – Luis Miguel Mejía Suárez May 21 '20 at 20:26
  • I would have addressed this question at Metals, VS Code, or somewhere else, but I do not know what is failing in the entire stack. Hopefully the question is not too stupid. – Trylks May 21 '20 at 20:27
  • 1
    @LuisMiguelMejíaSuárez I think Dotty is supported since 0.9.0 https://scalameta.org/metals/blog/2020/05/04/lithium.html – Mario Galic May 21 '20 at 20:29
  • 2
    @Trylks Formatting with scalafmt in VSC works on my machine: https://stackoverflow.com/a/61060570/5205022 – Mario Galic May 21 '20 at 20:32
  • 1
    Take a look at metals doctor, it may say what is wrong with current setup: https://scalameta.org/metals/docs/editors/vscode.html#run-doctor – Mateusz Kubuszok May 21 '20 at 20:38
  • @MateuszKubuszok interestingly, I get an error: `command 'metals.doctor-run' not found`, I am suspecting the Metals one-click installation did not work... (the command palette `ctrl+shift+p` shows it as a possible command, though) – Trylks May 21 '20 at 20:43
  • 1
    Try updating/reinstalling metals plugin, maybe something went wrong? – Mateusz Kubuszok May 21 '20 at 20:44
  • @MateuszKubuszok I have uninstalled every Scala-related extension, including Scala Syntax (Metals installs it automatically, as a dependency), then installed Metals. Same result. Restarting the computer between uninstalling and reinstalling (and using) does not seem to help either – Trylks May 21 '20 at 20:50
  • 1
    Hmm, then I would ask on metals GitHub page. They are really interested in all feedback and issues so that they could make things better. They will definitely try to help you. – Mateusz Kubuszok May 21 '20 at 20:53
  • @MateuszKubuszok thank you very much for your help, I see it seems to be a Metals problem, and I have learned about metals doctor – Trylks May 21 '20 at 20:58

0 Answers0