lsp-mode icon indicating copy to clipboard operation
lsp-mode copied to clipboard

A way for users to specify `:initialization-options` for rust-analyzer

Open bddap opened this issue 3 years ago • 1 comments

I'm talking about lsp-rust with rust-analyzer but this may be applicable to other language servers too.

Currently, some of rust-analyzers initialization options are settable through variables like lsp-rust-analyzer-experimental-proc-attr-macros. Those variables are used by lsp-rust-analyzer--make-init-options to generate the initialization options that are passed to rust-analyzer.

It's nice that some settings are available, but this paradigm is limiting; not all the settings are supported. For example I'd like to use this setting:

{
  "rust-analyzer.procMacro.ignored": {
    "async-trait": ["async_trait"]
  }
}

It doesn't seem it's currently possible.

Rust analyzer keeps adding/changing options. With the current system I expect the code in lsp-rust.el to require regular edits (maintenance burden) and as a result always be missing bits of functionality.

The Proposal

Give the user control over the initialization-options that are passed to rust-analyzer.

As a bonus, lsp-mode wouldn't need to deal as much with rust-analyzer specific stuff.

bddap avatar May 13 '22 00:05 bddap

We could use defcustom-lsp + lsp-section. In general, doing PRs for newly added properties for better visibility is also something that we want to happen on regular basis.

yyoncho avatar May 13 '22 06:05 yyoncho