Files

84 lines
1.6 KiB
Lua
Raw Permalink Normal View History

2026-08-26 12:59:09 +08:00
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "eslint", "stylua", "vue_ls", "ts_ls" },
})
local function on_attach(_, bufnr)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = bufnr, desc = "Go to definition" })
end
vim.lsp.config("eslint", {
settings = {
workingDirectories = { mode = "auto" },
format = true, -- Disable if using null-ls or Prettier
},
on_attach = function(client, bufnr)
on_attach(client, bufnr)
vim.api.nvim_create_autocmd("BufWritePre", {
buffer = bufnr,
callback = function(args)
require("conform").format({ bufnr = args.buf })
end,
})
end,
})
vim.lsp.config("lua_ls", {
settings = {
Lua = {
runtime = { verstion = "LuaJIT" },
workspace = {
checkThirdParty = false,
library = vim.api.nvim_get_runtime_file("", true),
},
diagnostics = {
globals = { "vim" },
},
},
},
})
vim.lsp.config("intelephense", {
settings = {
intelephense = {
files = {
maxSize = 2000000,
},
},
},
on_attach = on_attach(),
})
vim.lsp.config("vue_ls", {})
vim.lsp.config("ts_ls", {
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = vim.fn.expand(
"$HOME/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server"
),
languages = { "vue" },
},
},
},
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
on_attach = on_attach(),
})
vim.diagnostic.config({
virtual_text = true,
underlin = true,
})
vim.lsp.enable({
"eslint",
"lua_ls",
"tailwindcss",
"intelephense",
"laravel_ls",
"vue_ls",
"ts_ls",
})