AstroNvim / astrocommunity

A community repository of common plugin specifications
GNU General Public License v3.0
1.04k stars 212 forks source link

Vue Volar LSP is broken #1069

Closed Jacob-32587 closed 1 week ago

Jacob-32587 commented 1 week ago

Checklist

Neovim version (nvim -v)

NVIM v0.9.6-dev-18+g0ef27180

Operating system/version

Pop!_OS 22.04 LTS

Terminal/GUI

gnome

Describe the bug

Hello I am new to neovim/astrovim and was having issues with an initial setup of Vue. After I add the below line to my community.lua Vue Volar does not work. The error message in the pop up on the top right hand side says Client _ quit with exit code 1 and signal 0

  { import = "astrocommunity.pack.vue" }

After running lua vim.cmd('e'..vim.lsp.get_log_path()) in neovim the following output can be observed.

[ERROR][2024-06-23 16:21:18] .../vim/lsp/rpc.lua:734    "rpc"   "/home/USER_NAME/.local/share/nvim/mason/bin/vue-language-server"   "stderr"    "/home/USER_NAME/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/language-core/index.js:230
            throw new Error(`VirtualCode id must be lowercase: ${code.id}`);
                  ^

Error: VirtualCode id must be lowercase: scriptSetupFormat
    at verifyVirtualCode (/home/USER_NAME/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/language-core/index.js:230:19)
    at Object.set (/home/USER_NAME/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/language-core/index.js:127:29)
...

Node.js v21.7.1

I believe the bug is related to a recent commit in vue-volar here: https://github.com/volarjs/volar.js/commit/1f6e2bf4a0bad217607e196f378d9a1198293c3b since the error message lines up with the commit message. I'm not technically inclined in regards to LSP's so I may be wrong, I have only recently started to migrate from VSCodium.

Steps to Reproduce

Add

  { import = "astrocommunity.pack.vue" }

to a fresh astrovim install and try to open a Vue project.

Expected behavior

The LSP works and no errors are thrown

Screenshots

image

Additional Context

No response

Minimal configuration

-- save as repro.lua
-- run with nvim -u repro.lua
-- DO NOT change the paths
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "runtime", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  -- stylua: ignore
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
end
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)

-- install plugins
local plugins = {
  { "AstroNvim/AstroNvim", import = "astronvim.plugins" },
  { "AstroNvim/astrocommunity" },
  { import = "astrocommunity.pack.vue" }

  -- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- add anything else here (autocommands, vim.filetype, etc.)
Uzaaft commented 1 week ago

Volar works fine for me in a plain vue app created with:

pnpm create vue@latest
Uzaaft commented 1 week ago

volar version: 2.0.22

Uzaaft commented 1 week ago

Also: Your neovim version is a dev version. Try a stable version. Seems to me that it's an user error.

gabrielscaranello commented 1 week ago

In versions of Neovim prior to 0.10.0, some LSPs are broken, including Vue's.

Here it is working perfectly.

Neovim version: v0.10.0 OS: Ubuntu 22.04 LTS / Fedora 40

Uzaaft commented 1 week ago

Cant reproduce with neovim 0.9.5 either.

Jacob-32587 commented 1 week ago

After updating my nvim version to 0.10.0 things seem to be working correctly now. I can use gd to go to a components associated file. I can also see typescript function docs, etc...

image

I shouldn't have been using a nightly build, sorry for the inconvenience and thank you!