mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-12-25 12:14:19 +01:00
fix(eslint): remove old 0.10 code
This commit is contained in:
@@ -10,7 +10,7 @@ return {
|
||||
"neovim/nvim-lspconfig",
|
||||
-- other settings removed for brevity
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
---@type table<string, vim.lsp.Config>
|
||||
servers = {
|
||||
eslint = {
|
||||
settings = {
|
||||
@@ -26,10 +26,6 @@ return {
|
||||
return
|
||||
end
|
||||
|
||||
local function get_client(buf)
|
||||
return vim.lsp.get_clients({ name = "eslint", bufnr = buf })[1]
|
||||
end
|
||||
|
||||
local formatter = LazyVim.lsp.formatter({
|
||||
name = "eslint: lsp",
|
||||
primary = false,
|
||||
@@ -37,24 +33,6 @@ return {
|
||||
filter = "eslint",
|
||||
})
|
||||
|
||||
-- Use EslintFixAll on Neovim < 0.10.0
|
||||
if not pcall(require, "vim.lsp._dynamic") then
|
||||
formatter.name = "eslint: EslintFixAll"
|
||||
formatter.sources = function(buf)
|
||||
local client = get_client(buf)
|
||||
return client and { "eslint" } or {}
|
||||
end
|
||||
formatter.format = function(buf)
|
||||
local client = get_client(buf)
|
||||
if client then
|
||||
local diag = vim.diagnostic.get(buf, { namespace = vim.lsp.diagnostic.get_namespace(client.id) })
|
||||
if #diag > 0 then
|
||||
vim.cmd("EslintFixAll")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- register the formatter with LazyVim
|
||||
LazyVim.format.register(formatter)
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user