mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
fix(format): eslint should respect autoformat (#897)
This commit is contained in:
parent
0731f08ee4
commit
2ec4da7fa5
2 changed files with 9 additions and 0 deletions
|
@ -16,6 +16,11 @@ return {
|
|||
eslint = function()
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function(event)
|
||||
if not require("lazyvim.plugins.lsp.format").enabled() then
|
||||
-- exit early if autoformat is not enabled
|
||||
return
|
||||
end
|
||||
|
||||
local client = vim.lsp.get_active_clients({ bufnr = event.buf, name = "eslint" })[1]
|
||||
if client then
|
||||
local diag = vim.diagnostic.get(event.buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue