add linter and formatter with it's caveats

pull/579/head
Yevhenii Moruhyi 2 years ago
parent d5234fec4c
commit dc82115506

@ -13,7 +13,9 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.lang.typescript" },
{ import = "lazyvim.plugins.extras.lang.json" },
{ import = "lazyvim.plugins.extras.util.project" },
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
{ import = "lazyvim.plugins.extras.lang.tailwind" },
-- { import = "lazyvim.plugins.extras.formatting.prettier" },
-- { import = "lazyvim.plugins.extras.linting.eslint" },
-- import/override with your plugins
{ import = "plugins" },
},

@ -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…
Cancel
Save