scalameta / metals

Scala language server with rich IDE features 🚀

Home Page:https://scalameta.org/metals/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

metals-doctor-run client command has optional html arg

kurnevsky opened this issue · comments

Describe the bug

Metals doesn't always pass html argument with metals-doctor-run client command. For instance, when bloop process dies and metals shows message with open doctor request. This should be either documented in https://scalameta.org/metals/docs/integrations/new-editor#run-doctor-1 or fixed.

Can this happen with metals-doctor-reload as well?

Logs:

[Trace - 09:33:55 AM] Received request 'window/showMessageRequest - (3135).
Params: {
  "actions": [
    {
      "title": "Open doctor."
    }
  ],
  "type": 2,
  "message": "Bloop 1 ⚠️ : Picked up JAVA_TOOL_OPTIONS: -Dmetals.allow-multiline-string-formatting=off -Dmetals.icons=unicode"
}


[Trace - 09:33:55 AM] Sending response 'window/showMessageRequest - (3135)'. Processing request took 1960ms
Params: {
  "jsonrpc": "2.0",
  "id": "3135",
  "result": {
    "title": "Open doctor."
  }
}


[Trace - 09:33:55 AM] Received notification 'metals/executeClientCommand'.
Params: {
  "command": "metals-doctor-run",
  "arguments": []
}

Expected behavior

No response

Operating system

None

Editor/Extension

None

Version of Metals

1.3.0

Extra context or search terms

No response

Isn't it a leftover, I don't think we use that html argument anywhere, for sure not on the server. We might just need to adjust the docs. Or are you aware of a case where that argument was being used?

It's a metals/executeClientCommand which is sent from the server to a client. Other clients than for vscode can use it (and we do in emacs lsp-metals).

Sure, I understand, but it seems that metals-doctor-run is never invoked with any arguments. Should it be? I am not sure why the html arg was needed at any point.

It is invoked with html arg when client sends doctor-run command:


[Trace - 04:32:24 PM] Sending request 'workspace/executeCommand - (38)'.
Params: {
  "command": "doctor-run"
}


[Trace - 04:32:24 PM] Received notification 'metals/executeClientCommand'.
Params: {
  "command": "metals-doctor-run",
  "arguments": [
    "<h1 >Metals Doctor</h1>
    ...

Ach right, looks like we are not doing that correctly, we should dig into that.