File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -202,14 +202,18 @@ vim.lsp.config("rust_analyzer", {
202202 default_root_dir (bufnr , on_dir )
203203 end ,
204204 before_init = function (init_params , config )
205- -- When inside rust-lang/rust, we need to use the special rust_analyzer settings.
205+ -- When inside rust-lang/rust, we need to use the special rust-analyzer settings.
206206 local settings = vim .fs .joinpath (config .root_dir , " src/etc/rust_analyzer_zed.json" )
207207 if vim .uv .fs_stat (settings ) then
208208 local file = io.open (settings )
209209 -- nvim 0.12+ supports comments otherwise you'll need content:gsub("//[^\n]*", "").
210210 local json = vim .json .decode (file :read (" *a" ), { skip_comments = true })
211211 file :close ()
212- config .settings [" rust-analyzer" ] = json .lsp [" rust-analyzer" ].initialization_options
212+ config .settings [" rust-analyzer" ] = vim .tbl_deep_extend (
213+ " force" , -- Overwrite with the special settings when there is a conflict.
214+ config .settings [" rust-analyzer" ] or {},
215+ json .lsp [" rust-analyzer" ].initialization_options
216+ )
213217 end
214218 default_before_init (init_params , config )
215219 end ,
You can’t perform that action at this time.
0 commit comments