DetachHead / basedpyright

pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
https://docs.basedpyright.com
Other
1.23k stars 26 forks source link

Neovim telescope lsp_references, lsp_document_symbols, lsp_definitions not working #684

Open martin-scheele opened 2 months ago

martin-scheele commented 2 months ago

Hello! First of all, thanks for the awesome work being done here. Hopefully this is the right place to ask for help/clarification regarding this - as far as I can tell, this isn't an issue with other plugins (i.e. Telescope) or with my configuration per se, granted I could be wrong about that.

I'm using neovim and have basedpyright installed and configured through mason and mason-lspconfig.

I'm running into some issues with a few of the language server features. I'm using telescope pickers for the "goto _" functionality (e.g. the :Telescope lsp_references command), and this has worked with every other language server I've come across.

With based_pyright, however, the Telescope windows come up blank for lsp_references, lsp_document_symbols and lsp_definitions specifically. lsp_definition does work on user defined objects, but nothing comes up for Python builtins.

The vim.lsp.buf.references, vim.lsp.buf.document_symbol and vim.lsp.buf.definition functions work as expected.

I don't really have a good enough understanding of what is going on under the hood to be able to understand where the problem actually lies. Any clarification on this would be greatly appreciated, and if this is some simple oversight or misunderstanding on my part or if there is any further information needed, please let me know.

DetachHead commented 2 months ago

I don't really have a good enough understanding of what is going on under the hood to be able to understand where the problem actually lies.

unfortunately since i'm not a neovim user i'm in the same boat lol. some ideas to try to help narrow down where the issue is:

martin-scheele commented 2 months ago

Mason has the most recent version of basedpyright (1.17.5).

I haven't tested it with pyright or another editor but I can test that sometime in the next few days.

Oddly enough, I just tested the functionality again in a different Python project and somehow references and document symbols started working, but definitions for the Python builtins are still broken. The two projects are configured identically so I'm not sure what's going on there either. I can test it some more this week and report back with whatever I can figure out.

Again, thanks for taking the time to give me some leads on this! I really appreciate it.

martin-scheele commented 2 months ago

I just got around to testing this - the issue isn't present in the VSCode extension, nor in neovim using pyright.

At the end of the day its something I can work around, but I am curious as to where the issue actually stems from.

DetachHead commented 1 month ago

can you set basedpyright.analysis.logLevel to "Trace" and see if it logs anything noteworthy?

martin-scheele commented 1 month ago

Not quite sure what's going on but I'm not getting any logs for basedpyright, at least not in the neovim lsp.log file (it's working for other servers though).

DetachHead commented 1 month ago

maybe basedpyright isn't even running? are you seeing any type errors? can you verify whether any of the basedpyright-exclusive features are working?

martin-scheele commented 1 month ago

Yeah, I mean everything is working in at least some projects - I think I'll try installling basedpyright through pip instead of Mason and see if anything changes.

martin-scheele commented 1 month ago

The pip version still doesn't have logs but now go to definition works for the Python builtins in the aforementioned problem file. As far as I can tell that's the only functional difference between them.

DetachHead commented 1 month ago

hmm it sounds like there may be something wrong with the mason's bundled version of basedpyright then. you may want to raise an issue at https://github.com/williamboman/mason.nvim

martin-scheele commented 1 month ago

Yeah, if I have the time I'll try to recreate the problem with a minimal neovim config just so I can rule some things out and there's actually more to go off of.

It's still strange that there aren't any logs though, right? As well as the other missing functionality even when installing via pip. I have to imagine that if that was the case for everyone using basedpyright with neovim that someone would have raised an issue before me.

In any case, thanks for trying to help me with this even though you're not a neovim user. Maybe I'll actually have to learn lua and the inner workings of neovim and come back with something to go off of lol.