Versions 3 Upgrade guide for none-vscode editors. #5456
Replies: 7 comments 36 replies
-
|
Hey guys 👋🏻 I'm encountering an error in a newly created project (using I obviously added a couple of log lines: I'm sure I'm missing something simple. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
|
It doesn't seem to be working correctly in Helix for me.
Here is my configuration: My setup is based on the discussion in helix-editor/helix#10691 and https://github.com/helix-editor/helix/blob/25.01.1/languages.toml#L119. The only modification I've made is removing the hybridMode and tsdk settings. Am I missing any necessary configuration? |
Beta Was this translation helpful? Give feedback.
-
|
Hi I have a follow-up question / issue :) I'm using inlay hints (https://github.com/yamafaktory/.config/blob/2f18977151a3a2fccf90e942c083051f070514e8/nvim/init.lua#L668) and somehow facing this issue quite often: Error in decoration provider "win" (ns=nvim.lsp.inlayhint):
Error executing lua: /usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:349: Invalid 'col': out of range
stack traceback:
[C]: in function 'nvim_buf_set_extmark'
/usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:349: in function </usr/share/nvim/runtime/lua/vim/lsp/inlay_hint.lua:303>Any idea? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
typescript-language-server now supports tsserver/request: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
i tried to submit a PR to wiki/Neovim.md but i do not have permission to push to wiki repo. kindly make the following changes to Neovim.md in wiki:
> If you are on the recent `nvim-lspconfig`, you do **NOT** have to config `on_init`. See: https://github.com/neovim/nvim-lspconfig/pull/3943
-- If you are using mason.nvim, you can get the ts_plugin_path like this
-- For Mason v1,
-- local mason_registry = require('mason-registry')
-- local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server'
-- For Mason v2,
-- local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server'
-- or even
-- local vue_language_server_path = vim.fn.stdpath('data') .. "/mason/packages/vue-language-server/node_modules/@vue/language-server"
-- IMPORTANT: nvchad users cannot use `$MASON` directly as the option is set to `skip`, see: https://github.com/NvChad/NvChad/blob/29ebe31ea6a4edf351968c76a93285e6e108ea08/lua/nvchad/configs/mason.lua#L4
local vue_language_server_path = '/path/to/@vue/language-server'
-- nvim 0.11 or above
local cfg = vim.lsp.config.ts_ls
-- nvim below 0.11
-- local cfg = require("lspconfig").ts_ls.config_def.default_config
local tsserver_filetypes = (cfg and cfg.filetypes) or {}
local vue_plugin = {
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
configNamespace = 'typescript',
}
local vtsls_config = {
settings = {
vtsls = {
tsserver = {
globalPlugins = {
vue_plugin,
},
},
},
},
filetypes = tsserver_filetypes,
table.insert(tsserver_filetypes, "vue")
}
local ts_ls_config = {
init_options = {
plugins = {
vue_plugin,
},
},
filetypes = tsserver_filetypes,
table.insert(tsserver_filetypes, "vue")
}
-- If you are on most recent `nvim-lspconfig`
local vue_ls_config = {}
-- If you are not on most recent `nvim-lspconfig` or you want to override
local vue_ls_config = {
on_init = function(client)
client.handlers['tsserver/request'] = function(_, result, context)
local ts_clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'ts_ls' })
local vtsls_clients = vim.lsp.get_clients({ bufnr = context.bufnr, name = 'vtsls' })
local clients = {}
vim.list_extend(clients, ts_clients)
vim.list_extend(clients, vtsls_clients)
if #clients == 0 then
vim.notify('Could not find `vtsls` or `ts_ls` lsp client, `vue_ls` 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({
title = 'vue_request_forward', -- You can give title anything as it's used to represent a command in the UI, `:h Client:exec_cmd`
command = 'typescript.tsserverRequest',
arguments = {
command,
payload,
},
}, { bufnr = context.bufnr }, function(_, r)
local response = r and r.body
-- TODO: handle error or response nil here, e.g. logging
-- NOTE: Do NOT return if there's an error or no response, just return nil back to the vue_ls to prevent memory leak
local response_data = { { id, response } }
---@diagnostic disable-next-line: param-type-mismatch
client:notify('tsserver/response', response_data)
end)
end
end,
}
-- nvim 0.11 or above
vim.lsp.config('vtsls', vtsls_config)
vim.lsp.config('vue_ls', vue_ls_config)
vim.lsp.config('ts_ls', ts_ls_config)
vim.lsp.enable({'vtsls', 'vue_ls'}) -- If using `ts_ls` replace `vtsls` to `ts_ls`
-- nvim below 0.11
local lspconfig = require('lspconfig')
-- If using vtsls
lspconfig.vtsls.setup vtsls_config
-- If using ts_ls
lspconfig.ts_ls.setup ts_ls_config
lspconfig.vue_ls.setup vue_ls_configfiletypes property of ts_ls has been updated from value: { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact' } to: { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', This new configuration will use table.insert() function of lua to |
Beta Was this translation helpful? Give feedback.









Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TLDR: In version 3, there's one breaking change that require handled at lsp client side. For example, see how neovim config it here
What has changed and why?
For the user side, there are two things changed:
The way vue language server communicate with typescript language server.
In version 2, in order to drop the takeover mode for a more compatible solution with typescript language server, another layer of complexity was introduced (named pipes server) to help vue language server communicate with typescript language server(vue tsserver plugin). However, it seems caused many issues since v2 was released. Therefore, in the new major version, it has been removed and the responsibility of communication transferred to the lsp client side.
Option
typescript.tsdkhas dropped.Now
typescriptis a peer dependency. See detail hereHow do I migrate to version 3?
Migrating to version 3 is quite simple, create a client handler for vue language server, when receiving the request, forward it to typescript language server and finally send the payload from typescript language server back to vue language server. We have an example for neovim users here.
FAQ
What's the request and response name I should handle/send to vue language server?
The request and response names are not configurable:
tsserver/requesttsserver/responseCan I use any existing typescript language server?
No, vue LSP currently only work withvtsls.The reason is that ts_ls Currently does not handle the commandtypescript.tsserverRequestsee: https://github.com/typescript-language-server/typescript-language-server/blob/0a034dae6c777733f4c2f6d5b151c5ef781fb662/src/lsp-server.ts#L838-L940Since https://github.com/typescript-language-server/typescript-language-server/releases/tag/v4.4.0, both
vtslsandts_lsare supported.I cannot get it to work.
If you cannot get the vue language server to work, there's few things you can check yourself first:
tsserver/requestand what's the typescript language server response etc.If thing really not working on your machine please open a new issue with a Minimal Reproduction for both your vue project and editor configuration. (We do not have experience in all editors, so we might need the community's help.)
Beta Was this translation helpful? Give feedback.
All reactions