mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
modules/lsp: move server module to dedicated file
This commit is contained in:
parent
74368bcfc1
commit
3722f88c5d
2 changed files with 53 additions and 50 deletions
|
@ -4,57 +4,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) mkOption types;
|
inherit (lib) types;
|
||||||
inherit (lib.nixvim) toLuaObject;
|
inherit (lib.nixvim) toLuaObject;
|
||||||
|
|
||||||
cfg = config.lsp;
|
cfg = config.lsp;
|
||||||
|
|
||||||
serverType = types.submodule {
|
|
||||||
options = {
|
|
||||||
enable = lib.mkEnableOption "the language server";
|
|
||||||
|
|
||||||
activate = lib.mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Whether to call `vim.lsp.enable()` for this server.
|
|
||||||
'';
|
|
||||||
default = true;
|
|
||||||
example = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
package = lib.mkOption {
|
|
||||||
type = with types; nullOr package;
|
|
||||||
default = null;
|
|
||||||
description = ''
|
|
||||||
Package to use for this language server.
|
|
||||||
|
|
||||||
Alternatively, the language server should be available on your `$PATH`.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
config = mkOption {
|
|
||||||
type = with types; attrsOf anything;
|
|
||||||
description = ''
|
|
||||||
Configurations for each language server.
|
|
||||||
'';
|
|
||||||
default = { };
|
|
||||||
example = {
|
|
||||||
cmd = [
|
|
||||||
"clangd"
|
|
||||||
"--background-index"
|
|
||||||
];
|
|
||||||
root_markers = [
|
|
||||||
"compile_commands.json"
|
|
||||||
"compile_flags.txt"
|
|
||||||
];
|
|
||||||
filetypes = [
|
|
||||||
"c"
|
|
||||||
"cpp"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.lsp = {
|
options.lsp = {
|
||||||
|
@ -70,8 +23,8 @@ in
|
||||||
enable = lib.mkEnableOption "inlay hints globally";
|
enable = lib.mkEnableOption "inlay hints globally";
|
||||||
};
|
};
|
||||||
|
|
||||||
servers = mkOption {
|
servers = lib.mkOption {
|
||||||
type = types.attrsOf serverType;
|
type = types.attrsOf (types.submodule ./server.nix);
|
||||||
description = ''
|
description = ''
|
||||||
LSP servers to enable and/or configure.
|
LSP servers to enable and/or configure.
|
||||||
|
|
||||||
|
|
50
modules/lsp/server.nix
Normal file
50
modules/lsp/server.nix
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib) types;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
enable = lib.mkEnableOption "the language server";
|
||||||
|
|
||||||
|
activate = lib.mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = ''
|
||||||
|
Whether to call `vim.lsp.enable()` for this server.
|
||||||
|
'';
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = with types; nullOr package;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Package to use for this language server.
|
||||||
|
|
||||||
|
Alternatively, the language server should be available on your `$PATH`.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkOption {
|
||||||
|
type = with types; attrsOf anything;
|
||||||
|
description = ''
|
||||||
|
Configurations for each language server.
|
||||||
|
'';
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
cmd = [
|
||||||
|
"clangd"
|
||||||
|
"--background-index"
|
||||||
|
];
|
||||||
|
root_markers = [
|
||||||
|
"compile_commands.json"
|
||||||
|
"compile_flags.txt"
|
||||||
|
];
|
||||||
|
filetypes = [
|
||||||
|
"c"
|
||||||
|
"cpp"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue