Skip to content

Commit 269f224

Browse files
committed
plugins/yaml-companion: init
1 parent 764a9b8 commit 269f224

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
lib,
3+
config,
4+
...
5+
}:
6+
lib.nixvim.plugins.mkNeovimPlugin {
7+
name = "yaml-companion";
8+
packPathName = "yaml-companion.nvim";
9+
package = "yaml-companion-nvim";
10+
11+
maintainers = [ lib.maintainers.GaetanLepage ];
12+
13+
settingsExample = {
14+
schemas = [
15+
{
16+
name = "Argo CD Application";
17+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json";
18+
}
19+
{
20+
name = "SealedSecret";
21+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/bitnami.com/sealedsecret_v1alpha1.json";
22+
}
23+
];
24+
lspconfig = {
25+
settings = {
26+
yaml = {
27+
format.enable = false;
28+
schemaStore = {
29+
enable = false;
30+
url = "";
31+
};
32+
schemas = lib.nixvim.nestedLiteralLua "require('schemastore').yaml.schemas()";
33+
};
34+
};
35+
};
36+
};
37+
38+
callSetup = false;
39+
extraConfig = cfg: {
40+
warnings = lib.nixvim.mkWarnings "plugins.yaml-companion" [
41+
{
42+
when = !config.plugins.lsp.enable;
43+
message = "This plugin requires the `plugins.lsp.servers.yamlls` module to be enabled.";
44+
}
45+
];
46+
47+
plugins = {
48+
lsp.servers.yamlls.extraOptions = lib.nixvim.mkRaw "require('yaml-companion').setup(${lib.nixvim.toLuaObject cfg.settings})";
49+
50+
telescope.enabledExtensions = [ "yaml_schema" ];
51+
};
52+
};
53+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{ lib, pkgs, ... }:
2+
{
3+
empty = {
4+
plugins = {
5+
lsp = {
6+
enable = true;
7+
servers.yamlls.enable = true;
8+
};
9+
10+
yaml-companion.enable = true;
11+
};
12+
};
13+
14+
defaults = {
15+
plugins = {
16+
lsp = {
17+
enable = true;
18+
servers.yamlls.enable = true;
19+
};
20+
21+
yaml-companion = {
22+
enable = true;
23+
24+
settings = {
25+
builtin_matchers = {
26+
kubernetes.enabled = true;
27+
cloud_init.enabled = true;
28+
};
29+
schemas = [ ];
30+
lspconfig = {
31+
flags = {
32+
debounce_text_changes = 150;
33+
};
34+
settings = {
35+
redhat.telemetry.enabled = false;
36+
yaml = {
37+
validate = true;
38+
format.enable = true;
39+
hover = true;
40+
schemaStore = {
41+
enable = true;
42+
url = "https://www.schemastore.org/api/json/catalog.json";
43+
};
44+
schemaDownload.enable = true;
45+
schemas = [ ];
46+
trace.server = "debug";
47+
};
48+
};
49+
};
50+
};
51+
};
52+
};
53+
};
54+
55+
example = {
56+
extraPlugins = [ pkgs.vimPlugins.SchemaStore-nvim ];
57+
plugins = {
58+
lsp = {
59+
enable = true;
60+
servers.yamlls.enable = true;
61+
};
62+
63+
yaml-companion = {
64+
enable = true;
65+
66+
settings = {
67+
schemas = [
68+
{
69+
name = "Argo CD Application";
70+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json";
71+
}
72+
{
73+
name = "SealedSecret";
74+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/bitnami.com/sealedsecret_v1alpha1.json";
75+
}
76+
];
77+
lspconfig = {
78+
settings = {
79+
yaml = {
80+
format.enable = false;
81+
schemaStore = {
82+
enable = false;
83+
url = "";
84+
};
85+
schemas = lib.nixvim.mkRaw "require('schemastore').yaml.schemas()";
86+
};
87+
};
88+
};
89+
};
90+
};
91+
};
92+
};
93+
}

0 commit comments

Comments
 (0)