mirror of
https://github.com/DefectingCat/dotfiles
synced 2025-07-16 01:01:36 +00:00
fix none-ls deprecate packages
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local null_ls = require "null-ls"
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
local code_actions = null_ls.builtins.code_actions
|
||||
|
||||
local eslint_condition = function(utils)
|
||||
return utils.root_has_file {
|
||||
return utils.root_has_file({
|
||||
".eslintcache",
|
||||
".eslintrc",
|
||||
".eslintrc.js",
|
||||
@ -14,7 +14,7 @@ local eslint_condition = function(utils)
|
||||
".eslintrc.yaml",
|
||||
".eslintrc.yml",
|
||||
".eslintrc.json",
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local opts = {
|
||||
@ -23,52 +23,40 @@ local opts = {
|
||||
formatting.gofmt,
|
||||
formatting.goimports_reviser,
|
||||
formatting.golines,
|
||||
formatting.taplo,
|
||||
-- JavaScript
|
||||
formatting.prettierd.with {
|
||||
formatting.prettierd.with({
|
||||
prefer_local = "node_modules/.bin",
|
||||
},
|
||||
diagnostics.eslint_d.with {
|
||||
prefer_local = "node_modules/.bin",
|
||||
condition = eslint_condition,
|
||||
},
|
||||
code_actions.eslint_d.with {
|
||||
prefer_local = "node_modules/.bin",
|
||||
condition = eslint_condition,
|
||||
},
|
||||
}),
|
||||
-- Lua
|
||||
formatting.stylua,
|
||||
-- XML and SVG
|
||||
formatting.xmlformat.with {
|
||||
--[[ formatting.xmlformat.with({
|
||||
filetypes = {
|
||||
"xml",
|
||||
"svg",
|
||||
},
|
||||
},
|
||||
}), ]]
|
||||
-- Bash
|
||||
diagnostics.shellcheck,
|
||||
code_actions.shellcheck,
|
||||
formatting.shellharden,
|
||||
formatting.shfmt,
|
||||
-- sql
|
||||
diagnostics.sqlfluff.with {
|
||||
diagnostics.sqlfluff.with({
|
||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||
},
|
||||
formatting.sqlfluff.with {
|
||||
}),
|
||||
formatting.sqlfluff.with({
|
||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||
},
|
||||
}),
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method "textDocument/formatting" then
|
||||
vim.api.nvim_clear_autocmds {
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
}
|
||||
})
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { bufnr = bufnr }
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
@ -37,12 +37,8 @@ local plugins = {
|
||||
require("mason-null-ls").setup({
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"taplo", -- toml formatter
|
||||
"prettierd",
|
||||
"xmlformatter", -- xml svg formatter
|
||||
"eslint_d",
|
||||
"ymlfmt",
|
||||
"shellcheck",
|
||||
"shellharden",
|
||||
"shfmt",
|
||||
"goimports",
|
||||
@ -73,6 +69,7 @@ local plugins = {
|
||||
"dockerls",
|
||||
"bashls",
|
||||
"clangd",
|
||||
"lemminx",
|
||||
},
|
||||
automatic_installation = true,
|
||||
},
|
||||
|
Reference in New Issue
Block a user