Skip to content

Commit 09bd743

Browse files
authored
Merge branch 'main' into notashelf/push-qozvyzsvqtmk
2 parents f8f1017 + 8aae700 commit 09bd743

15 files changed

Lines changed: 317 additions & 37 deletions

File tree

configuration.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ isMaximal: {
7272
extensions.crates-nvim.enable = isMaximal;
7373
};
7474
toml.enable = isMaximal;
75+
xml.enable = isMaximal;
7576

7677
# Language modules that are not as common.
7778
assembly.enable = false;
@@ -92,9 +93,10 @@ isMaximal: {
9293
fsharp.enable = false;
9394
just.enable = false;
9495
qml.enable = false;
95-
96+
jinja.enable = false;
9697
tailwind.enable = false;
9798
svelte.enable = false;
99+
tera.enable = false;
98100

99101
# Nim LSP is broken on Darwin and therefore
100102
# should be disabled by default. Users may still enable

docs/manual/release-notes/rl-0.9.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,24 @@
132132
133133
- Added [sqruff](https://github.com/quarylabs/sqruff) support to `languages.sql`
134134
135+
- Lazy-load `crates.nvim` plugin when using
136+
`vim.languages.rust.extensions.crates-nvim.enable`
137+
135138
- Added [Pyrefly](https://pyrefly.org/) and [zuban](https://zubanls.com/)
136139
support to `languages.python`
137140
138141
- Added TOML support via {option}`languages.toml` and the
139142
[Tombi](https://tombi-toml.github.io/tombi/) language server, linter, and
140143
formatter.
141144
145+
- Added Jinja support via `languages.jinja`
146+
142147
- Added [hlargs.nvim](https://github.com/m-demare/hlargs.nvim) support as
143148
`visuals.hlargs-nvim`.
144149
150+
- Lazy-load `nvim-autopairs` plugin when using
151+
`vim.autopairs.nvim-autopairs.enable`
152+
145153
[Machshev](https://github.com/machshev):
146154
147155
- Added `ruff` and `ty` LSP support for Python under `programs.python`.
@@ -151,4 +159,17 @@
151159
- Added [Selenen](https://github.com/kampfkarren/selene) for more diagnostics in
152160
`languages.lua`.
153161
162+
- Added XML syntax highlighting, LSP support and formatting
163+
164+
- Added [tera](https://keats.github.io/tera/) language support (syntax
165+
highlighting only).
166+
167+
- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics.
168+
169+
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
170+
https://github.com/gorbit99/codewindow.nvim
171+
172+
- Add [codewindow.nvim] plugin in `vim.assistant.codewindow` with `enable` and
173+
`setupOpts`
174+
154175
<!-- vim: set textwidth=80: -->

flake.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
systems.url = "github:nix-systems/default";
123123

124124
## Basic Inputs
125-
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
125+
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
126126

127127
flake-parts = {
128128
url = "github:hercules-ci/flake-parts";

modules/plugins/autopairs/nvim-autopairs/config.nix

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,14 @@
44
...
55
}: let
66
inherit (lib.modules) mkIf;
7-
inherit (lib.nvim.dag) entryAnywhere;
8-
inherit (lib.nvim.lua) toLuaObject;
9-
107
cfg = config.vim.autopairs.nvim-autopairs;
118
in {
129
config = mkIf cfg.enable {
13-
vim = {
14-
startPlugins = ["nvim-autopairs"];
15-
pluginRC.autopairs = entryAnywhere ''
16-
require('nvim-autopairs').setup(${toLuaObject cfg.setupOpts})
17-
'';
10+
vim.lazy.plugins.nvim-autopairs = {
11+
package = "nvim-autopairs";
12+
setupModule = "nvim-autopairs";
13+
setupOpts = cfg.setupOpts;
14+
event = ["InsertEnter"];
1815
};
1916
};
2017
}

modules/plugins/languages/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ in {
1919
./helm.nix
2020
./kotlin.nix
2121
./html.nix
22+
./tera.nix
2223
./haskell.nix
2324
./java.nix
25+
./jinja.nix
2426
./json.nix
2527
./lua.nix
2628
./markdown.nix
@@ -50,6 +52,7 @@ in {
5052
./yaml.nix
5153
./ruby.nix
5254
./just.nix
55+
./xml.nix
5356

5457
# This is now a hard deprecation.
5558
(mkRenamedOptionModule ["vim" "languages" "enableLSP"] ["vim" "lsp" "enable"])

modules/plugins/languages/go.nix

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
inherit (lib.meta) getExe;
1111
inherit (lib.generators) mkLuaInline;
1212
inherit (lib.types) bool enum package;
13-
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
13+
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
1414
inherit (lib.nvim.dag) entryAfter;
1515
inherit (lib.nvim.attrsets) mapListToAttrs;
1616

@@ -78,6 +78,91 @@
7878
package = pkgs.delve;
7979
};
8080
};
81+
82+
defaultDiagnosticsProvider = ["golangci-lint"];
83+
diagnosticsProviders = {
84+
golangci-lint = let
85+
pkg = pkgs.golangci-lint;
86+
in {
87+
package = pkg;
88+
config = {
89+
cmd = getExe pkg;
90+
args = [
91+
"run"
92+
"--output.json.path=stdout"
93+
"--issues-exit-code=0"
94+
"--show-stats=false"
95+
"--fix=false"
96+
"--path-mode=abs"
97+
# Overwrite values that could be configured and result in unwanted writes
98+
"--output.text.path="
99+
"--output.tab.path="
100+
"--output.html.path="
101+
"--output.checkstyle.path="
102+
"--output.code-climate.path="
103+
"--output.junit-xml.path="
104+
"--output.teamcity.path="
105+
"--output.sarif.path="
106+
];
107+
parser = mkLuaInline ''
108+
function(output, bufnr)
109+
local SOURCE = "golangci-lint";
110+
111+
local function display_tool_error(msg)
112+
return{
113+
{
114+
bufnr = bufnr,
115+
lnum = 0,
116+
col = 0,
117+
message = string.format("[%s] %s", SOURCE, msg),
118+
severity = vim.diagnostic.severity.ERROR,
119+
source = SOURCE,
120+
},
121+
}
122+
end
123+
124+
if output == "" then
125+
return display_tool_error("no output provided")
126+
end
127+
128+
local ok, decoded = pcall(vim.json.decode, output)
129+
if not ok then
130+
return display_tool_error("failed to parse JSON output")
131+
end
132+
133+
if not decoded or not decoded.Issues then
134+
return display_tool_error("unexpected output format")
135+
end
136+
137+
local severity_map = {
138+
error = vim.diagnostic.severity.ERROR,
139+
warning = vim.diagnostic.severity.WARN,
140+
info = vim.diagnostic.severity.INFO,
141+
hint = vim.diagnostic.severity.HINT,
142+
}
143+
local diagnostics = {}
144+
for _, issue in ipairs(decoded.Issues) do
145+
local sev = vim.diagnostic.severity.ERROR
146+
if issue.Severity and issue.Severity ~= "" then
147+
local normalized = issue.Severity:lower()
148+
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
149+
end
150+
table.insert(diagnostics, {
151+
bufnr = bufnr,
152+
lnum = issue.Pos.Line - 1,
153+
col = issue.Pos.Column - 1,
154+
message = issue.Text,
155+
code = issue.FromLinter,
156+
severity = sev,
157+
source = SOURCE,
158+
})
159+
end
160+
return diagnostics
161+
end
162+
'';
163+
};
164+
};
165+
};
81166
in {
82167
options.vim.languages.go = {
83168
enable = mkEnableOption "Go language support";
@@ -134,6 +219,14 @@ in {
134219
default = debuggers.${cfg.dap.debugger}.package;
135220
};
136221
};
222+
extraDiagnostics = {
223+
enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
224+
types = diagnostics {
225+
langDesc = "Go";
226+
inherit diagnosticsProviders;
227+
inherit defaultDiagnosticsProvider;
228+
};
229+
};
137230
};
138231

139232
config = mkIf cfg.enable (mkMerge [
@@ -179,5 +272,15 @@ in {
179272
debugger.nvim-dap.enable = true;
180273
};
181274
})
275+
276+
(mkIf cfg.extraDiagnostics.enable {
277+
vim.diagnostics.nvim-lint = {
278+
enable = true;
279+
linters_by_ft.go = cfg.extraDiagnostics.types;
280+
linters =
281+
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
282+
cfg.extraDiagnostics.types);
283+
};
284+
})
182285
]);
183286
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}: let
7+
inherit (builtins) attrNames;
8+
inherit (lib.meta) getExe;
9+
inherit (lib.modules) mkIf mkMerge;
10+
inherit (lib.options) mkEnableOption mkOption;
11+
inherit (lib.types) enum listOf;
12+
inherit (lib.nvim.types) mkGrammarOption;
13+
inherit (lib.nvim.attrsets) mapListToAttrs;
14+
15+
cfg = config.vim.languages.jinja;
16+
defaultServers = ["jinja-lsp"];
17+
servers = {
18+
jinja-lsp = {
19+
enable = true;
20+
cmd = [(getExe pkgs.jinja-lsp)];
21+
filetypes = ["jinja"];
22+
root_markers = [
23+
".git"
24+
];
25+
};
26+
};
27+
in {
28+
options.vim.languages.jinja = {
29+
enable = mkEnableOption "Jinja template language support";
30+
31+
treesitter = {
32+
enable = mkEnableOption "Jinja treesitter" // {default = config.vim.languages.enableTreesitter;};
33+
package = mkGrammarOption pkgs "jinja";
34+
inlinePackage = mkGrammarOption pkgs "jinja_inline";
35+
};
36+
37+
lsp = {
38+
enable = mkEnableOption "Jinja LSP support" // {default = config.vim.lsp.enable;};
39+
servers = mkOption {
40+
description = "Jinja LSP server to use";
41+
type = listOf (enum (attrNames servers));
42+
default = defaultServers;
43+
};
44+
};
45+
};
46+
47+
config = mkIf cfg.enable (mkMerge [
48+
(mkIf cfg.treesitter.enable {
49+
vim.treesitter.enable = true;
50+
vim.treesitter.grammars = [
51+
cfg.treesitter.package
52+
cfg.treesitter.inlinePackage
53+
];
54+
})
55+
56+
(mkIf cfg.lsp.enable {
57+
vim.lsp.servers =
58+
mapListToAttrs (n: {
59+
name = n;
60+
value = servers.${n};
61+
})
62+
cfg.lsp.servers;
63+
})
64+
]);
65+
}

modules/plugins/languages/rust.nix

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,17 @@ in {
228228
(mkIf cfg.extensions.crates-nvim.enable {
229229
vim = mkMerge [
230230
{
231-
startPlugins = ["crates-nvim"];
232-
pluginRC.rust-crates = entryAnywhere ''
233-
require("crates").setup(${toLuaObject cfg.extensions.crates-nvim.setupOpts})
234-
'';
231+
lazy.plugins.crates-nvim = {
232+
package = "crates-nvim";
233+
setupModule = "crates";
234+
setupOpts = cfg.extensions.crates-nvim.setupOpts;
235+
event = [
236+
{
237+
event = "BufRead";
238+
pattern = "Cargo.toml";
239+
}
240+
];
241+
};
235242
}
236243
];
237244
})

modules/plugins/languages/tera.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}: let
7+
inherit (lib.options) mkEnableOption;
8+
inherit (lib.modules) mkIf mkMerge;
9+
inherit (lib.nvim.types) mkGrammarOption;
10+
11+
cfg = config.vim.languages.tera;
12+
in {
13+
options.vim.languages.tera = {
14+
enable = mkEnableOption "Tera templating language support";
15+
16+
treesitter = {
17+
enable = mkEnableOption "Tera treesitter" // {default = config.vim.languages.enableTreesitter;};
18+
package = mkGrammarOption pkgs "tera";
19+
};
20+
};
21+
22+
config = mkIf cfg.enable (mkMerge [
23+
(mkIf cfg.treesitter.enable {
24+
vim.treesitter.enable = true;
25+
vim.treesitter.grammars = [cfg.treesitter.package];
26+
})
27+
]);
28+
}

0 commit comments

Comments
 (0)