mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-05-21 06:16:33 +00:00
Merge 198986b3fb into cd45295f9c
This commit is contained in:
commit
d279bf735f
2 changed files with 31 additions and 9 deletions
|
|
@ -551,4 +551,8 @@ https://github.com/gorbit99/codewindow.nvim
|
||||||
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
|
- Allow `vim.treesitter.context.setupOpts.max_lines` to also be given as a
|
||||||
string in order to allow percentage values like `"20%"`
|
string in order to allow percentage values like `"20%"`
|
||||||
|
|
||||||
|
[RoastedCheese](https://github.com/roastedcheese):
|
||||||
|
|
||||||
|
- Fix `golangci-lint` to lint at the package level.
|
||||||
|
|
||||||
<!-- vim: set textwidth=80: -->
|
<!-- vim: set textwidth=80: -->
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,21 @@
|
||||||
"--output.junit-xml.path="
|
"--output.junit-xml.path="
|
||||||
"--output.teamcity.path="
|
"--output.teamcity.path="
|
||||||
"--output.sarif.path="
|
"--output.sarif.path="
|
||||||
|
(mkLuaInline ''
|
||||||
|
-- Run on current file only if go.mod is missing
|
||||||
|
function()
|
||||||
|
local fnmod = ":p";
|
||||||
|
local cmd = {"${getExe pkgs.go}", "env", "GOMOD"};
|
||||||
|
local ok, gomod = pcall(vim.fn.system, cmd);
|
||||||
|
gomod = gomod:gsub("%s+", "")
|
||||||
|
if ok and gomod ~= "" and gomod ~= "/dev/null" then
|
||||||
|
fnmod = ":h";
|
||||||
|
end
|
||||||
|
return vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), fnmod)
|
||||||
|
end
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
|
append_fname = false;
|
||||||
parser = mkLuaInline ''
|
parser = mkLuaInline ''
|
||||||
function(output, bufnr)
|
function(output, bufnr)
|
||||||
local SOURCE = "golangci-lint";
|
local SOURCE = "golangci-lint";
|
||||||
|
|
@ -111,15 +125,19 @@
|
||||||
local normalized = issue.Severity:lower()
|
local normalized = issue.Severity:lower()
|
||||||
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
||||||
end
|
end
|
||||||
table.insert(diagnostics, {
|
|
||||||
bufnr = bufnr,
|
local buffer = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(bufnr), ":p")
|
||||||
lnum = issue.Pos.Line - 1,
|
if vim.fs.normalize(buffer) == vim.fs.normalize(issue.Pos.Filename) then
|
||||||
col = issue.Pos.Column - 1,
|
table.insert(diagnostics, {
|
||||||
message = issue.Text,
|
bufnr = bufnr,
|
||||||
code = issue.FromLinter,
|
lnum = issue.Pos.Line - 1,
|
||||||
severity = sev,
|
col = issue.Pos.Column - 1,
|
||||||
source = SOURCE,
|
message = issue.Text,
|
||||||
})
|
code = issue.FromLinter,
|
||||||
|
severity = sev,
|
||||||
|
source = SOURCE,
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return diagnostics
|
return diagnostics
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue