I am a Python developer and would like to use Neovim as my main code editor. I have managed to configure auto-completion, linting and auto-formatting using lspconfig
, mason
, null-ls
, nvim-cmp
and other plugins. However, I am still missing one great feature that I used a lot while coding in PyCharm: using the “context actions”, I was able to import a symbol, i.e. a class, function or module, that is currently under my cursor, as shown on the screenshot below:
Calling “Context Actions” to import a class under cursor
However, I am missing this feature in my Neovim setup. I assume that the “code actions” feature of certain language servers should provide me with an option to import a symbol from a certain module, but I have tried several language servers for Python and had no lock. The language servers I have tried are:
jedi-language-server
;pyright
;basedpyright
;pylsp
.
Here is a screenshot of what I got with jedi-language-server
and ruff_lsp
installed when calling a “code action” on a “Path” symbol:
No import suggestions on Code Action
In summary, the question is how can I have this “import” feature in my Neovim setup?