neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.65k stars 2.08k forks source link

bug(mason/svelte-language-server): root dir not found on folder with square brackets #3365

Open vipexv opened 2 weeks ago

vipexv commented 2 weeks ago

Description

Describe the bug

So i'm using Neovim development/nightly build due to the fact that it allows me to use Netrw to access directories that have brackets around them, so everything works fine, in React/Lua and every other language server, but in svelte it just throws an error saying not found, more info will be found below.

My Nvim Config can also be found here

Reproduction

Try to access a directory that's wrapped with square brackets, and the Lsp doesn't start up.

Expected behaviour

The LSP is expected to start and work normally.

System Info

Which package is the issue about?

svelte-language-server installed using Mason.

LspInfo:

==============================================================================

lspconfig:                                 require("lspconfig.health").check()

LSP configs active in this session (globally) ~
- Configured servers: svelte, tailwindcss, lua_ls, ts_ls
- OK Deprecated servers: (none)

LSP configs active in this buffer (id=13) ~
- Language client log: ~\AppData\Local\nvim-data\lsp.log
- Detected filetype: `svelte`
- 1 client(s) attached to this buffer
- Client: tailwindcss (id: 1, bufnr: [13])
  filetypes:       aspnetcorerazor, astro, astro-markdown, blade, clojure, django-html, htmldjango, edge, eelixir, elixir, ejs, erb, eruby, gohtml, gohtmltmpl, haml, handlebars, hbs, html, htmlangular, html-eex, heex, jade, leaf, liquid, markdown, mdx, mustache, njk, nunjucks, php, razor, slim, twig, css, less, postcss, sass, scss, stylus, sugarss, javascript, javascriptreact, reason, rescript, typescript, typescriptreact, vue, svelte, templ
  root directory:  Running in single file mode.
  cmd:             ~\AppData\Local\nvim-data\mason\bin\tailwindcss-language-server.CMD --stdio
  autostart:       true
- Other clients that match the "svelte" filetype: 
- Config: svelte
  filetypes:         svelte
  root directory:    ~\Desktop\test-server-ox\data\resources\[cfx]\[gameplay]\new_chat\Not found.
  cmd:               ~\AppData\Local\nvim-data\mason\bin\svelteserver.CMD --stdio
  cmd is executable: true
  autostart:         true
  custom handlers:   
vipexv commented 5 days ago

Managed to fix this by adding this to my LSP Config:

        svelte = function()
            require("lspconfig").svelte.setup({
                capabilities = lsp_capabilities,
                root_dir = function()
                    return vim.fn.getcwd()
                end,
            })
        end,

I'm pretty sure this only works on Neovim 11 Development/Nightly build, because it seems like they've fixed allot of weird issues with square brackets in this version.

justinmk commented 5 days ago

Thanks for the followup. But it's not clear whether you are saying any action is needed here. Are you suggesting a change to the svelte config?

If this is fixed in Nvim 0.11 then there is nothing left to be done.