Skip to content

Commit 9eab777

Browse files
Merge branch 'main' into languages/fish
2 parents b7f891c + 7ec2619 commit 9eab777

6 files changed

Lines changed: 118 additions & 122 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
- The `setupOpts.mappings` options were also removed. Use the built-in Neovim
2626
settings (nvf's {option}`vim.keymaps`)
2727

28+
[Snoweuph](https://github.com/snoweuph)
29+
30+
- Fix `vim.assistant.codecompanion-nvim.setupOpts.display.diff.provider` to only
31+
allow valid options. `default` is no longer valid. `inline` and `split` are
32+
two new valid options.
33+
2834
## Changelog {#sec-release-0-9-changelog}
2935

3036
[taylrfnt](https://github.com/taylrfnt)
@@ -172,6 +178,8 @@
172178
- Added [tera](https://keats.github.io/tera/) language support (syntax
173179
highlighting only).
174180
181+
- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics.
182+
175183
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
176184
https://github.com/gorbit99/codewindow.nvim
177185

flake.lock

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

modules/plugins/assistant/codecompanion/codecompanion-nvim.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ in {
5959
};
6060

6161
provider = mkOption {
62-
type = enum ["default" "mini_diff"];
63-
default = "default";
62+
type = enum ["inline" "split" "mini_diff"];
63+
default = "inline";
6464
description = "The preferred kind of provider.";
6565
};
6666
};

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
}

modules/wrapper/build/config.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
inherit (lib.trivial) flip;
1010
inherit (builtins) filter isString hasAttr getAttr;
1111

12-
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
12+
getPin = flip getAttr (inputs.mnw.lib.npinsToPluginsAttrs pkgs ../../../npins/sources.json);
1313

1414
# Build a Vim plugin with the given name and arguments.
1515
buildPlug = attrs: let

npins/sources.nix

Lines changed: 0 additions & 115 deletions
This file was deleted.

0 commit comments

Comments
 (0)