mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 00:49:03 +02:00
* Fix missing autocomplete in .vue files The existing Vue extra was not properly configuring vtsls to use the globalPlugin: '@vue/typescript-plugin' This commit fixes missing typescript autocomplete in .vue files. * move @vue/typescript-plugin back to extend function call * tidy LazyVim.extend() arguments
51 lines
1.5 KiB
Lua
51 lines
1.5 KiB
Lua
return {
|
|
recommended = function()
|
|
return LazyVim.extras.wants({
|
|
ft = "vue",
|
|
root = { "vue.config.js" },
|
|
})
|
|
end,
|
|
|
|
{
|
|
"nvim-treesitter/nvim-treesitter",
|
|
opts = function(_, opts)
|
|
if type(opts.ensure_installed) == "table" then
|
|
vim.list_extend(opts.ensure_installed, { "vue" })
|
|
end
|
|
end,
|
|
},
|
|
|
|
{
|
|
"neovim/nvim-lspconfig",
|
|
opts = function(_, opts)
|
|
local vue_typescript_plugin = require("mason-registry")
|
|
.get_package("vue-language-server")
|
|
:get_install_path() .. "/node_modules/@vue/language-server" .. "/node_modules/@vue/typescript-plugin"
|
|
|
|
opts.servers = vim.tbl_deep_extend("force", opts.servers, {
|
|
volar = {},
|
|
-- Volar 2.0 has discontinued their "take over mode" which in previous version provided support for typescript in vue files.
|
|
-- The new approach to get typescript support involves using the typescript language server along side volar.
|
|
vtsls = {
|
|
filetypes = {
|
|
"javascript",
|
|
"javascriptreact",
|
|
"javascript.jsx",
|
|
"typescript",
|
|
"typescriptreact",
|
|
"typescript.tsx",
|
|
"vue",
|
|
},
|
|
},
|
|
})
|
|
LazyVim.extend(opts.servers.vtsls.settings.vtsls.tsserver.globalPlugins, {
|
|
name = "@vue/typescript-plugin",
|
|
location = vue_typescript_plugin,
|
|
languages = { "vue" },
|
|
configNamespace = "typescript",
|
|
})
|
|
end,
|
|
|
|
|
|
},
|
|
}
|