Skip to content
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

lsp: unstable api not visible from neovim #18570

Closed
andykais opened this issue Apr 3, 2023 · 8 comments
Closed

lsp: unstable api not visible from neovim #18570

andykais opened this issue Apr 3, 2023 · 8 comments
Labels
lsp related to the language server needs investigation requires further investigation before determining if it is an issue or not

Comments

@andykais
Copy link

andykais commented Apr 3, 2023

Possibly related to #13228 or #14455, there is something odd about how deno lsp is interacting with neovim. Opening a typescript file in a project that I want deno lsp enabled in (e.g. with a deno.jsonc file), I receive these logs:

[ERROR][2023-04-02 23:37:32] .../vim/lsp/rpc.lua:732	"rpc"	"deno"	"stderr"	'Starting Deno language serverdeno/deno\nConnected to "Neovim" 0.9.0\n  Auto-resolved configuration file: "file:///home/andrew/Code/development/dene
[ERROR][2023-04-02 23:37:32] .../vim/lsp/rpc.lua:732	"rpc"	"deno"	"stderr"	"Server ready.\n"
[ERROR][2023-04-02 23:37:32] .../vim/lsp/rpc.lua:732	"rpc"	"deno"	"stderr"	"Error converting specifier seull, expected struct SpecifierSettings\n"

Whats odd here is that I do have this lspconfig for deno. It is made based off of the lsp flags described in the deno docs and the neovim lspconfig docs:

local lspconfig = require('lspconfig')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig["denols"].setup({
  on_attach = on_attach,
  capabilities = capabilities,
  root_dir = root_pattern("deno.json", "deno.jsonc"),
  init_options = {
    enable = true,
    lint = false,
    unstable = false,
  }
})

Now I know it is at least reading the config in, because changing enable to false will stop the lsp server from connecting at all. I dont know a ton about the lsp protocol, but what @kitsonk mentioned about a workspace/configuration request makes me wonder if the server starts, but fails to configure any specific behavior because the client isnt sending that request. If this sounds like an issue with neovim I can open an issue there, but at least at first glance I was not sure.

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

you should not use init_options, you should use settings instead

    settings = {
      deno = {
        enable = true,
        unstable = true
      }
    }

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

you have unstable = false in your example , is that a typo ?

Or am I misunderstanding the issue, do you mean that you can't see unstable apis like Deno.serve ?

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

Because I'm seeing the inverse issue, the unstable apis are always present even with unstable = false maybe thats what you meant ?

This is a recent regression I'm pretty sure it used to work until recently, but this works in vscode so I'll have to dig in which layer the issue is

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

Because I'm seeing the inverse issue, the unstable apis are always present even with unstable = false maybe thats what you meant ?

This is a recent regression I'm pretty sure it used to work until recently, but this works in vscode so I'll have to dig in which layer the issue is

Ok scratch that, it only happens in lunarvim, it doesn't happen in clean neovim

So yeah currently I'm no seeing any issue

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

Ok there is a new behavior here, it seems like its related to the new file preloading for the lsp,

in neovim I have a setup like this

-/deno/--denoprojects/-{...subfoders}
       --deno.tag

and I spawn the lsp server with root_pattern("deno.tag")

this makes deno lsp work automatically in any project under denoprocjets sub-folders

This had no issue before (tested again with 1.31.0 and it still works) but with the latest version the file preloading kicks in and even though I'm in a leaf folder, it will preload all files starting from the root (and I obviously immediately hit the 1000 file limit), and apparently this confuses the lsp and makes it ignore configs like unstable = false

@sigmaSd
Copy link
Contributor

sigmaSd commented Apr 3, 2023

@dsherret do you think my setup is not something to be supported ? if so I guess I can just remove that idea and use a deno.json file or similar inside each project to trigger the lsp, same as vscode which needs per project config

@aapoalas aapoalas added lsp related to the language server needs investigation requires further investigation before determining if it is an issue or not labels Apr 15, 2023
@igorbrasileiro
Copy link

igorbrasileiro commented Jun 16, 2023

I'm facing issues with autocomplete and other things. https://github.com/nvim-lua/kickstart.nvim I use this setup but without typescript ('tsx', 'typescript') and tsserver settings. Ain't not an nvim expert. I'm using nvim 0.9.0.

How can I Help you to help me debug this?

@nayeemrmn
Copy link
Collaborator

Tentatively closing as fixed by #20358. Please report here if it's still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lsp related to the language server needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

No branches or pull requests

5 participants