mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-03 05:44:31 +02:00
plugins/lsp: deprecate installLanguageServer option in favor of setting package = null
This commit is contained in:
parent
5a744a7006
commit
183eac72a9
3 changed files with 144 additions and 68 deletions
|
@ -8,9 +8,97 @@
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.plugins.lsp;
|
cfg = config.plugins.lsp;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports =
|
||||||
./language-servers
|
[
|
||||||
];
|
./language-servers
|
||||||
|
]
|
||||||
|
# TODO: introduced 2024-02-14, remove on 2024-03-14
|
||||||
|
++ (
|
||||||
|
map
|
||||||
|
(
|
||||||
|
serverName:
|
||||||
|
mkRemovedOptionModule
|
||||||
|
["plugins" "lsp" "servers" serverName "installLanguageServer"]
|
||||||
|
"If you want to not install the language server package, set `plugins.lsp.servers.${serverName}.package` to `false`."
|
||||||
|
)
|
||||||
|
[
|
||||||
|
"astro"
|
||||||
|
"bashls"
|
||||||
|
"beancount"
|
||||||
|
"biome"
|
||||||
|
"ccls"
|
||||||
|
"clangd"
|
||||||
|
"clojure-lsp"
|
||||||
|
"cmake"
|
||||||
|
"csharp-ls"
|
||||||
|
"cssls"
|
||||||
|
"dagger"
|
||||||
|
"dartls"
|
||||||
|
"denols"
|
||||||
|
"dhall-lsp-server"
|
||||||
|
"digestif"
|
||||||
|
"dockerls"
|
||||||
|
"efm"
|
||||||
|
"elixirls"
|
||||||
|
"elmls"
|
||||||
|
"emmet_ls"
|
||||||
|
"eslint"
|
||||||
|
"fsautocomplete"
|
||||||
|
"futhark-lsp"
|
||||||
|
"gdscript"
|
||||||
|
"gleam"
|
||||||
|
"gopls"
|
||||||
|
"graphql"
|
||||||
|
"helm-ls"
|
||||||
|
"hls"
|
||||||
|
"html"
|
||||||
|
"htmx"
|
||||||
|
"intelephense"
|
||||||
|
"java-language-server"
|
||||||
|
"jsonls"
|
||||||
|
"julials"
|
||||||
|
"kotlin-language-server"
|
||||||
|
"leanls"
|
||||||
|
"lemminx"
|
||||||
|
"ltex"
|
||||||
|
"lua-ls"
|
||||||
|
"marksman"
|
||||||
|
"metals"
|
||||||
|
"nil_ls"
|
||||||
|
"nixd"
|
||||||
|
"nushell"
|
||||||
|
"ols"
|
||||||
|
"omnisharp"
|
||||||
|
"perlpls"
|
||||||
|
"pest_ls"
|
||||||
|
"phpactor"
|
||||||
|
"prismals"
|
||||||
|
"prolog-ls"
|
||||||
|
"purescriptls"
|
||||||
|
"pylsp"
|
||||||
|
"pylyzer"
|
||||||
|
"pyright"
|
||||||
|
"rnix-lsp"
|
||||||
|
"ruff-lsp"
|
||||||
|
"rust-analyzer"
|
||||||
|
"solargraph"
|
||||||
|
"sourcekit"
|
||||||
|
"svelte"
|
||||||
|
"tailwindcss"
|
||||||
|
"taplo"
|
||||||
|
"templ"
|
||||||
|
"terraformls"
|
||||||
|
"texlab"
|
||||||
|
"tsserver"
|
||||||
|
"typst-lsp"
|
||||||
|
"vala-ls"
|
||||||
|
"vls"
|
||||||
|
"volar"
|
||||||
|
"vuels"
|
||||||
|
"yamlls"
|
||||||
|
"zls"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
plugins.lsp = {
|
plugins.lsp = {
|
||||||
|
|
|
@ -19,80 +19,68 @@
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.plugins.lsp.servers.${name};
|
cfg = config.plugins.lsp.servers.${name};
|
||||||
|
|
||||||
packageOption =
|
|
||||||
if package != null
|
|
||||||
then {
|
|
||||||
package = mkOption {
|
|
||||||
default = package;
|
|
||||||
type = types.package;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else {};
|
|
||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
plugins.lsp.servers.${name} =
|
plugins.lsp.servers.${name} = {
|
||||||
{
|
enable = mkEnableOption description;
|
||||||
enable = mkEnableOption description;
|
|
||||||
|
|
||||||
installLanguageServer = mkOption {
|
package = mkOption {
|
||||||
type = types.bool;
|
default = package;
|
||||||
default = true;
|
type = types.nullOr types.package;
|
||||||
description = "Whether nixvim should take care of installing the language server.";
|
description = "Which package to use for ${name}.";
|
||||||
};
|
};
|
||||||
|
|
||||||
cmd = mkOption {
|
cmd = mkOption {
|
||||||
type = with types; nullOr (listOf str);
|
type = with types; nullOr (listOf str);
|
||||||
default =
|
default =
|
||||||
if cfg.installLanguageServer
|
if (cfg.package or null) != null
|
||||||
then cmd cfg
|
then cmd cfg
|
||||||
else null;
|
else null;
|
||||||
};
|
};
|
||||||
|
|
||||||
filetypes = helpers.mkNullOrOption (types.listOf types.str) ''
|
filetypes = helpers.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 = helpers.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 = helpers.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 =
|
onAttach =
|
||||||
helpers.mkCompositeOption "Server specific on_attach behavior."
|
helpers.mkCompositeOption "Server specific on_attach behavior."
|
||||||
{
|
{
|
||||||
override = mkOption {
|
override = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Override the global `plugins.lsp.onAttach` function.";
|
description = "Override the global `plugins.lsp.onAttach` function.";
|
||||||
};
|
|
||||||
|
|
||||||
function = mkOption {
|
|
||||||
type = types.lines;
|
|
||||||
description = ''
|
|
||||||
Body of the on_attach function.
|
|
||||||
The argument `client` and `bufnr` is provided.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = settingsOptions;
|
function = mkOption {
|
||||||
|
type = types.lines;
|
||||||
extraOptions = mkOption {
|
description = ''
|
||||||
default = {};
|
Body of the on_attach function.
|
||||||
type = types.attrs;
|
The argument `client` and `bufnr` is provided.
|
||||||
description = "Extra options for the ${name} language server.";
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
|
||||||
// packageOption;
|
settings = settingsOptions;
|
||||||
|
|
||||||
|
extraOptions = mkOption {
|
||||||
|
default = {};
|
||||||
|
type = types.attrs;
|
||||||
|
description = "Extra options for the ${name} language server.";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config =
|
||||||
|
@ -100,7 +88,7 @@
|
||||||
{
|
{
|
||||||
extraPackages =
|
extraPackages =
|
||||||
optional
|
optional
|
||||||
(cfg.installLanguageServer && (package != null))
|
(cfg.package != null)
|
||||||
cfg.package;
|
cfg.package;
|
||||||
|
|
||||||
plugins.lsp.enabledServers = [
|
plugins.lsp.enabledServers = [
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
# Do not install the language server using nixvim
|
# Do not install the language server using nixvim
|
||||||
gopls = {
|
gopls = {
|
||||||
enable = true;
|
enable = true;
|
||||||
installLanguageServer = false;
|
package = null;
|
||||||
};
|
};
|
||||||
nil_ls.enable = true;
|
nil_ls.enable = true;
|
||||||
rust-analyzer = {
|
rust-analyzer = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue