scalameta / metals-vscode

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

When no workspace and metals cannot start show error message in a more visible place #1477

Closed Sporarum closed 3 months ago

Sporarum commented 3 months ago

Describe the bug

When first installing Metals, when going to the Metals tab on the sidebar, the four sections print: "There is no data provider registered that can provide view data." (The four sections being: Packages, Build Commands, Ongoing Compilations, Help and Feedback.)

To Reproduce

Exact reproducer:

  1. Connect to vdi.epfl.ch with your epfl credentials
  2. Select VM IC-Windows-Cours1
  3. Open VS Code
  4. Install Metals
  5. Click on the Metals logo on the left, below the extensions icon
  6. The newly opened side pannel contains nothing but the error

Approximate reproducer:

  1. Install VS Code
  2. Go to point 4. above

Expected behavior

It should either:

  1. Work straight away
  2. If the user needs to do something, then clear instructions should be printed

In particular, you'll note the Metals Doctor, and the logs are not accessible, as they would be under "Help and Feedback"

Similar bugs

When opening Metals outside of a Scala Project, the Packages section shows buttons to help getting started, but the remaining sections show the same "no data provider" message. Again, this includes the "Help and Feedback" section, and so the doctor and the logs.

This is the case only sometimes, trying it again, the buttons appeared for a split second before being replaced by the "no data provider" message.

Screenshots

image

Similar bug with image

Installation:

Sporarum commented 3 months ago

Going to Output -> Metals does reveal the cause of the issue: "Metals will not start because you've opened a single file and not a project directory."

This message should not be hidden there !

And furthermore, replacing the "no data provider" message by that message would not completely fix the situation, as the "New Scala Project" button, and the "Help and Feedback" section would still not be present.

Therefore I think instead Metals should run in a simplified mode when outside a folder, just enough to enable users to create a project.

kasiaMarek commented 3 months ago

This message should not be hidden there !

We can show the message in a more visible manner and provide information on should the user do as a temporary solution.

Therefore I think instead Metals should run in a simplified mode when outside a folder, just enough to enable users to create a project.

For those we already have issues: https://github.com/scalameta/metals-vscode/issues/357 https://github.com/scalameta/metals-feature-requests/issues/231 and there is some in progress work to allow metals to work without a workspace: https://github.com/scalameta/metals/pull/5531 (unfortunately currently blocked on a semanticdb issue)