New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
volar language service errors #20010
Comments
This comment was marked as duplicate.
This comment was marked as duplicate.
|
Following this didn't resolve the issue Volar configlocal util = require 'lspconfig.util'
local path = util.path
local volar_path = path.join(vim.fn.stdpath 'data', 'lsp_servers', 'volar', 'node_modules')
local global_ts_server_path = path.join(volar_path, 'typescript', 'lib')
local function get_typescript_lib_path(root_dir)
local project_root = util.find_node_modules_ancestor(root_dir)
return project_root and (path.join(project_root, 'node_modules', 'typescript', 'lib'))
or global_ts_server_path
end
lspconfig.volar.setup({
init_options = {
typescript = {
tsdk = '',
},
},
on_new_config = function(new_config, new_root_dir)
new_config.init_options.typescript.tsdk = get_typescript_lib_path(new_root_dir)
end,
capabilities = cmp_capabilities,
on_attach = on_attach,
flags = { debounce_text_changes = 150 },
settings = {
volar = { autoCompleteRefs = true },
},
})
Still getting error
|
Update to latest lsp-config and updated volar. Now seems to be working. |
Still have the same error, after updating to newest nvim-lspconfig, witth @volar/vue-language-server@1.0.3 Anything I am missing, or do other people also experience this issue? EDIT: |
I had the same issue and @dithmer post fixed it. Point to the global install of Typescript, in my case the option looked like this init_options = {
typescript = {
tsdk = "/usr/local/lib/node_modules/typescript/lib"
}
} |
I'm using mason along side mason-lspconfig and I installed But I was getting this error: Error executing vim.schedule lua callback: ...w/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/lsp.lua:1308: RPC[Error] code_name = InternalError, message = "Request initialize failed with message: Can't find typescript.js or tsserverlibrary.js in /Users/alex/Workspace/trello_team/node_modules/typescript/lib"
stack traceback:
[C]: in function 'assert'
...w/Cellar/neovim/0.9.5/share/nvim/runtime/lua/vim/1sp.lua:1308: in function ''
vim/_editor.lua: in function <vim/_editor.lua: 0>
Press ENTER or type command to continue Then, I just used the lspconfig['volar'].setup({
init_options = {
typescript = {
tsdk = '/Users/alex/.local/share/nvim/mason/packages/typescript-language-server/node_modules/typescript/lib'
}
}
}) And it worked fine! |
Had a similar problem with the following error:
In my case I was using nvm to install nodejs and typescript, so I had to add the path to my default node version: lspconfig.volar.setup({
capabilities = capabilities,
init_options = {
typescript = {
tsdk = '/home/enrique/.nvm/versions/node/v18.17.0/lib/node_modules/typescript/lib'
}
}
}) In my case |
Neovim version (nvim -v)
NVIM v0.8.0-dev-984-g568737d5b
Language server name/version
volar 0.40.4
Operating system/version
mac os 12.2.1
Steps to reproduce using "nvim -u minimal_init.lua"
Open with
nvim -u minimal_init.lua tab.vue
.tab.vue, click to view
Expected behavior
No errors
Actual behavior
Log file
https://gist.github.com/Lilja/d7bc8c812cf20c5020c7ae4b20d71334
The text was updated successfully, but these errors were encountered: