mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
perf(vue): fix duplicated typescript server for vue files
This commit is contained in:
parent
d5f3d395f4
commit
5538839c31
2 changed files with 20 additions and 11 deletions
|
|
@ -49,6 +49,11 @@ vim.g.bigfile_size = 1024 * 1024 * 1.5 -- 1.5 MB
|
||||||
-- Show the current document symbols location from Trouble in lualine
|
-- Show the current document symbols location from Trouble in lualine
|
||||||
vim.g.trouble_lualine = true
|
vim.g.trouble_lualine = true
|
||||||
|
|
||||||
|
-- Enable hybrid mode for Vue files
|
||||||
|
-- If the hybrid mode is enabled, a sperate vtsls will run for Vue files
|
||||||
|
-- If the hybrid mode is disabled, volar will run a tsserver under the hood
|
||||||
|
vim.g.vue_hybrid_mode = true
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
|
|
||||||
opt.autowrite = true -- Enable auto write
|
opt.autowrite = true -- Enable auto write
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
local enableHybridMode = vim.g.vue_hybrid_mode
|
||||||
|
|
||||||
return {
|
return {
|
||||||
recommended = function()
|
recommended = function()
|
||||||
return LazyVim.extras.wants({
|
return LazyVim.extras.wants({
|
||||||
|
|
@ -22,7 +24,7 @@ return {
|
||||||
volar = {
|
volar = {
|
||||||
init_options = {
|
init_options = {
|
||||||
vue = {
|
vue = {
|
||||||
hybridMode = false,
|
hybridMode = enableHybridMode,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -35,16 +37,18 @@ return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
table.insert(opts.servers.vtsls.filetypes, "vue")
|
if enableHybridMode then
|
||||||
LazyVim.extend(opts.servers.vtsls, "settings.vtsls.tsserver.globalPlugins", {
|
table.insert(opts.servers.vtsls.filetypes, "vue")
|
||||||
{
|
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"),
|
name = "@vue/typescript-plugin",
|
||||||
languages = { "vue" },
|
location = LazyVim.get_pkg_path("vue-language-server", "/node_modules/@vue/language-server"),
|
||||||
configNamespace = "typescript",
|
languages = { "vue" },
|
||||||
enableForWorkspaceTypeScriptVersions = true,
|
configNamespace = "typescript",
|
||||||
},
|
enableForWorkspaceTypeScriptVersions = true,
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue