diff --git a/lua/lazyvim/config/options.lua b/lua/lazyvim/config/options.lua index 5c66966a..13ed0e96 100644 --- a/lua/lazyvim/config/options.lua +++ b/lua/lazyvim/config/options.lua @@ -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 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 opt.autowrite = true -- Enable auto write diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index cd2fe4f1..69223014 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -1,3 +1,5 @@ +local enableHybridMode = vim.g.vue_hybrid_mode + return { recommended = function() return LazyVim.extras.wants({ @@ -22,7 +24,7 @@ return { volar = { init_options = { vue = { - hybridMode = false, + hybridMode = enableHybridMode, }, }, }, @@ -35,16 +37,18 @@ return { { "neovim/nvim-lspconfig", opts = function(_, opts) - 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"), - languages = { "vue" }, - configNamespace = "typescript", - enableForWorkspaceTypeScriptVersions = true, - }, - }) + if enableHybridMode then + 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"), + languages = { "vue" }, + configNamespace = "typescript", + enableForWorkspaceTypeScriptVersions = true, + }, + }) + end end, }, }