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,
|
||||
config,
|
||||
options,
|
||||
helpers,
|
||||
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}.
|
||||
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.
|
||||
If `false`, allows for deferring language servers until manually launched with
|
||||
`: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
|
||||
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.
|
||||
'';
|
||||
|
||||
onAttach = helpers.mkCompositeOption "Server specific on_attach behavior." {
|
||||
onAttach = lib.nixvim.mkCompositeOption "Server specific on_attach behavior." {
|
||||
override = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -120,7 +119,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
settings = helpers.mkSettingsOption {
|
||||
settings = lib.nixvim.mkSettingsOption {
|
||||
description = "The settings for this LSP.";
|
||||
options = settingsOptions;
|
||||
};
|
||||
|
@ -142,8 +141,8 @@ in
|
|||
extraOptions = {
|
||||
inherit (cfg) cmd filetypes autostart;
|
||||
root_dir = cfg.rootDir;
|
||||
on_attach = helpers.ifNonNull' cfg.onAttach (
|
||||
helpers.mkRaw ''
|
||||
on_attach = lib.nixvim.ifNonNull' cfg.onAttach (
|
||||
lib.nixvim.mkRaw ''
|
||||
function(client, bufnr)
|
||||
${optionalString (!cfg.onAttach.override) config.plugins.lsp.onAttach}
|
||||
${cfg.onAttach.function}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue