mirror of
https://github.com/ViViDboarder/vim-settings.git
synced 2024-12-22 18:37:34 +00:00
Add pre 0.6 support for null-ls
This commit is contained in:
parent
5543af4bbc
commit
150a9b36d8
@ -16,15 +16,17 @@ local function config_dark_notify()
|
||||
})
|
||||
end
|
||||
|
||||
-- Pin version dependent packages
|
||||
-- Pin version dependent packages due to unstable APIs
|
||||
local pinned_commits = {}
|
||||
if vim.fn.has("nvim-0.6.0") ~= 1 then
|
||||
if vim.fn.has("nvim-0.5.1") == 1 then
|
||||
-- Last commit compatible with 0.5.1
|
||||
pinned_commits["telescope"] = "80cdb00b221f69348afc4fb4b701f51eb8dd3120"
|
||||
pinned_commits["null-ls"] = "739a98c12bedaa2430c4a3c08d1d22ad6c16513e"
|
||||
elseif vim.fn.has("nvim-0.5.0") == 1 then
|
||||
-- Last commit compatible with 0.5.1
|
||||
-- Last commit compatible with 0.5.0
|
||||
pinned_commits["telescope"] = "587a10d1494d8ffa1229246228f0655db2f0a48a"
|
||||
pinned_commits["null-ls"] = "3e7390735501d0507bf2c2b5c2e7a16f58deeb81"
|
||||
end
|
||||
end
|
||||
|
||||
@ -201,6 +203,7 @@ return require("packer").startup({
|
||||
-- Generic linter/formatters in diagnostics API
|
||||
use({
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
commit = pinned_commits["null-ls"],
|
||||
requires = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
|
||||
})
|
||||
|
||||
|
@ -176,35 +176,47 @@ end
|
||||
|
||||
function M.config_null_ls()
|
||||
utils.try_require("null-ls", function(null_ls)
|
||||
null_ls.setup({
|
||||
on_attach = default_attach,
|
||||
capabilities = merged_capabilities(),
|
||||
sources = {
|
||||
-- Generic
|
||||
-- null_ls.builtins.formatting.preittier,
|
||||
-- null_ls.builtins.formatting.trim_whitespace,
|
||||
-- null_ls.builtins.formatting.trim_newlines,
|
||||
-- Fish
|
||||
-- null_ls.builtins.formatting.fish_indent,
|
||||
-- Python
|
||||
null_ls.builtins.formatting.reorder_python_imports,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
-- Go
|
||||
null_ls.builtins.diagnostics.golangci_lint,
|
||||
-- Text
|
||||
-- null_ls.builtins.code_actions.proselint,
|
||||
-- Ansible
|
||||
-- null_ls.builtins.diagnostics.ansiblelint,
|
||||
-- Shell
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
-- Rust
|
||||
-- null_ls.builtins.formatting.rustfmt,
|
||||
-- Lua
|
||||
null_ls.builtins.diagnostics.luacheck,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
},
|
||||
})
|
||||
local sources = {
|
||||
-- Generic
|
||||
-- null_ls.builtins.formatting.preittier,
|
||||
-- null_ls.builtins.formatting.trim_whitespace,
|
||||
-- null_ls.builtins.formatting.trim_newlines,
|
||||
-- Fish
|
||||
-- null_ls.builtins.formatting.fish_indent,
|
||||
-- Python
|
||||
null_ls.builtins.formatting.reorder_python_imports,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.diagnostics.mypy,
|
||||
-- Go
|
||||
null_ls.builtins.diagnostics.golangci_lint,
|
||||
-- Text
|
||||
-- null_ls.builtins.code_actions.proselint,
|
||||
-- Ansible
|
||||
-- null_ls.builtins.diagnostics.ansiblelint,
|
||||
-- Shell
|
||||
null_ls.builtins.diagnostics.shellcheck,
|
||||
-- Rust
|
||||
-- null_ls.builtins.formatting.rustfmt,
|
||||
-- Lua
|
||||
null_ls.builtins.diagnostics.luacheck,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
}
|
||||
|
||||
-- HACK: Handle old versions of null_ls for vim < 0.6 that don't support `setup`
|
||||
if null_ls["setup"] ~= nil then
|
||||
null_ls.setup({
|
||||
on_attach = default_attach,
|
||||
capabilities = merged_capabilities(),
|
||||
sources = sources,
|
||||
})
|
||||
else
|
||||
null_ls.config({
|
||||
sources = sources,
|
||||
})
|
||||
require("lspconfig")["null-ls"].setup({
|
||||
on_attach = default_attach,
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user