2023-02-20 11:42:13 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
} @ args:
|
|
|
|
with lib; let
|
2023-02-23 10:14:42 +01:00
|
|
|
lspHelpers = import ../helpers.nix args;
|
|
|
|
helpers = import ../../helpers.nix {inherit lib;};
|
2023-02-20 11:54:26 +01:00
|
|
|
|
2023-02-23 00:42:44 +01:00
|
|
|
optionWarnings = import ../../../lib/option-warnings.nix args;
|
2023-02-20 11:54:26 +01:00
|
|
|
basePluginPath = ["plugins" "lsp" "servers"];
|
|
|
|
|
2022-07-28 21:37:49 +02:00
|
|
|
servers = [
|
2023-01-24 00:04:37 +00:00
|
|
|
{
|
|
|
|
name = "astro";
|
|
|
|
description = "Enable astrols, for Astro";
|
|
|
|
package = pkgs.nodePackages."@astrojs/language-server";
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/astro-ls" "--stdio"];
|
2023-01-24 00:04:37 +00:00
|
|
|
}
|
2023-01-10 13:41:47 +01:00
|
|
|
{
|
|
|
|
name = "bashls";
|
|
|
|
description = "Enable bashls, for bash.";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.bash-language-server;
|
2023-01-10 13:41:47 +01:00
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "clangd";
|
|
|
|
description = "Enable clangd LSP, for C/C++.";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.clang-tools;
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "cssls";
|
|
|
|
description = "Enable cssls, for CSS";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/vscode-css-language-server" "--stdio"];
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
2023-01-10 23:47:52 +01:00
|
|
|
{
|
|
|
|
name = "dartls";
|
|
|
|
description = "Enable dart language-server, for dart";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.dart;
|
2023-01-23 14:52:46 +01:00
|
|
|
settingsOptions = {
|
2023-01-10 23:47:52 +01:00
|
|
|
analysisExcludedFolders = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
description = ''
|
2023-01-21 18:12:09 +01:00
|
|
|
An array of paths (absolute or relative to each workspace folder) that should be
|
2023-01-10 23:47:52 +01:00
|
|
|
excluded from analysis.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
enableSdkFormatter = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
2023-01-21 18:12:09 +01:00
|
|
|
When set to false, prevents registration (or unregisters) the SDK formatter. When set
|
2023-01-10 23:47:52 +01:00
|
|
|
to true or not supplied, will register/reregister the SDK formatter
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
lineLength = mkOption {
|
|
|
|
type = types.nullOr types.int;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
2023-01-21 18:12:09 +01:00
|
|
|
The number of characters the formatter should wrap code at. If unspecified, code will
|
2023-01-10 23:47:52 +01:00
|
|
|
be wrapped at 80 characters.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
completeFunctionCalls = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
When set to true, completes functions/methods with their required parameters.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
showTodos = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
2023-01-21 18:12:09 +01:00
|
|
|
Whether to generate diagnostics for TODO comments. If unspecified, diagnostics will not
|
2023-01-10 23:47:52 +01:00
|
|
|
be generated.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
renameFilesWithClasses = mkOption {
|
2023-02-20 11:42:13 +01:00
|
|
|
type = types.nullOr (types.enum ["always" "prompt"]);
|
2023-01-10 23:47:52 +01:00
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
When set to "always", will include edits to rename files when classes are renamed if the
|
|
|
|
filename matches the class name (but in snake_form). When set to "prompt", a prompt will
|
|
|
|
be shown on each class rename asking to confirm the file rename. Otherwise, files will
|
|
|
|
not be renamed. Renames are performed using LSP's ResourceOperation edits - that means
|
|
|
|
the rename is simply included in the resulting WorkspaceEdit and must be handled by the
|
|
|
|
client.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
enableSnippets = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
Whether to include code snippets (such as class, stful, switch) in code completion. When
|
|
|
|
unspecified, snippets will be included.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
updateImportsOnRename = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
Whether to update imports and other directives when files are renamed. When unspecified,
|
|
|
|
imports will be updated if the client supports willRenameFiles requests
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
documentation = mkOption {
|
2023-02-20 11:42:13 +01:00
|
|
|
type = types.nullOr (types.enum ["none" "summary" "full"]);
|
2023-01-10 23:47:52 +01:00
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
The typekind of dartdocs to include in Hovers, Code Completion, Signature Help and other
|
|
|
|
similar requests. If not set, defaults to full
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
includeDependenciesInWorkspaceSymbols = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
default = null;
|
|
|
|
description = ''
|
2023-01-21 18:12:09 +01:00
|
|
|
Whether to include symbols from dependencies and Dart/Flutter SDKs in Workspace Symbol
|
2023-01-10 23:47:52 +01:00
|
|
|
results. If not set, defaults to true.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-02-20 11:42:13 +01:00
|
|
|
settings = cfg: {dart = cfg;};
|
2023-01-10 23:47:52 +01:00
|
|
|
}
|
2022-11-16 13:37:35 +01:00
|
|
|
{
|
|
|
|
name = "denols";
|
|
|
|
description = "Enable denols, for Deno";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.deno;
|
2022-11-16 13:37:35 +01:00
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "eslint";
|
|
|
|
description = "Enable eslint";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/vscode-eslint-language-server" "--stdio"];
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
2022-10-22 14:55:22 +01:00
|
|
|
{
|
|
|
|
name = "elixirls";
|
|
|
|
description = "Enable elixirls";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.elixir_ls;
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/elixir-ls"];
|
2022-10-22 14:55:22 +01:00
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "gdscript";
|
|
|
|
description = "Enable gdscript, for Godot";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = null;
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "gopls";
|
|
|
|
description = "Enable gopls, for Go.";
|
|
|
|
}
|
2023-02-25 16:32:55 +01:00
|
|
|
{
|
|
|
|
name = "hls";
|
|
|
|
description = "Enable haskell language server";
|
|
|
|
package = pkgs.haskell-language-server;
|
|
|
|
cmd = cfg: ["haskell-language-server-wrapper"];
|
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "html";
|
|
|
|
description = "Enable html, for HTML";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/vscode-html-language-server" "--stdio"];
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "jsonls";
|
|
|
|
description = "Enable jsonls, for JSON";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.vscode-langservers-extracted;
|
2023-02-20 11:42:13 +01:00
|
|
|
cmd = cfg: ["${cfg.package}/bin/vscode-json-language-server" "--stdio"];
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
2023-01-19 11:37:36 +01:00
|
|
|
{
|
2023-02-20 11:54:26 +01:00
|
|
|
name = "lua-ls";
|
|
|
|
description = "Enable lua LS, for lua";
|
2023-02-28 15:07:24 +01:00
|
|
|
# Use the old name of the lua LS if the user is on a stable branch of nixpkgs
|
|
|
|
# Rename occured here: https://github.com/NixOS/nixpkgs/pull/215057
|
|
|
|
package =
|
|
|
|
if (hasAttr "lua-language-server" pkgs)
|
|
|
|
then pkgs.lua-language-server
|
|
|
|
else pkgs.sumneko-lua-language-server;
|
2023-02-20 11:54:26 +01:00
|
|
|
serverName = "lua_ls";
|
2023-02-23 10:14:42 +01:00
|
|
|
|
|
|
|
# All available settings are documented here:
|
|
|
|
# https://github.com/LuaLS/lua-language-server/wiki/Settings
|
|
|
|
settingsOptions = {
|
|
|
|
runtime = {
|
|
|
|
version = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = ''
|
|
|
|
Tell the language server which version of Lua you're using
|
|
|
|
(most likely LuaJIT in the case of Neovim)
|
|
|
|
'';
|
|
|
|
default = "LuaJIT";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
diagnostics = {
|
|
|
|
globals = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
description = ''
|
|
|
|
An array of variable names that will be declared as global.
|
|
|
|
'';
|
|
|
|
default = ["vim"];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
workspace = {
|
|
|
|
library = mkOption {
|
|
|
|
type = types.nullOr (types.either types.str (helpers.rawType));
|
|
|
|
description = ''
|
|
|
|
An array of abosolute or workspace-relative paths that will be added to the workspace
|
|
|
|
diagnosis - meaning you will get completion and context from these library files.
|
|
|
|
Can be a file or directory.
|
|
|
|
Files included here will have some features disabled such as renaming fields to
|
|
|
|
prevent accidentally renaming your library files.
|
|
|
|
'';
|
|
|
|
default = helpers.mkRaw "vim.api.nvim_get_runtime_file('', true)";
|
|
|
|
};
|
|
|
|
checkThirdParty = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
description = ''
|
|
|
|
Whether third party libraries can be automatically detected and applied.
|
|
|
|
Third party libraries can set up the environment to be as close as possible to your
|
|
|
|
target runtime environment.
|
|
|
|
'';
|
|
|
|
# prevents an annoying warning
|
|
|
|
# https://github.com/LuaLS/lua-language-server/discussions/1688#discussioncomment-4185003
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
telemetry = {
|
|
|
|
enable = mkEnableOption "telemetry";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
settings = cfg: {Lua = cfg;};
|
2023-01-19 11:37:36 +01:00
|
|
|
}
|
2023-04-11 11:51:57 -04:00
|
|
|
{
|
|
|
|
name = "metals";
|
|
|
|
description = "Enable metals, for Scala";
|
|
|
|
}
|
2023-02-25 16:32:55 +01:00
|
|
|
{
|
|
|
|
name = "nil_ls";
|
|
|
|
description = "Enable nil, for Nix";
|
|
|
|
package = pkgs.nil;
|
|
|
|
settingsOptions = {
|
|
|
|
formatting.command = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
description = ''
|
|
|
|
External formatter command (with arguments).
|
|
|
|
It should accepts file content in stdin and print the formatted code into stdout.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
diagnostics = {
|
|
|
|
ignored = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Ignored diagnostic kinds.
|
|
|
|
The kind identifier is a snake_cased_string usually shown together
|
|
|
|
with the diagnostic message.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
excludedFiles = mkOption {
|
|
|
|
type = types.listOf types.str;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Files to exclude from showing diagnostics. Useful for generated files.
|
|
|
|
It accepts an array of paths. Relative paths are joint to the workspace root.
|
|
|
|
Glob patterns are currently not supported.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
settings = cfg: {nil = {inherit (cfg) formatting diagnostics;};};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pylsp";
|
|
|
|
description = "Enable pylsp, for Python.";
|
|
|
|
package = pkgs.python3Packages.python-lsp-server;
|
2023-02-25 17:56:22 +01:00
|
|
|
settings = cfg: {pylsp = cfg;};
|
2023-02-25 16:32:55 +01:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pyright";
|
|
|
|
description = "Enable pyright, for Python.";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "rnix-lsp";
|
|
|
|
description = "Enable rnix LSP, for Nix";
|
|
|
|
serverName = "rnix";
|
|
|
|
}
|
2023-04-27 12:44:39 +02:00
|
|
|
{
|
|
|
|
name = "ruff-lsp";
|
|
|
|
description = "Enable ruff-lsp, for Python.";
|
|
|
|
package = pkgs.python3Packages.ruff-lsp;
|
|
|
|
serverName = "ruff_lsp";
|
|
|
|
}
|
2023-02-25 16:32:55 +01:00
|
|
|
{
|
|
|
|
name = "rust-analyzer";
|
|
|
|
description = "Enable rust-analyzer, for Rust.";
|
|
|
|
serverName = "rust_analyzer";
|
|
|
|
|
|
|
|
settingsOptions = import ./rust-analyzer-config.nix lib;
|
|
|
|
settings = cfg: {rust-analyzer = cfg;};
|
|
|
|
}
|
2022-12-15 18:03:31 +01:00
|
|
|
{
|
|
|
|
name = "tailwindcss";
|
|
|
|
description = "Enable tailwindcss language server, for tailwindcss";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages."@tailwindcss/language-server";
|
2022-12-15 18:03:31 +01:00
|
|
|
}
|
2023-04-08 14:09:30 -07:00
|
|
|
{
|
|
|
|
name = "terraformls";
|
|
|
|
description = "Enable terraform-ls, for terraform";
|
|
|
|
package = pkgs.terraform-ls;
|
|
|
|
}
|
2023-01-10 13:42:22 +01:00
|
|
|
{
|
|
|
|
name = "texlab";
|
|
|
|
description = "Enable texlab language server, for LaTeX";
|
|
|
|
}
|
2022-10-28 01:40:40 +02:00
|
|
|
{
|
|
|
|
name = "tsserver";
|
|
|
|
description = "Enable tsserver for typescript";
|
2023-01-19 10:36:56 +00:00
|
|
|
package = pkgs.nodePackages.typescript-language-server;
|
2022-10-28 01:40:40 +02:00
|
|
|
}
|
2023-04-06 10:34:11 +02:00
|
|
|
{
|
|
|
|
name = "typst-lsp";
|
|
|
|
serverName = "typst_lsp";
|
|
|
|
description = "Enable typst-lsp for typst";
|
|
|
|
package = pkgs.typst-lsp;
|
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "vuels";
|
|
|
|
description = "Enable vuels, for Vue";
|
2023-02-20 11:46:56 +01:00
|
|
|
package = pkgs.nodePackages.vls;
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|
2023-04-11 11:49:32 -04:00
|
|
|
{
|
|
|
|
name = "yamlls";
|
|
|
|
description = "Enable yamlls, for yaml";
|
|
|
|
package = pkgs.yaml-language-server;
|
|
|
|
}
|
2022-07-28 21:37:49 +02:00
|
|
|
{
|
|
|
|
name = "zls";
|
|
|
|
description = "Enable zls, for Zig.";
|
|
|
|
}
|
|
|
|
];
|
2023-02-20 11:42:13 +01:00
|
|
|
in {
|
2023-02-20 11:54:26 +01:00
|
|
|
imports =
|
2023-02-23 10:14:42 +01:00
|
|
|
lib.lists.map (lspHelpers.mkLsp) servers
|
2023-02-23 17:51:55 +01:00
|
|
|
++ [./pylsp.nix]
|
2023-02-20 11:54:26 +01:00
|
|
|
++ [
|
|
|
|
(optionWarnings.mkRenamedOption {
|
|
|
|
option = basePluginPath ++ ["sumneko-lua"];
|
|
|
|
newOption = basePluginPath ++ ["lua-ls"];
|
|
|
|
})
|
|
|
|
];
|
2022-07-28 21:37:49 +02:00
|
|
|
}
|