Skip to content

Commit

Permalink
plugin/rust-tools: Correctly take into account on_attach (#737)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
traxys authored Nov 23, 2023
1 parent 3577c97 commit a108c2e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions plugins/languages/rust.nix
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,13 @@ in {
};

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

0 comments on commit a108c2e

Please sign in to comment.