[nvim] only autoformat on save with null-ls
This commit is contained in:
parent
6199a62f27
commit
a748e12748
|
@ -58,7 +58,7 @@ return {
|
|||
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set("n", "<space>f", vim.lsp.buf.formatting, bufopts)
|
||||
vim.keymap.set("n", "<space>f", vim.lsp.buf.format, bufopts)
|
||||
end
|
||||
|
||||
local function organize_imports()
|
||||
|
|
|
@ -32,10 +32,13 @@ return {
|
|||
|
||||
if res then
|
||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||
vim.lsp.util.apply_text_edits(res, bufnr, client and client.offset_encoding or "utf-16")
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
vim.cmd("silent noautocmd update")
|
||||
end)
|
||||
|
||||
if client.name == "null-ls" then
|
||||
vim.lsp.util.apply_text_edits(res, bufnr, client and client.offset_encoding or "utf-16")
|
||||
vim.api.nvim_buf_call(bufnr, function()
|
||||
vim.cmd("silent noautocmd update")
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
@ -146,7 +149,7 @@ return {
|
|||
"less",
|
||||
"html",
|
||||
"yaml",
|
||||
"jsonc",
|
||||
"json",
|
||||
"graphql",
|
||||
},
|
||||
}),
|
||||
|
@ -215,12 +218,6 @@ return {
|
|||
end,
|
||||
}),
|
||||
|
||||
null_ls.builtins.diagnostics.jsonlint.with({
|
||||
condition = function()
|
||||
return utils.is_executable("jsonlint")
|
||||
end,
|
||||
}),
|
||||
|
||||
null_ls.builtins.diagnostics.luacheck.with({
|
||||
condition = function()
|
||||
return utils.is_executable("luacheck")
|
||||
|
@ -301,12 +298,6 @@ return {
|
|||
end,
|
||||
}),
|
||||
|
||||
null_ls.builtins.formatting.fixjson.with({
|
||||
condition = function()
|
||||
return utils.is_executable("fixjson")
|
||||
end,
|
||||
}),
|
||||
|
||||
null_ls.builtins.formatting.gofmt.with({
|
||||
condition = function()
|
||||
return utils.is_executable("gofmt")
|
||||
|
|
Loading…
Reference in New Issue