add linter and formatter with it's caveats
parent
d5234fec4c
commit
dc82115506
@ -0,0 +1,41 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
-- other settings removed for brevity
|
||||||
|
opts = {
|
||||||
|
---@type lspconfig.options
|
||||||
|
servers = {
|
||||||
|
eslint = {
|
||||||
|
settings = {
|
||||||
|
-- helps eslint find the eslintrc when it's placed in a subfolder instead of the cwd root
|
||||||
|
workingDirectory = { mode = "auto" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
setup = {
|
||||||
|
eslint = function()
|
||||||
|
require("lazyvim.util").on_attach(function(client)
|
||||||
|
if client.name == "eslint" then
|
||||||
|
client.server_capabilities.documentFormattingProvider = true
|
||||||
|
elseif client.name == "tsserver" then
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
-- eslint = function()
|
||||||
|
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
-- callback = function(event)
|
||||||
|
-- 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) })
|
||||||
|
-- if #diag > 0 then
|
||||||
|
-- vim.cmd("EslintFixAll")
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
-- end,
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
table.insert(opts.ensure_installed, "svelte-language-server")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
opts = {
|
||||||
|
servers = {
|
||||||
|
svelte = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"evanleck/vim-svelte",
|
||||||
|
}
|
Loading…
Reference in New Issue