From 6131006a3e3f147fa87644158b824653b5b60c52 Mon Sep 17 00:00:00 2001 From: Miroito Date: Thu, 23 Apr 2026 20:32:30 +0200 Subject: [PATCH] complete vue support --- lua/lsp/init.lua | 48 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) diff --git a/lua/lsp/init.lua b/lua/lsp/init.lua index 2eee379..d79f995 100644 --- a/lua/lsp/init.lua +++ b/lua/lsp/init.lua @@ -62,12 +62,6 @@ vim.lsp.config['lua_ls'] = { vim.lsp.enable('lua_ls') -vim.lsp.config['ts_ls'] = { - -- capabilities = capabilities, - on_attach = on_attach, -} -vim.lsp.enable('ts_ls') - vim.lsp.config['pyright'] = { -- capabilities = capabilities, on_attach = on_attach, @@ -86,9 +80,45 @@ vim.lsp.config['clangd'] = { } vim.lsp.enable('clangd') -vim.lsp.config['volar'] = { - filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' }, +local tsserver_filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' } +local global_node_modules = vim.fn.system("npm root -g"):gsub("%s+", "") +local vue_language_server_path = global_node_modules .. '/@vue/language-server' + +local vue_plugin = { + name = '@vue/typescript-plugin', + location = vue_language_server_path, + languages = { 'vue' }, + configNamespace = 'typescript', +} + +vim.lsp.config['ts_ls'] = { + init_options = { + plugins = { + vue_plugin, + }, + }, + filetypes = tsserver_filetypes, + on_attach = on_attach, +} + +vim.lsp.config['vtsls'] = { + on_attach = on_attach, + settings = { + vtsls = { + tsserver = { + globalPlugins = { + vue_plugin, + }, + }, + }, + }, + filetypes = tsserver_filetypes, +} + + +vim.lsp.config['vue_ls'] = { + filetypes = tsserver_filetypes, -- capabilities = capabilities, on_attach = on_attach, } -vim.lsp.enable('volar') +vim.lsp.enable({ 'vtsls', 'vue_ls' }) -- 2.36.3