-
-
Notifications
You must be signed in to change notification settings - Fork 410
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
Neovim Volar LSP broken for 2.0.7 #4159
Comments
I solved it with this snippet for 2.x version in my init.lua: local lspconfig = require('lspconfig')
lspconfig.volar.setup {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
init_options = {
vue = {
hybridMode = false,
},
},
} I was not aware of upgrade to 2.x and my problem is fixed by following docs for nvim integration. |
2.0 was recommanded to use with Or the full discuss: #3925 |
If you could share your nvim config, it would be better to solve your problem. |
return {
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Set colorscheme to use
colorscheme = "astrodark",
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- customize lsp formatting options
formatting = {
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
ignore_filetypes = { -- disable format on save for specified filetypes
-- "python",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
-- "sumneko_lua",
},
timeout_ms = 1000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
},
},
},
presence = {
-- General options
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
neovim_image_text = "The One True Code Editor", -- Text displayed when hovered over the Neovim image
main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 10, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
},
-- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here
polish = function()
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
vim.o.scrolloff = 8 -- You can adjust the number to your preference
vim.o.colorcolumn = "80" -- You can adjust the number to your preference
vim.filetype.add {
extension = {
tera = "tera",
},
}
vim.filetype.add {
extension = {
html = "html",
}
}
local lspconfig = require('lspconfig')
lspconfig.volar.setup {
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
init_options = {
vue = {
hybridMode = false,
},
},
}
local dap = require('dap')
dap.adapters.rust = {
type = 'executable',
command = 'lldb-vscode',
name = "lldb"
}
dap.configurations.rust = {
{
type = 'rust',
request = 'launch',
name = "Launch Rust",
program = function()
-- This function allows you to specify the binary to debug.
-- You can hardcode it or use vim.fn.input to prompt for it.
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/target/debug/', 'file')
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
runtimeArgs = { "run" },
env = {},
},
}
require("dapui").setup()
require("tree-sitter-surrealdb").setup()
end,
} This is AstroNvim init.lua file. I had issue that none of my new or old projects respond to lsp. But after adding this snippet it started to work again with no issues. Is this the solution? |
I haven't seen any settings related to tsserver, have you installed it? |
@ASoldo you actually solved my problem with this snippet! As mentioned by @johnsoncodehk, this is indeed in the new documentation https://github.com/vuejs/language-tools#community-integration Edit: Actually, this gave me some LSP capabilities but not all. I found another suggested config in -- init.lua
local lspconfig = require("lspconfig")
lspconfig.volar.setup({})
lspconfig.tsserver.setup({
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "C:\\Users\\wcheek\\AppData\\Roaming\\npm\\node_modules\\@vue\\typescript-plugin\\",
languages = { "javascript", "typescript", "vue" },
},
},
},
filetypes = {
"javascript",
"typescript",
"vue",
},
}) |
@wcheek hi, just wanted to share with you config for AstroNvim that works. I have AstroNvim v4, and with that i have new ...
-- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
volar = {
filetypes = { "vue" },
init_options = {
vue = {
hybridMode = false,
},
},
},
},
... |
this config doesn't work no more, does anybody know why when i set hybridMode to false i get this. and if I set hybid mode to true it can attach but it is not doing any operations like hover symbol, jump to definitions, rename symbol... -- customize language server configuration options passed to `lspconfig`
---@diagnostic disable: missing-fields
config = {
tsserver = {
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "/usr/lib/node_modules/@vue/typescript-plugin/",
languages = { "vue" },
},
},
},
},
volar = {
filetypes = { "vue" },
init_options = {
vue = {
hybridMode = false,
},
},
},
}, anybody know how to fix this? |
@wcheek does your setup still work? |
Not sure if this is the cause, but I found some issues:
volar = {
filetypes = { "vue" },
init_options = {
+ typescript = {
+ tsdk = "path/to/node_modules/typescript/lib",
+ },
vue = {
hybridMode = false,
},
},
}, |
config = {
tsserver = {
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "/usr/lib/node_modules/@vue/language-server/",
languages = { "vue" },
},
},
},
},
volar = {
filetypes = { "vue" },
init_options = {
typescript = {
tsdk = "/usr/lib/node_modules/typescript/lib/",
},
vue = {
hybridMode = false,
},
},
},
}, This is config I have so far and this is the error i get when I set hybridMode to false:
|
@ASoldo What is your |
its the latest. |
@ASoldo Can you try updating to v2.0.26-alpha.2? |
How do i do that since it's not in the npm registry yet? |
Please try execute |
It still throws error when loading vue file. |
@ASoldo I'm using {
"neovim/nvim-lspconfig",
opts = {
servers = {
volar = {
init_options = {
vue = {
hybridMode = false,
},
},
},
vtsls = {},
},
},
} |
Once again thank you all for helping me, this is the latest config i have now:
but I uninstalled the vue-language-server with Mason and it works now. So take away from this is not to install it with Mason? |
with btw seems lazyvim's vue config has a performance issue as it set hybrid mode to false but still run a vtsls for vue separately. This will result in 2 typescript lsp running at the same time. I will create an issue or PR later. ( you can also do if you want to :) ) |
This is what i have and also removed vue-language-server(volar) from Mason. |
ops my bad |
maybe try to remove tsdk as |
I am also getting this error. Using LazyVim with volar 2.0.24 in hybrid mode and vtsls disabled.
Output of
My lsp config:
|
Also tried with |
Can confirm that |
I'm using LazyVim and Vue Extra. I installed it via Mason, and it worked for me.
|
I've done the same and it works just by having this:
So is it a bug with 2.0.24? |
In my case, the error occurred when I upgraded the project's Typescript version from 4 to 5. |
I'd really appreciate if you did - I've noticed the duplicate diagnostics in |
I have created a PR in lazyvim: LazyVim/LazyVim#3908 |
Since update |
…ame time (#3908) ## What is this PR for? At the moment, the config for vue set hybrid mode to `false` which volar will run a typescript server under the hook. ( hybrid mode false is the takeover mode in v1, was introduced in `2.0.7` see more information here: vuejs/language-tools#4119 ). However, another vtsls with vue language plugin also attached to vue files, this will cause two typescript server running at the same time. It can be very easily observed with tools like `htop` volar and vtsls will have similar memory usage which is abnormal because volar should be very light by itself. This will introduce issues like duplicate diagnostics, see vuejs/language-tools#4159 (comment) In this pull request, I set the hybrid mode to true as default because the hybrid mode is the "correct" way moving forward, thus it would be more stable. Let me know if you feel it should stay as `false` to be default. ## Does this PR fix an existing issue? No existing issue. ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
Hi, I just noticed that when I open any of my projects new or old I don't have any TS/JS/Vue completions even tho it shows as running. But I am not able to hover, jump to definitions, etc... anybody know why and how to fix it?
Thank you!
The text was updated successfully, but these errors were encountered: