Skip to content

Commit

Permalink
plugin/rustaceanvim: Handle rust-analyzer settings rename
Browse files Browse the repository at this point in the history
  • Loading branch information
traxys committed Jul 10, 2024
1 parent 34c3c02 commit 123c102
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
20 changes: 18 additions & 2 deletions plugins/languages/rust/rustaceanvim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"nightly"
"rust-analyzer"
];
settings = {
default_settings = {
rust-analyzer = {
inlayHints = {
lifetimeElisionHints = {
Expand All @@ -58,7 +58,23 @@ helpers.neovim-plugin.mkNeovimPlugin config {
'';
in
mkMerge [
{ extraPackages = [ cfg.rustAnalyzerPackage ]; }
{
extraPackages = [ cfg.rustAnalyzerPackage ];
# TODO: remove after 24.11
warnings =
optional
(hasAttrByPath [
"settings"
"server"
"settings"
] cfg)
''
The `plugins.rustaceanvim.settings.server.settings' option has been renamed to `plugins.rustaceanvim.settings.server.default_settings'.
Note that if you supplied an attrset and not a function you need to set this attr set in:
`plugins.rustaceanvim.settings.server.default_settings.rust-analyzer'.
'';
}
# If nvim-lspconfig is enabled:
(mkIf config.plugins.lsp.enable {
# Use the same `on_attach` callback as for the other LSP servers
Expand Down
4 changes: 2 additions & 2 deletions plugins/languages/rust/rustaceanvim/settings-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ with lib;
```
'';

settings =
default_settings =
helpers.mkNullOrStrLuaFnOr
(types.submodule {
options = import ../../../lsp/language-servers/rust-analyzer-config.nix lib helpers;
options.rust-analyzer = import ../../../lsp/language-servers/rust-analyzer-config.nix lib helpers;
freeformType = with types; attrsOf anything;
})
''
Expand Down
2 changes: 1 addition & 1 deletion tests/test-sources/plugins/languages/rust/rustaceanvim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
plugins.rustaceanvim = {
enable = true;

settings.server.settings = {
settings.server.default_settings.rust-analyzer = {
linkedProjects = [ "foo/bar/hello" ];
numThreads = 42;
joinLines.joinElseIf = true;
Expand Down

0 comments on commit 123c102

Please sign in to comment.