mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
mkLsp: helpers
-> lib.nixvim
This commit is contained in:
parent
48eeef58e1
commit
5201bb2f6f
1 changed files with 7 additions and 8 deletions
|
@ -22,7 +22,6 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
helpers,
|
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
@ -87,24 +86,24 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
filetypes = helpers.mkNullOrOption (types.listOf types.str) ''
|
filetypes = lib.nixvim.mkNullOrOption (types.listOf types.str) ''
|
||||||
Set of filetypes for which to attempt to resolve {root_dir}.
|
Set of filetypes for which to attempt to resolve {root_dir}.
|
||||||
May be empty, or server may specify a default value.
|
May be empty, or server may specify a default value.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
autostart = helpers.defaultNullOpts.mkBool true ''
|
autostart = lib.nixvim.defaultNullOpts.mkBool true ''
|
||||||
Controls if the `FileType` autocommand that launches a language server is created.
|
Controls if the `FileType` autocommand that launches a language server is created.
|
||||||
If `false`, allows for deferring language servers until manually launched with
|
If `false`, allows for deferring language servers until manually launched with
|
||||||
`:LspStart` (|lspconfig-commands|).
|
`:LspStart` (|lspconfig-commands|).
|
||||||
'';
|
'';
|
||||||
|
|
||||||
rootDir = helpers.defaultNullOpts.mkLuaFn "nil" ''
|
rootDir = lib.nixvim.defaultNullOpts.mkLuaFn "nil" ''
|
||||||
A function (or function handle) which returns the root of the project used to
|
A function (or function handle) which returns the root of the project used to
|
||||||
determine if lspconfig should launch a new language server, or attach a previously
|
determine if lspconfig should launch a new language server, or attach a previously
|
||||||
launched server when you open a new buffer matching the filetype of the server.
|
launched server when you open a new buffer matching the filetype of the server.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
onAttach = helpers.mkCompositeOption "Server specific on_attach behavior." {
|
onAttach = lib.nixvim.mkCompositeOption "Server specific on_attach behavior." {
|
||||||
override = mkOption {
|
override = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
@ -120,7 +119,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = helpers.mkSettingsOption {
|
settings = lib.nixvim.mkSettingsOption {
|
||||||
description = "The settings for this LSP.";
|
description = "The settings for this LSP.";
|
||||||
options = settingsOptions;
|
options = settingsOptions;
|
||||||
};
|
};
|
||||||
|
@ -142,8 +141,8 @@ in
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
inherit (cfg) cmd filetypes autostart;
|
inherit (cfg) cmd filetypes autostart;
|
||||||
root_dir = cfg.rootDir;
|
root_dir = cfg.rootDir;
|
||||||
on_attach = helpers.ifNonNull' cfg.onAttach (
|
on_attach = lib.nixvim.ifNonNull' cfg.onAttach (
|
||||||
helpers.mkRaw ''
|
lib.nixvim.mkRaw ''
|
||||||
function(client, bufnr)
|
function(client, bufnr)
|
||||||
${optionalString (!cfg.onAttach.override) config.plugins.lsp.onAttach}
|
${optionalString (!cfg.onAttach.override) config.plugins.lsp.onAttach}
|
||||||
${cfg.onAttach.function}
|
${cfg.onAttach.function}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue