mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-14 19:24:34 +02:00
treewide: Reformat with nixfmt
This commit is contained in:
parent
c6281260dc
commit
62f32bfc71
459 changed files with 28139 additions and 26377 deletions
|
@ -5,20 +5,25 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
with lib;
|
||||
let
|
||||
cfg = config.plugins.lsp;
|
||||
in {
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./language-servers
|
||||
]
|
||||
[ ./language-servers ]
|
||||
# TODO: introduced 2024-02-14, remove on 2024-03-14
|
||||
++ (
|
||||
map
|
||||
++ (map
|
||||
(
|
||||
serverName:
|
||||
mkRemovedOptionModule
|
||||
["plugins" "lsp" "servers" serverName "installLanguageServer"]
|
||||
mkRemovedOptionModule
|
||||
[
|
||||
"plugins"
|
||||
"lsp"
|
||||
"servers"
|
||||
serverName
|
||||
"installLanguageServer"
|
||||
]
|
||||
"If you want to not install the language server package, set `plugins.lsp.servers.${serverName}.package` to `null`."
|
||||
)
|
||||
[
|
||||
|
@ -119,7 +124,7 @@ in {
|
|||
"<leader>k" = "goto_prev";
|
||||
"<leader>j" = "goto_next";
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
lspBuf = mkOption {
|
||||
|
@ -132,7 +137,7 @@ in {
|
|||
"gi" = "implementation";
|
||||
"K" = "hover";
|
||||
};
|
||||
default = {};
|
||||
default = { };
|
||||
};
|
||||
|
||||
extra = mkOption {
|
||||
|
@ -164,12 +169,13 @@ in {
|
|||
action = "<CMD>Lspsaga hover_doc<Enter>";
|
||||
}
|
||||
];
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
enabledServers = mkOption {
|
||||
type = with types;
|
||||
type =
|
||||
with types;
|
||||
listOf (oneOf [
|
||||
str
|
||||
(submodule {
|
||||
|
@ -196,7 +202,7 @@ in {
|
|||
})
|
||||
]);
|
||||
description = "A list of enabled LSP servers. Don't use this directly.";
|
||||
default = [];
|
||||
default = [ ];
|
||||
internal = true;
|
||||
visible = false;
|
||||
};
|
||||
|
@ -216,7 +222,7 @@ in {
|
|||
setupWrappers = mkOption {
|
||||
type = with types; listOf (functionTo str);
|
||||
description = "Code to be run to wrap the setup args. Takes in an argument containing the previous results, and returns a new string of code.";
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
|
||||
preConfig = mkOption {
|
||||
|
@ -233,62 +239,54 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
runWrappers = wrappers: s:
|
||||
if wrappers == []
|
||||
then s
|
||||
else (head wrappers) (runWrappers (tail wrappers) s);
|
||||
updateCapabilities = let
|
||||
servers =
|
||||
builtins.filter
|
||||
(server: server.capabilities != null && server.capabilities != {})
|
||||
cfg.enabledServers;
|
||||
in
|
||||
lib.concatMapStringsSep "\n" (
|
||||
server: let
|
||||
updates =
|
||||
lib.concatMapStringsSep "\n"
|
||||
(name: ''
|
||||
config =
|
||||
let
|
||||
runWrappers =
|
||||
wrappers: s: if wrappers == [ ] then s else (head wrappers) (runWrappers (tail wrappers) s);
|
||||
updateCapabilities =
|
||||
let
|
||||
servers = builtins.filter (
|
||||
server: server.capabilities != null && server.capabilities != { }
|
||||
) cfg.enabledServers;
|
||||
in
|
||||
lib.concatMapStringsSep "\n" (
|
||||
server:
|
||||
let
|
||||
updates = lib.concatMapStringsSep "\n" (name: ''
|
||||
client.server_capabilities.${name} = ${helpers.toLuaObject server.capabilities.${name}}
|
||||
'')
|
||||
(builtins.attrNames server.capabilities);
|
||||
in ''
|
||||
if client.name == "${server.name}" then
|
||||
${updates}
|
||||
end
|
||||
''
|
||||
)
|
||||
servers;
|
||||
in
|
||||
'') (builtins.attrNames server.capabilities);
|
||||
in
|
||||
''
|
||||
if client.name == "${server.name}" then
|
||||
${updates}
|
||||
end
|
||||
''
|
||||
) servers;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
extraPlugins = [pkgs.vimPlugins.nvim-lspconfig];
|
||||
extraPlugins = [ pkgs.vimPlugins.nvim-lspconfig ];
|
||||
|
||||
keymapsOnEvents.LspAttach = let
|
||||
mkMaps = prefix:
|
||||
mapAttrsToList
|
||||
(
|
||||
key: action: let
|
||||
actionStr =
|
||||
if isString action
|
||||
then action
|
||||
else action.action;
|
||||
actionProps =
|
||||
if isString action
|
||||
then {}
|
||||
else filterAttrs (n: v: n != "action") action;
|
||||
in {
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = helpers.mkRaw (prefix + actionStr);
|
||||
keymapsOnEvents.LspAttach =
|
||||
let
|
||||
mkMaps =
|
||||
prefix:
|
||||
mapAttrsToList (
|
||||
key: action:
|
||||
let
|
||||
actionStr = if isString action then action else action.action;
|
||||
actionProps = if isString action then { } else filterAttrs (n: v: n != "action") action;
|
||||
in
|
||||
{
|
||||
mode = "n";
|
||||
inherit key;
|
||||
action = helpers.mkRaw (prefix + actionStr);
|
||||
|
||||
options =
|
||||
{
|
||||
options = {
|
||||
inherit (cfg.keymaps) silent;
|
||||
}
|
||||
// actionProps;
|
||||
}
|
||||
);
|
||||
in
|
||||
} // actionProps;
|
||||
}
|
||||
);
|
||||
in
|
||||
(mkMaps "vim.diagnostic." cfg.keymaps.diagnostic)
|
||||
++ (mkMaps "vim.lsp.buf." cfg.keymaps.lspBuf)
|
||||
++ cfg.keymaps.extra;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue