plugin/rustaceanvim: Handle rust-analyzer settings rename

This commit is contained in:
traxys 2024-07-10 22:30:09 +02:00
parent 34c3c026b4
commit 123c102a13
3 changed files with 21 additions and 5 deletions

View file

@ -34,7 +34,7 @@ helpers.neovim-plugin.mkNeovimPlugin config {
"nightly" "nightly"
"rust-analyzer" "rust-analyzer"
]; ];
settings = { default_settings = {
rust-analyzer = { rust-analyzer = {
inlayHints = { inlayHints = {
lifetimeElisionHints = { lifetimeElisionHints = {
@ -58,7 +58,23 @@ helpers.neovim-plugin.mkNeovimPlugin config {
''; '';
in in
mkMerge [ 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: # If nvim-lspconfig is enabled:
(mkIf config.plugins.lsp.enable { (mkIf config.plugins.lsp.enable {
# Use the same `on_attach` callback as for the other LSP servers # Use the same `on_attach` callback as for the other LSP servers

View file

@ -254,10 +254,10 @@ with lib;
``` ```
''; '';
settings = default_settings =
helpers.mkNullOrStrLuaFnOr helpers.mkNullOrStrLuaFnOr
(types.submodule { (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; freeformType = with types; attrsOf anything;
}) })
'' ''

View file

@ -143,7 +143,7 @@
plugins.rustaceanvim = { plugins.rustaceanvim = {
enable = true; enable = true;
settings.server.settings = { settings.server.default_settings.rust-analyzer = {
linkedProjects = [ "foo/bar/hello" ]; linkedProjects = [ "foo/bar/hello" ];
numThreads = 42; numThreads = 42;
joinLines.joinElseIf = true; joinLines.joinElseIf = true;