mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 16:39:04 +02:00
fix null-ls format onsave
This commit is contained in:
parent
3a8ccb5ffb
commit
0c12f6e382
2 changed files with 61 additions and 33 deletions
|
@ -19,6 +19,16 @@ if data_exists then
|
|||
end
|
||||
end
|
||||
|
||||
local run = 0
|
||||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
if not data_exists then
|
||||
run = 1
|
||||
end
|
||||
if frmt.disable == 0 then
|
||||
run = 1
|
||||
end
|
||||
|
||||
if run == 1 then
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = sources,
|
||||
|
@ -36,20 +46,26 @@ null_ls.setup({
|
|||
-- diagnostics.eslint_d,
|
||||
--},
|
||||
|
||||
-- on_attach = function(client, bufnr)
|
||||
-- --if client.resolved_capabilities.document_formatting then
|
||||
-- --vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format{async=true}")
|
||||
-- --end
|
||||
-- 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.formatting_sync()
|
||||
-- end,
|
||||
-- })
|
||||
on_attach = function(client, bufnr)
|
||||
--if client.resolved_capabilities.document_formatting then
|
||||
--vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format{async=true}")
|
||||
--end
|
||||
-- end,
|
||||
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.formatting_sync()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
else
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = sources,
|
||||
})
|
||||
end
|
||||
|
|
|
@ -7,6 +7,18 @@ local material_icon_ok, material_icon = pcall(require, "nvim-material-icon")
|
|||
if not material_icon_ok then
|
||||
return
|
||||
end
|
||||
material_icon.setup({
|
||||
override = {
|
||||
["mjs"] = {
|
||||
icon = "",
|
||||
color = "#efd81d",
|
||||
cterm_color = "220",
|
||||
name = "Mjs",
|
||||
},
|
||||
},
|
||||
color_icons = true,
|
||||
default = true,
|
||||
})
|
||||
|
||||
web_devicons.setup({
|
||||
override = material_icon.get_icons(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue