Skip to content

Commit 565d9e2

Browse files
committed
plugins/yaml-companion: init
1 parent 764a9b8 commit 565d9e2

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-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: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{ lib, ... }:
2+
{
3+
empty = {
4+
plugins.yaml-companion.enable = true;
5+
};
6+
7+
defaults = {
8+
plugins.yaml-companion = {
9+
enable = true;
10+
11+
settings = {
12+
builtin_matchers = {
13+
kubernetes.enabled = true;
14+
cloud_init.enabled = true;
15+
};
16+
schemas = [ ];
17+
lspconfig = {
18+
flags = {
19+
debounce_text_changes = 150;
20+
};
21+
settings = {
22+
redhat.telemetry.enabled = false;
23+
yaml = {
24+
validate = true;
25+
format.enable = true;
26+
hover = true;
27+
schemaStore = {
28+
enable = true;
29+
url = "https://www.schemastore.org/api/json/catalog.json";
30+
};
31+
schemaDownload.enable = true;
32+
schemas = [ ];
33+
trace.server = "debug";
34+
};
35+
};
36+
};
37+
};
38+
};
39+
};
40+
41+
example = {
42+
plugins.yaml-companion = {
43+
enable = true;
44+
45+
settings = {
46+
schemas = [
47+
{
48+
name = "Argo CD Application";
49+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/argoproj.io/application_v1alpha1.json";
50+
}
51+
{
52+
name = "SealedSecret";
53+
uri = "https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/bitnami.com/sealedsecret_v1alpha1.json";
54+
}
55+
];
56+
lspconfig = {
57+
settings = {
58+
yaml = {
59+
format.enable = false;
60+
schemaStore = {
61+
enable = false;
62+
url = "";
63+
};
64+
schemas = lib.nixvim.mkRaw "require('schemastore').yaml.schemas()";
65+
};
66+
};
67+
};
68+
};
69+
};
70+
};
71+
}

0 commit comments

Comments
 (0)