From 88e9dd1a64af41ab613a8937b6fcfbc664c61484 Mon Sep 17 00:00:00 2001 From: Paul Hüber <45110470+p-hueber@users.noreply.github.com> Date: Fri, 10 Mar 2023 01:26:41 +0100 Subject: fix(rust_analyzer): remove stub settings from default (#2401) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Non-empty default settings trigger a workspace/didChangeConfiguration, potentially overwriting the initial settings. Move this example content into the description instead. Co-authored-by: Paul Hüber --- lua/lspconfig/server_configurations/rust_analyzer.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/rust_analyzer.lua b/lua/lspconfig/server_configurations/rust_analyzer.lua index 4e95ce87..d5c0d940 100644 --- a/lua/lspconfig/server_configurations/rust_analyzer.lua +++ b/lua/lspconfig/server_configurations/rust_analyzer.lua @@ -55,9 +55,6 @@ return { or util.root_pattern 'rust-project.json'(fname) or util.find_git_ancestor(fname) end, - settings = { - ['rust-analyzer'] = {}, - }, }, commands = { CargoReload = { @@ -73,7 +70,19 @@ https://github.com/rust-analyzer/rust-analyzer rust-analyzer (aka rls 2.0), a language server for Rust -See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#settings) for extra settings. + +See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#settings) for extra settings. The settings can be used like this: +```lua +require'lspconfig'.rust_analyzer.setup{ + settings = { + ['rust-analyzer'] = { + diagnostics = { + enable = false; + } + } + } +} +``` ]], default_config = { root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]], -- cgit v1.2.3-70-g09d2