Skip to content

Commit 3722f88

Browse files
committed
modules/lsp: move server module to dedicated file
1 parent 74368bc commit 3722f88

File tree

2 files changed

+53
-50
lines changed

2 files changed

+53
-50
lines changed

modules/lsp/default.nix

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,10 @@
44
...
55
}:
66
let
7-
inherit (lib) mkOption types;
7+
inherit (lib) types;
88
inherit (lib.nixvim) toLuaObject;
99

1010
cfg = config.lsp;
11-
12-
serverType = types.submodule {
13-
options = {
14-
enable = lib.mkEnableOption "the language server";
15-
16-
activate = lib.mkOption {
17-
type = types.bool;
18-
description = ''
19-
Whether to call `vim.lsp.enable()` for this server.
20-
'';
21-
default = true;
22-
example = false;
23-
};
24-
25-
package = lib.mkOption {
26-
type = with types; nullOr package;
27-
default = null;
28-
description = ''
29-
Package to use for this language server.
30-
31-
Alternatively, the language server should be available on your `$PATH`.
32-
'';
33-
};
34-
35-
config = mkOption {
36-
type = with types; attrsOf anything;
37-
description = ''
38-
Configurations for each language server.
39-
'';
40-
default = { };
41-
example = {
42-
cmd = [
43-
"clangd"
44-
"--background-index"
45-
];
46-
root_markers = [
47-
"compile_commands.json"
48-
"compile_flags.txt"
49-
];
50-
filetypes = [
51-
"c"
52-
"cpp"
53-
];
54-
};
55-
};
56-
};
57-
};
5811
in
5912
{
6013
options.lsp = {
@@ -70,8 +23,8 @@ in
7023
enable = lib.mkEnableOption "inlay hints globally";
7124
};
7225

73-
servers = mkOption {
74-
type = types.attrsOf serverType;
26+
servers = lib.mkOption {
27+
type = types.attrsOf (types.submodule ./server.nix);
7528
description = ''
7629
LSP servers to enable and/or configure.
7730

modules/lsp/server.nix

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{ lib, ... }:
2+
let
3+
inherit (lib) types;
4+
in
5+
{
6+
options = {
7+
enable = lib.mkEnableOption "the language server";
8+
9+
activate = lib.mkOption {
10+
type = types.bool;
11+
description = ''
12+
Whether to call `vim.lsp.enable()` for this server.
13+
'';
14+
default = true;
15+
example = false;
16+
};
17+
18+
package = lib.mkOption {
19+
type = with types; nullOr package;
20+
default = null;
21+
description = ''
22+
Package to use for this language server.
23+
24+
Alternatively, the language server should be available on your `$PATH`.
25+
'';
26+
};
27+
28+
config = lib.mkOption {
29+
type = with types; attrsOf anything;
30+
description = ''
31+
Configurations for each language server.
32+
'';
33+
default = { };
34+
example = {
35+
cmd = [
36+
"clangd"
37+
"--background-index"
38+
];
39+
root_markers = [
40+
"compile_commands.json"
41+
"compile_flags.txt"
42+
];
43+
filetypes = [
44+
"c"
45+
"cpp"
46+
];
47+
};
48+
};
49+
};
50+
}

0 commit comments

Comments
 (0)