mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
85 lines
2.4 KiB
Lua
85 lines
2.4 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
ft = "vue",
|
|
root = { "vue.config.js", "vite.config.js", "vite.config.ts", "nuxt.config.ts" },
|
|
})
|
|
end,
|
|
|
|
-- depends on the typescript extra
|
|
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
|
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = { ensure_installed = { "vue", "css", "typescript", "javascript" } },
|
|
},
|
|
|
|
-- Add LSP servers
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = {
|
|
servers = {
|
|
volar = {
|
|
filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" },
|
|
init_options = {
|
|
vue = {
|
|
hybridMode = true,
|
|
},
|
|
typescript = {
|
|
tsdk = vim.fn.getcwd() .. "/node_modules/typescript/lib",
|
|
},
|
|
},
|
|
settings = {
|
|
vue = {
|
|
updateImportsOnFileMove = { enabled = "always" },
|
|
suggest = {
|
|
completeFunctionCalls = true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
vtsls = {
|
|
init_options = {
|
|
plugins = {
|
|
{
|
|
name = "@vue/typescript-plugin",
|
|
location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
|
|
languages = { "vue" },
|
|
configNamespace = "typescript",
|
|
enableForWorkspaceTypeScriptVersions = true,
|
|
},
|
|
},
|
|
},
|
|
filetypes = {
|
|
"javascript",
|
|
"javascriptreact",
|
|
"javascript.jsx",
|
|
"typescript",
|
|
"typescriptreact",
|
|
"typescript.tsx",
|
|
"vue",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
-- Configure tsserver plugin
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = function(_, opts)
|
|
if not vim.tbl_contains(opts.servers.vtsls.filetypes or {}, "vue") then
|
|
table.insert(opts.servers.vtsls.filetypes, "vue")
|
|
end
|
|
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
|
|
{
|
|
name = "@vue/typescript-plugin",
|
|
location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
|
|
languages = { "vue" },
|
|
configNamespace = "typescript",
|
|
enableForWorkspaceTypeScriptVersions = true,
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
}
|