reddit / emacs

How to setup lsp mode for python to navigate external dependencies

shelper9527 · 2022-05-23 14:33
I am using Doom-emacs, but I am pretty sure this is not Doom specific. I was able to setup lsp-mode for python, and it works fine for my own code. But if i am using external dependencies, for instance, I am using `sqlalchemy`, if I have `from sqlalchemy import util` in my project/workspace, I can easily go to the `util.py` file for `sqlalchemy` by command `evil-goto-definition`, but once I am in `util.py`, then go to definition does not work, 'cus I think the package folder for `sqlalchemy` is not part of the workspace that lsp is aware of. Basically, this causes lsp to fail for any external packages... Is there a way to solve this? in `vscode`, everything works even you go into nested external packages, it just is able to figure out and all the lsp stuff works.
-cvdub- · 2022-05-24 04:40
Does lsp not prompt you to add that new package to the workspace when visiting a file in the package for the first time? If not, you can always manually add that package to your workspace when you visit it. I agree with you though. Browsing python dependency code w/ Doom +lsp functionally doesn’t feel seamless for me either.
shelper9527 · 2022-05-24 22:27
It does but it is annoying to do that every time and you have to clean up the workspace folders afterwards, otherwise it gets bloated