From 20ec1cca6ff7057d444daac8aeec69052a12435b Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 2 Oct 2025 11:31:23 +0500 Subject: [PATCH] Use vue-lang-extra instead of hack --- lazyvim.json | 1 + lua/plugins/vue.lua | 72 --------------------------------------------- 2 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 lua/plugins/vue.lua diff --git a/lazyvim.json b/lazyvim.json index 8ea98f0..20691d3 100644 --- a/lazyvim.json +++ b/lazyvim.json @@ -12,6 +12,7 @@ "lazyvim.plugins.extras.lang.sql", "lazyvim.plugins.extras.lang.tailwind", "lazyvim.plugins.extras.lang.typescript", + "lazyvim.plugins.extras.lang.vue", "lazyvim.plugins.extras.lang.yaml", "lazyvim.plugins.extras.ui.treesitter-context" ], diff --git a/lua/plugins/vue.lua b/lua/plugins/vue.lua deleted file mode 100644 index 78f4c26..0000000 --- a/lua/plugins/vue.lua +++ /dev/null @@ -1,72 +0,0 @@ -return { - recommended = function() - return LazyVim.extras.wants({ - ft = "vue", - root = { "vue.config.js", "nuxt.config.ts" }, - }) - end, - - -- depends on the typescript extra - { import = "lazyvim.plugins.extras.lang.typescript" }, - - { - "nvim-treesitter/nvim-treesitter", - opts = { ensure_installed = { "vue", "css" } }, - }, - - -- Configure vtsls (the TypeScript plugin host) with @vue/typescript-plugin - { - "neovim/nvim-lspconfig", - opts = function(_, opts) - opts.servers.vtsls = opts.servers.vtsls or {} - opts.servers.vtsls.filetypes = opts.servers.vtsls.filetypes or {} - 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, - }, - - -- Hook vue_ls to forward requests to vtsls - { - "neovim/nvim-lspconfig", - opts = { - servers = { - volar = { -- when LazyVim switches to nvim-lspconfig ≥ v2.2.0 rename this to `vue_ls` - on_init = function(client) - client.handlers["tsserver/request"] = function(_, result, context) - -- find the vtsls client - local clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = "vtsls" }) - if #clients == 0 then - vim.notify( - "Could not find `vtsls` client, Vue LSP features will be disabled", - vim.log.levels.ERROR - ) - return - end - local ts_client = clients[1] - -- unpack the forwarded request - local params = unpack(result) - local id, command, payload = unpack(params) - -- forward it - ts_client:exec_cmd({ - title = "vue_request_forward", - command = "typescript.tsserverRequest", - arguments = { command, payload }, - }, { bufnr = context.bufnr }, function(_, resp) - -- send the tsserver/response back to Vue LSP - client.notify("tsserver/response", { { id, resp.body } }) - end) - end - end, - }, - }, - }, - }, -}