Stream: t-compiler/wg-rls-2.0

Topic: Emacs and trace.sever for rust-analyzer


apiraino (Apr 04 2020 at 23:20, on Zulip):

Hi! I've just installed Rust Analyzer ( 2020-03-30 build) and I'm trying to figure out the configuration for Emacs with lsp-mode.

First question. When emacs starts, rust-analyzer starts too (good). However I see RA keeping all CPU cores working like crazy for ~10s. I'd like to understand what is RA doing. I'd like to set trace.server in my emacs config and be able to read somewhere some useful debug.

Is that part of lsp-rust relevant to such inizialization? How do I enable tra server tracing?
https://github.com/emacs-lsp/lsp-mode/blob/acc0531b7f7a04aeb8055c8ed5dc0fbfa0fe7fbb/lsp-rust.el#L504

apiraino (Apr 05 2020 at 00:22, on Zulip):

Kind of answering to myself, I opened a PR but I'm not sure of what I'm doing
https://github.com/emacs-lsp/lsp-mode/pull/1564

Laurențiu Nicola (Apr 05 2020 at 07:45, on Zulip):

I'd like to understand what is RA doing.

It used to not do anything, but now it's analyzing some of the source code to make further operations faster. See https://github.com/rust-analyzer/rust-analyzer/pull/3474 and https://github.com/rust-analyzer/rust-analyzer/issues/1650.

Laurențiu Nicola (Apr 05 2020 at 07:50, on Zulip):

It also depends on the editor: Code has native support for semantic highlighting and it will trigger that analysis for the open files anyway.

Florian Diebold (Apr 05 2020 at 08:33, on Zulip):

does the trace.server option even still exist? I can't find any reference to it in the code. You'd want to use lsp-log-io in Emacs though.

Florian Diebold (Apr 05 2020 at 08:34, on Zulip):

and/or set RUST_LOG=error on the rust-analyzer call

apiraino (Apr 05 2020 at 11:02, on Zulip):

Florian Diebold said:

does the trace.server option even still exist? I can't find any reference to it in the code. You'd want to use lsp-log-io in Emacs though.

I think so as it is mentioned in the LSP specs. And I've discovered the emacs lsp-mode package has already an option to activate that :smile:
Anyway good to know also about the lsp-log-io (duh, it was on the README.md too ...)

thanks!

apiraino (Apr 05 2020 at 11:03, on Zulip):

Laurențiu Nicola said:

It used to not do anything, but now it's analyzing some of the source code to make further operations faster. See https://github.com/rust-analyzer/rust-analyzer/pull/3474 and https://github.com/rust-analyzer/rust-analyzer/issues/1650.

I've read that issue and, yes, now I understand it's supposed to happen when I first open emacs on a project :thumbs_up:

matklad (Apr 06 2020 at 07:23, on Zulip):

trace.server is a magical config setting, which is fully implemented in the client. That is, we don't have any special code for it, but VS Code still uses is to show the full log of requests.

I wonder if it makes sense for lsp-mode uses the same setting as well...

Florian Diebold (Apr 06 2020 at 09:13, on Zulip):

lsp-mode does have lsp-server-trace and lsp-log-io (I think this is actually more like lsp-log-io, if it logs requests/responses in the client?)

Last update: May 29 2020 at 16:45UTC