From 89db031726a5d268b9176b28fba79be40195cdce Mon Sep 17 00:00:00 2001 From: Kemboi Elvis Date: Wed, 2 Jul 2025 10:55:03 +0300 Subject: [PATCH] feat: updated v3 --- .../plugins/extras/lang/typescript.lua | 10 +-- lua/lazyvim/plugins/extras/lang/vue.lua | 78 ++++++++++++------- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/typescript.lua b/lua/lazyvim/plugins/extras/lang/typescript.lua index 2c95a22c..04e6f809 100644 --- a/lua/lazyvim/plugins/extras/lang/typescript.lua +++ b/lua/lazyvim/plugins/extras/lang/typescript.lua @@ -62,11 +62,11 @@ return { includePackageJsonAutoImports = "auto", }, inlayHints = { - enumMemberValues = { enabled = true }, - functionLikeReturnTypes = { enabled = true }, - parameterNames = { enabled = "literals" }, - parameterTypes = { enabled = true }, - propertyDeclarationTypes = { enabled = true }, + enumMemberValues = { enabled = false }, -- Disabled for Vue + functionLikeReturnTypes = { enabled = false }, -- Disabled for Vue + parameterNames = { enabled = "off" }, -- Disabled for Vue + parameterTypes = { enabled = false }, -- Disabled for Vue + propertyDeclarationTypes = { enabled = false }, -- Disabled for Vue variableTypes = { enabled = false }, }, }, diff --git a/lua/lazyvim/plugins/extras/lang/vue.lua b/lua/lazyvim/plugins/extras/lang/vue.lua index 3a677105..506c89d6 100644 --- a/lua/lazyvim/plugins/extras/lang/vue.lua +++ b/lua/lazyvim/plugins/extras/lang/vue.lua @@ -19,14 +19,22 @@ return { "neovim/nvim-lspconfig", opts = { servers = { - volar = { - filetypes = { "typescript", "javascript", "javascriptreact", "typescriptreact", "vue" }, + -- Remove the old volar configuration entirely + volar = false, -- This disables the old volar setup + + -- Updated VTSLS configuration for vue-language-tools + vtsls = { init_options = { - vue = { - hybridMode = true, + plugins = { + { + name = "@vue/typescript-plugin", + location = vim.fn.expand("$MASON/packages/vue-language-server/node_modules/@vue/language-server"), + languages = { "vue" }, + configNamespace = "typescript", + }, }, typescript = { - tsdk = vim.fn.getcwd() .. "/node_modules/typescript/lib", + -- Keep your existing TypeScript settings if needed inlayHints = { enumMemberValues = { enabled = false }, functionLikeReturnTypes = { enabled = false }, @@ -37,6 +45,43 @@ return { }, }, }, + filetypes = { + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + }, + }, + + -- New vue_ls configuration + vue_ls = { + on_init = function(client) + client.handlers["tsserver/request"] = function(_, result, context) + local clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = "vtsls" }) + if #clients == 0 then + vim.notify( + "Could not found `vtsls` lsp client, vue_lsp would not work without it.", + vim.log.levels.ERROR + ) + return + end + local ts_client = clients[1] + local param = unpack(result) + local id, command, payload = unpack(param) + ts_client:exec_cmd({ + command = "typescript.tsserverRequest", + arguments = { + command, + payload, + }, + }, { bufnr = context.bufnr }, function(_, r) + local response_data = { { id, r.body } } + ---@diagnostic disable-next-line: param-type-mismatch + client:notify("tsserver/response", response_data) + end) + end + end, settings = { vue = { updateImportsOnFileMove = { enabled = "always" }, @@ -46,32 +91,9 @@ return { }, }, }, - 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",