linux-cultist / venv-selector.nvim

Allows selection of python virtual environment from within neovim
MIT License
388 stars 41 forks source link

`search = false` not returning valid results #7

Closed patrickarmengol closed 1 year ago

patrickarmengol commented 1 year ago

The configuration examples note the following about the search configuration option:

If you only use venvs located in project folders, you can set search = false and search_workspace = true.

and

You can set this to false to speed up the plugin if your virtual envs are in your workspace, or in Poetry or Pipenv locations. No need to search if you know where they will be.

Yet, the following configuration returns no results:

  {
    "linux-cultist/venv-selector.nvim",
    opts = {
      search_venv_managers = false,
      search_workspace = true,
      search = false,
      name = ".venv",
    },
  },

If I set search to true, the results appear, but are not exclusive to the workspace anymore.

linux-cultist commented 1 year ago

Thank you for taking the time to report this. Lets see what your lsp server reports as a workspace. If you run this command in vim command mode (press colon to get into command mode):

lua =vim.lsp.buf.list_workspace_folders()

Do you get the path to your project folder? You can also run LspInfo and see what it says as "root directory" in that dialog box for the lsp client pyright.

And you need to do this when you are in your project with a python file open in your buffer so pyright has been activated. :)

And sorry for making you bother with this. Its only because i cant replicate the issue here on my machine. It does find the .venv folder for me, unfortunantly. Would be easier to debug if it didnt. :)

patrickarmengol commented 1 year ago

Aww man, I really should have checked if I was on the latest version... Looks like some recent changes to the plugin have fixed this issue. Sorry for the trouble. I'll check on the other issues I opened as well.

Anyway, thanks for the quick reply.

linux-cultist commented 1 year ago

Thank you, and enjoy the plugin!

I know previous versions had bugs and I think you just noticed a few of them. :) I did a big rewrite of the plugin a few days ago and I think it resulted in a lot more stable code. But please report if you find other weirdness. :)