Skip to content

Commit

Permalink
fix(lsp): support top level object + rust-analyzer key in rust-analyz…
Browse files Browse the repository at this point in the history
…er.json
  • Loading branch information
mrcjkb committed Feb 19, 2024
1 parent ec3288d commit e7fffdf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.7.4] - 2024-02-19

### Fixed

- LSP: Support both top-level rust-analyzer object and object with
`"rust-analyzer":` key when importing settings from `rust-analyzer.json`.
The fix introduced in version 4.6.0 had accidentally broken
backward compatibility. The new implementation is backward compatible again.

## [4.7.3] - 2024-02-15

### Fixed
Expand Down
9 changes: 8 additions & 1 deletion lua/rustaceanvim/config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ function server.load_rust_analyzer_settings(project_root, opts)
vim.notify('rustaceanvim: ' .. msg, vim.log.levels.ERROR)
return default_settings
end
default_settings['rust-analyzer'] = rust_analyzer_settings
local ra_key = 'rust-analyzer'
if rust_analyzer_settings[ra_key] then
-- Settings json with "rust-analyzer" key
default_settings[ra_key] = rust_analyzer_settings[ra_key]
else
-- "rust-analyzer" settings are top level
default_settings[ra_key] = rust_analyzer_settings
end
return default_settings
end

Expand Down

0 comments on commit e7fffdf

Please sign in to comment.