Skip to content

adjust trace level of servers #3767

Open
@mainej

Description

@mainej

The LSP spec defines two ways for a client to ask a server to log traces of the messages that the pair are exchanging. On initialize, clients can set, e.g., "trace": "verbose". After a server has been initialized, clients can send the $/setTrace notification to change the server's trace level.

Both of these can be useful tools for debugging a running LSP session, and I'd like if lsp-mode supported them.

Note that tracing is something that both a client and a server can do. lsp-mode already supports tracing on the client side, via lsp-toggle-trace-io. This feature request is about asking the servers to turn on their tracing too. It may be nicest if lsp-toggle-trace-io turned on tracing on both sides at once. This is how Calva, the VS Code extension for Clojure, behaves.

The first part of this feature request, setting the "trace" key in the initialize request, may be something that each of the lsp-mode language clients have to do themselves. It might be nice if lsp-mode provided a custom variable that the user could set, and which each of the language clients could use during initialize. Or if lsp-mode controls the initialize process (I'm not familiar with its internals) then perhaps it could set the flag itself.

The second part, sending a $/setTrace notification, could either be an addition to lsp-toggle-trace-io, as mentioned before, or be exposed as a new interactive elisp command.

I'll also draw your attention to a variable exposed by many of the language clients, a variable I don't understand but which might be related to all of this. For example, the html client exposes this variable:

(defcustom lsp-html-trace-server "off"
"Traces the communication between VS Code and the HTML language server."
:type '(choice
(const "off")
(const "messages")
(const "verbose"))

Many other clients have a similar, though slightly differently named, variable. The variables' names suggests that they are about tracing, as do their doc string and valid values. (Although, strangely, the doc strings often reference VS Code.) But what I don't understand is how these variable are used, and whether they are supposed to configure the client-side or server-side tracing, or both.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions