plugin/rust-tools: Correctly take into account on_attach (#737)

Nixvim uses a common function for the on attach function of lsp,
__lspOnAttach. With the current implementation the function was not
taken into account if no server options were present, this fixes this
issue.
This commit is contained in:
traxys 2023-11-23 22:11:17 +01:00 committed by GitHub
parent 3577c971e7
commit a108c2e676
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,14 +123,13 @@ in {
}; };
server = server =
helpers.mkCompositeOption "server" {
({
standalone = helpers.defaultNullOpts.mkBool true '' standalone = helpers.defaultNullOpts.mkBool true ''
standalone file support standalone file support
setting it to false may improve startup time setting it to false may improve startup time
''; '';
} }
// (import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs)); // (import ../lsp/language-servers/rust-analyzer-config.nix lib pkgs);
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package]; extraPlugins = with pkgs.vimPlugins; [nvim-lspconfig cfg.package];
@ -176,9 +175,8 @@ in {
enabled_graphviz_backends = enabledGraphvizBackends; enabled_graphviz_backends = enabledGraphvizBackends;
}; };
}; };
server = with cfg.server; server = {
helpers.ifNonNull' cfg.server { inherit (cfg.server) standalone;
inherit standalone;
settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server; settings.rust-analyzer = lib.filterAttrs (n: v: n != "standalone") cfg.server;
on_attach = helpers.mkRaw "__lspOnAttach"; on_attach = helpers.mkRaw "__lspOnAttach";
}; };