Pain of 3 hours to configure rust-analyzer and what can be done better #9396
Unanswered
rusty-snake
asked this question in
General
Replies: 1 comment
-
[language-server.rust-analyzer.config]
check.command = "clippy" does work (I just tested). I think the reason that it doesn't reload the language config is because |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
helix 23.10 (f6021dd) from Fedora 39 package repositories.
I recently switched to helix, rust-analyzer worked out of the box and I am quite happy with it. Now I wanted to configure rust-analyzer to use clippy and other
imports.granularity.group
which got much more complicated than it should be.The wiki has an example language.toml snippet to use clippy. Unfortunately this snippet does not work. Documentation and Wikis can become outdated so I started debugging this.
Finding the correct format by reading documentation did not worked. Besides the wiki I did not found much documentation how the
config
of a language server is build. And searching for other snippets in the internet and in Issues and Discussions gives more outdated confusion that it helps.So I had to go with good old trail-and-error. Change
languages.toml
and see what happens. Sounds simple, but it is not because:config-reload
+:lsp-restart
can not be used to test although it looks like they are the right commands.:lsp-restart
restarts rust-analyzer so any changeinitilalizationOptions
should be used (this command works as expected). And:config-reload
re-readslanguages.toml
. You can prove thatlanguages.toml
is re-read because a syntax error will make:config-reload
to dump a error message. However, at least anything underlanguage-server.rust-analyzer.config
is not updated by:config-reload
. You have to actually restart helix which is very unexpected. After realizing how I can actually test a changedlangauges.toml
after 2hours it got quick.So back to the original problem. The snippet from the wiki is almost correct, but the stated behaviour of
language-server.rust-analyzer.config.check.command => rust-analyzer.check.command
is wrong. You have to use the full key (i.e.language-server.rust-analyzer.config.rust-analyzer.check.command
) to make it work.What can be done better
language-server.*.config
works. In the best case with a lot of examples in addition to a reference.:config-reload
behave in a expected way.Beta Was this translation helpful? Give feedback.
All reactions