Drop support for nvim 0.5

This commit is contained in:
ViViDboarder 2023-06-13 16:47:03 -07:00
parent 03df97c0d2
commit a616e2e14c
4 changed files with 10 additions and 100 deletions

View File

@ -1,3 +1,7 @@
if vim.fn.has("nvim-0.6.0") ~= 1 then
print("ERROR: Requires nvim >= 0.6.0")
end
local o = vim.o
-- Helpers

View File

@ -28,7 +28,6 @@ packer.init({
[">=0.8.0"] = "latest-0.8",
[">=0.7.0"] = "latest-0.7",
[">=0.6.0"] = "latest-0.6",
[">=0.5.0"] = "latest",
}),
snapshot_path = packer_util.join_paths(vim.fn.stdpath("config"), "packer_snapshots"),
display = {
@ -296,14 +295,12 @@ use({
branch = utils.map_version_rule({
[">=0.8.0"] = utils.nil_val,
[">=0.7.0"] = "0.7-compat",
["<0.7.0"] = utils.nil_val, -- use pinned commits
["<0.7.0"] = utils.nil_val, -- use pinned commit
}),
commit = utils.map_version_rule({
[">=0.8.0"] = utils.nil_val,
[">=0.7.0"] = utils.nil_val, -- Use pinned branch
[">=0.6.0"] = "4b403d2d724f48150ded41189ae4866492a8158b",
[">=0.5.1"] = "739a98c12bedaa2430c4a3c08d1d22ad6c16513e",
[">=0.5.0"] = "3e7390735501d0507bf2c2b5c2e7a16f58deeb81",
}),
requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
})
@ -333,7 +330,6 @@ use({
[">=0.8.0"] = utils.nil_val,
[">=0.7.0"] = "4cccb6f494eb255b32a290d37c35ca12584c74d0",
[">=0.6.0"] = "bc25a6a5",
[">=0.5.0"] = "a189323454d1215c682c7ad7db3e6739d26339c4",
}),
config = function()
require("utils").require_with_local("plugins.treesitter").setup()

View File

@ -48,6 +48,8 @@ function M.configure(options)
null_ls.builtins.formatting.prettier,
null_ls.builtins.formatting.trim_whitespace,
null_ls.builtins.formatting.trim_newlines,
-- Ansible
null_ls.builtins.diagnostics.ansiblelint.with({ filetypes = { "yaml.ansible" } }),
-- Fish
null_ls.builtins.formatting.fish_indent,
-- Python
@ -59,6 +61,7 @@ function M.configure(options)
-- Text
null_ls.builtins.code_actions.proselint,
null_ls.builtins.diagnostics.proselint,
null_ls.builtins.diagnostics.alex,
null_ls.builtins.diagnostics.write_good.with({
extra_args = { "--no-adverb" },
diagnostics_postprocess = function(diagnostic)
@ -74,33 +77,11 @@ function M.configure(options)
null_ls.builtins.diagnostics.hadolint,
}
-- HACK: Support for <0.6
if vim.fn.has("nvim-0.6.0") == 1 then
vim.list_extend(sources, {
-- Text
null_ls.builtins.diagnostics.alex,
-- Ansible
null_ls.builtins.diagnostics.ansiblelint.with({ filetypes = { "yaml.ansible" } }),
})
else
-- Sources I use added or modified after 0.5.0 compatability was broken
vim.list_extend(sources, {
require("plugins.null-ls.linters").alex,
require("plugins.null-ls.linters").ansiblelint,
})
end
sources = disable_formatter_filetypes_for_existing_servers(sources, { "python", "lua" })
-- Setup or configure null_ls
if null_ls["setup"] ~= nil then
options.sources = sources
null_ls.setup(options)
else
-- HACK: Handle old versions of null_ls for vim < 0.6 that don't support `setup`
null_ls.config({ sources = sources })
require("lspconfig")["null-ls"].setup(options)
end
options.sources = sources
null_ls.setup(options)
end)
end

View File

@ -1,71 +0,0 @@
local M = {}
local null_ls = require("null-ls")
local helpers = require("null-ls.helpers")
M.alex = {
name = "alex",
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "markdown" },
generator = null_ls.generator({
command = "alex",
args = { "--stdin", "--quiet" },
to_stdin = true,
from_stderr = true,
format = "line",
check_exit_code = function(code)
return code <= 1
end,
on_output = helpers.diagnostics.from_patterns({
{
pattern = [[ *(%d+):(%d+)-(%d+):(%d+) *(%w+) *(.+) +[%w]+ +([-%l]+)]],
groups = { "row", "col", "end_row", "end_col", "severity", "message", "code" },
},
}),
}),
}
M.ansiblelint = {
name = "ansiblelint",
method = null_ls.methods.DIAGNOSTICS,
filetypes = { "yaml.ansible" },
generator = null_ls.generator({
command = "ansible-lint",
to_stdin = true,
ignore_stderr = true,
args = { "-f", "codeclimate", "-q", "--nocolor", "$FILENAME" },
format = "json",
check_exit_code = function(code)
return code <= 2
end,
multiple_files = true,
on_output = function(params)
local severities = {
blocker = helpers.diagnostics.severities.error,
critical = helpers.diagnostics.severities.error,
major = helpers.diagnostics.severities.error,
minor = helpers.diagnostics.severities.warning,
info = helpers.diagnostics.severities.information,
}
params.messages = {}
for _, message in ipairs(params.output) do
local col = nil
local row = message.location.lines.begin
if type(row) == "table" then
row = row.line
col = row.column
end
table.insert(params.messages, {
row = row,
col = col,
message = message.check_name,
severity = severities[message.severity],
filename = message.location.path,
})
end
return params.messages
end,
}),
}
return M