kawre / leetcode.nvim

A Neovim plugin enabling you to solve LeetCode problems.
MIT License
1.14k stars 48 forks source link

LSP autocomplete not working in python #125

Open mixtli opened 2 months ago

mixtli commented 2 months ago

For some reason, whenever I open a normal python project, LSP autocomplete works fine. For example, if I type:

foo = [] foo.

I see all the standard list methods from LSP in addition to my snippets, etc.

But when running nvim leetcode.nvim, autocomplete only shows snippets.

LspInfo shows that pyright is attached.

I do see this over and over in the Lsp log: [ERROR][2024-08-29 15:14:55] ...lsp/handlers.lua:623 'File or directory "/" does not exist.'

Any idea why this might be?

mixtli commented 2 months ago

So, I solved this by finding the leetcode state dir and running: touch pyrightconfig.json.

It seems initializing the directory as a git repo also works.

I'm not sure how to make this automatic.. But I think a lot of things depend on the root being a git repo to work, so maybe the plugin should just initialize the state repo to a git repo if git is installed? Maybe it's outside the scope of this plugin, but I do think it's confusing for users. It took me way too long to figure this out.