1

Update generated neovim config

This commit is contained in:
2024-08-15 14:28:54 +02:00
parent 07409c223d
commit 25cfcf2941
3809 changed files with 351157 additions and 0 deletions

View File

@ -0,0 +1,40 @@
local severity_map = {
["Error"] = vim.diagnostic.severity.ERROR,
["Warning"] = vim.diagnostic.severity.WARN,
["Convention"] = vim.diagnostic.severity.HINT,
}
return {
cmd = "bin/ameba",
stdin = false,
append_fname = true,
args = {
"--format",
"json",
},
ignore_exitcode = true,
parser = function(output)
local diagnostics = {}
local decoded = vim.json.decode(output)
if not decoded.sources[1] then
return diagnostics
end
local issues = decoded.sources[1].issues
for _, issue in pairs(issues) do
table.insert(diagnostics, {
source = "ameba",
code = issue.rule_name,
lnum = issue.location.line - 1,
col = issue.location.column - 1,
end_col = issue.end_location.column,
end_lnum = issue.end_location.line - 1,
message = issue.message,
severity = severity_map[issue.severity],
})
end
return diagnostics
end,
}

View File

@ -0,0 +1,16 @@
local pattern = "([^:]+):(%d+):(%d+):(.+)"
local groups = { "file", "lnum", "col", "message" }
local severity_map = {
["error"] = vim.diagnostic.severity.ERROR,
}
return {
cmd = "ghdl",
stdin = false,
args = { "-s", "--std=08" },
stream = "stderr",
ignore_exitcode = true,
parser = require("lint.parser").from_pattern(pattern, groups, severity_map, {
source = "ghdl",
}),
}

View File

@ -0,0 +1,30 @@
return {
cmd = "protolint",
stdin = false,
append_fname = true,
args = { "lint", "--reporter=json" },
stream = "stderr",
ignore_exitcode = true,
env = nil,
parser = function(output)
if output == "" then
return {}
end
local json_output = vim.json.decode(output)
local diagnostics = {}
if json_output.lints == nil then
return diagnostics
end
for _, item in ipairs(json_output.lints) do
table.insert(diagnostics, {
lnum = item.line - 1,
col = item.column - 1,
message = item.message,
file = item.filename,
code = item.rule,
severity = vim.diagnostic.severity.WARN,
})
end
return diagnostics
end,
}

View File

@ -0,0 +1,51 @@
local severities = {
vim.diagnostic.severity.HINT,
vim.diagnostic.severity.INFO,
vim.diagnostic.severity.WARN,
vim.diagnostic.severity.ERROR,
}
local no_ruleset_found_msg = [[Spectral could not find a ruleset.
Please define a .spectral file in the current working directory or override the linter args to provide the path to a ruleset.]]
return {
cmd = 'spectral',
stdin = false,
append_fname = true,
args = { "lint", "-f", "json", },
stream = "both",
ignore_exitcode = true,
parser = function(output, _)
-- inform user if no ruleset has been found
if string.find(output, "No ruleset has been found") ~= nil then
vim.notify(no_ruleset_found_msg, vim.log.levels.WARN)
return {}
end
local result = vim.json.decode(output)
-- prevent warning on yaml files without supported schema
if result[1].code == "unrecognized-format" then
return {}
end
local items = {}
local bufpath = vim.fn.expand('%:p')
for _, diag in ipairs(result) do
if diag.source == bufpath then
table.insert(items, {
source = "spectral",
severity = severities[diag.severity + 1],
code = diag.code,
message = diag.message,
lnum = diag.range.start.line + 1,
end_lnum = diag.range["end"].line + 1,
col = diag.range.start.character + 1,
end_col = diag.range["end"].character + 1,
})
end
end
return items
end,
}

View File

@ -0,0 +1,65 @@
local pattern = "(%w+).*%((%d+)%)(.*)%s+%-%-%s+(.+)"
local groups = { "severity", "lnum", "code", "message" }
local severity_map = {
["ERROR"] = vim.diagnostic.severity.ERROR,
["WARNING"] = vim.diagnostic.severity.WARN,
["INFORMATION"] = vim.diagnostic.severity.INFO,
["HINT"] = vim.diagnostic.severity.HINT,
}
local config_files = {
"vsg_config.yaml",
"vsg_config.yml",
"vsg_config.json",
"vsg.yaml",
"vsg.yml",
"vsg.json",
".vsg_config.yaml",
".vsg_config.yml",
".vsg_config.json",
".vsg.yaml",
".vsg.yml",
".vsg.json",
}
local function find_config(dirname)
local paths = {
dirname,
(os.getenv("XDG_CONFIG_HOME") or os.getenv("HOME") .. "/.config") .. "/vsg",
}
for _, path in ipairs(paths) do
local config = vim.fs.find(config_files, {
path = path,
upward = path == dirname,
})[1]
if config then
return config
end
end
end
return function()
local args = function()
local args = { "-of", "syntastic", "--stdin" }
local config_file = find_config(vim.fn.expand("%:p:h"))
if config_file then
table.insert(args, "-c")
table.insert(args, config_file)
end
return args
end
return {
cmd = "vsg",
stdin = true,
args = args(),
stream = "stdout",
ignore_exitcode = true,
parser = require("lint.parser").from_pattern(pattern, groups, severity_map, {
source = "vsg",
}),
}
end