diff --git a/lua/rustaceanvim/config/server.lua b/lua/rustaceanvim/config/server.lua index c4206929..3c6a37db 100644 --- a/lua/rustaceanvim/config/server.lua +++ b/lua/rustaceanvim/config/server.lua @@ -22,15 +22,18 @@ function server.load_rust_analyzer_settings(project_root, opts) local default_settings = opts.default_settings or config.server.default_settings local use_clippy = config.tools.enable_clippy and vim.fn.executable('cargo-clippy') == 1 ---@diagnostic disable-next-line: undefined-field - if default_settings['rust-analyzer'].check == nil and use_clippy then + if default_settings['rust-analyzer'].check == nil and use_clippy and + type(default_settings['rust-analyzer'].checkOnSave) ~= 'table' then ---@diagnostic disable-next-line: inject-field default_settings['rust-analyzer'].check = { allFeatures = true, command = 'clippy', extraArgs = { '--no-deps' }, } - ---@diagnostic disable-next-line: inject-field - default_settings['rust-analyzer'].checkOnSave = true + if type(default_settings['rust-analyzer'].checkOnSave) ~= 'boolean' then + ---@diagnostic disable-next-line: inject-field + default_settings['rust-analyzer'].checkOnSave = true + end end if not project_root then return default_settings @@ -151,3 +154,4 @@ function server.create_client_capabilities() end return server +