scalameta / metals-vscode

Visual Studio Code extension for Metals
https://marketplace.visualstudio.com/items?itemName=scalameta.metals#overview
Apache License 2.0
302 stars 77 forks source link

Command 'Metals:New Scala Project' resulted in an error #628

Closed DavidFi1 closed 2 years ago

DavidFi1 commented 3 years ago

Hi. I am new to scala ! - so please be patient :-) Thank you & Sorry...

After installing Metals in the VsCode To make a new project I do "run a command" Scala new project

I get error "Command 'Metals:New Scala Project' resulted in an error (command 'metals.new-scala-project' not found)

I am on win10 with java --version java 16.0.1 2021-04-20 Java(TM) SE Runtime Environment (build 16.0.1+9-24) Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

tgodzik commented 3 years ago

Thanks for reporting! It looks like the extension hasn't activated properly, that command will only work if you are in an existing workspace or and empty directory. Did you maybe run it from a new empty window? Alternatively it's possible that the extension failed to activate, but there should be something in the Metals output. View -> Output and select Metals.

It's possible that Metals will not work with JDK 16, so in that case it might help to downgrade to 11.

PS: Do not hesitate to ask any questions, if something is unclear or not working it's always good to ask!

DavidFi1 commented 3 years ago

Failed to download Metals, make sure you have an internet connection and the Java Home 'C:\Program Files\Java\jdk1.6.0_45' is valid. You can configure the Java Home in the settings.See https://scalameta.org/metals/docs/editors/vscode.html#http-proxy for instructions if you are using an HTTP proxy.

Can I download & install it manually?

tgodzik commented 3 years ago

Sure, you can download it for example from https://adoptopenjdk.net/ unpack it and point the setting metal.javaHome to the unpacked folder (the one that contains bin directory)

DavidFi1 commented 3 years ago

https://adoptopenjdk.net/ gets me to Prebuilt OpenJDK Binaries for Free! not metals download...?!

tgodzik commented 3 years ago

We currently do offer to download those binaries for you however it seem this doesn't work if we detect an existing JDK on the machine. You need to update it manually currently.

I made a PR to help with this situation https://github.com/scalameta/metals-vscode/pull/629

tgodzik commented 2 years ago

The JDK is now offered to be installed automatically, so this should help with the issues at hand.

HenockMakumbu commented 1 year ago

Hi,

Someone can help me here with this error below :

Error running command metals.reveal-active-file: command 'metals.reveal-active-file' not found. This is likely caused by the extension that contributes metals.reveal-active-file.

I can't create a new scala project, I have always this message of error. I have Ubuntu 22, I want to use VS code and Metals.

tgodzik commented 1 year ago

This looks like the extension hasn't started, which is why the contributed commands are not found. If you click on Start metals it should start properly. You can take a look at the Metals output (View -> Output and select Metlas in the dropdown menu). That should show us what kind of issues you might having if the Start Metals button doesn't work.

Siddharthlsh commented 1 year ago

I have faced the same error , clicked the Output, and in the dropdown I selected Metals. The output shows "Metals will not start because you've opened a single file and not a project directory. Release notes was not shown: not showing release notes since they've already been seen for your current version"