Upgradet ts setup and vue support

This commit is contained in:
2025-07-16 15:44:45 +02:00
parent 029310a027
commit d5b9b5ac6a
3 changed files with 63 additions and 45 deletions

View File

@@ -6,8 +6,9 @@
--local node_version = vim.fn.system('nvm current'):gsub('\n[^\n]*$', '') -- remove line endings
--local vue_typescript_plugin_path = vim.fs.normalize(nvm_bin .. '\\' .. node_version .. '\\node_modules\\@vue\\typescript-plugin')
local vue_typescript_plugin_path = vim.fs.normalize '~/node_modules/@vue/typescript-plugin'
local vue_language_server_path = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server'
print(vue_typescript_plugin_path)
print(vue_language_server_path)
-- "<leader>sh" to [s]earch the [h]elp documentation.
@@ -541,29 +542,48 @@ require('lazy').setup({
}
local servers = {
ts_ls = {
init_options = {
hostInfo = 'neovim',
plugins = {
{
name = '@vue/typescript-plugin',
--location = '', -- use local node_modules path
location = vue_typescript_plugin_path,
languages = { 'vue', 'javascript', 'typescript' },
--ts_ls = {
-- init_options = {
-- hostInfo = 'neovim',
-- plugins = {
-- {
-- name = '@vue/typescript-plugin',
-- --location = '', -- use local node_modules path
-- location = vue_typescript_plugin_path,
-- languages = { 'vue', 'javascript', 'typescript' },
-- },
-- },
-- },
-- filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx', 'vue' },
--},
-- Volar is deprecated in favor of vue_ls
--volar = {
-- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
-- init_options = {
-- vue = {
-- -- disable hybrid mode
-- hybridMode = true,
-- },
-- },
--}, -- hybrid mode is default
vue_ls = {},
vtsls = {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
settings = {
vtsls = {
tsserver = {
globalPlugins = {
{
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
configNamespace = 'typescript',
},
},
},
},
},
filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx', 'vue' },
},
volar = {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
init_options = {
vue = {
-- disable hybrid mode
hybridMode = true,
},
},
}, -- hybrid mode is default
eslint = {
flags = { debounce_text_changes = 500 },
-- on_attach = function(client, bufnr)