Skip to content

Commit

Permalink
mkLsp: helpers -> lib.nixvim
Browse files Browse the repository at this point in the history
  • Loading branch information
HeitorAugustoLN authored and nix-infra-bot committed Jan 6, 2025
1 parent 48eeef5 commit 5201bb2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions plugins/lsp/language-servers/_mk-lsp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
pkgs,
config,
options,
helpers,
lib,
...
}:
Expand Down Expand Up @@ -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;
Expand All @@ -120,7 +119,7 @@ in
};
};

settings = helpers.mkSettingsOption {
settings = lib.nixvim.mkSettingsOption {
description = "The settings for this LSP.";
options = settingsOptions;
};
Expand All @@ -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}
Expand Down

0 comments on commit 5201bb2

Please sign in to comment.