AckslD / swenv.nvim

Tiny plugin to quickly switch python virtual environments from within neovim without restarting.
206 stars 29 forks source link

Unable to detect the packages from the virtual environment present in current directory . #15

Closed akashdiphazra closed 1 year ago

akashdiphazra commented 1 year ago

I have created a virtual environment named myenv in the current directory, swenv detects the virtual environment but unable to detect packages present in it.


require('swenv').setup({
  -- Should return a list of tables with a `name` and a `path` entry each.
  -- Gets the argument `venvs_path` set below.
  -- By default just lists the entries in `venvs_path`.
  get_venvs = function(venvs_path)
    return require('swenv.api').get_venvs(venvs_path)
  end,
  -- Path passed to `get_venvs`.
  venvs_path = vim.fn.expand('.'),
  -- Something to do after setting an environment, for example call vim.cmd.LspRestart
  post_set_venv = nil,
})

https://github.com/AckslD/swenv.nvim/assets/61003681/96d49c62-e872-442c-b014-48a89f3b4b56

AckslD commented 1 year ago

Does it work if you do :LspRestart after switching venv?

akashdiphazra commented 1 year ago

No it, still doesn't works

Screencast from 2023-06-02 19-49-39.webm

skolj commented 1 year ago

@akashdiphazra I believe the problem is with vim.fn.expand('.') when you set venvs_path. It doesn't get expanded to the correct absolute path. You might wanna change it to venvs_path = vim.fn.getcwd() instead and then give it a try.

akashdiphazra commented 1 year ago

I not proficient with lua api's in neovim. It worked thanks @skolj