I’m currently using emacs-jedi for Python, and I’m trying to use and evaluate lsp-mode/eglot.
This is the minimum I’m looking for:
* “Jump to definition” should work, including when I jump into dependencies and keep going (which are installed into virtualenvs)
* Syntax errors, undefined variables etc, should be highlighted
* I should get completions/popups when writing code
* I need for support for multiple Python projects, each in its own virtualenv, often with different Python versions, preferably with very little setup required.
Trying this out with lsp-mode and the different options (pyright, pylsp), I’m hitting major bugs, and wondering if anyone else has actually got this working in a satisfactory way.
With [python-lsp-server](https://github.com/python-lsp/python-lsp-server) I can’t figure out how to get it to see my virtualenv at all. In fact I can’t figure out how to set any configuration options (the docs are pretty cryptic and show no examples).
With pyright, I can use configure it with pyrightconfig.json to get the server to see the code in my virtualenv, and “jump to definition” from the main project to code in virtualenv works. However, once in the venv, I’m prompted to import the file, which is annoying. If I do so, it seems to add to some global set of imported files, and has serious performance implications (e.g. if it happens to be part of Django, then I get a warning about watching 1000s of directories, which is unnecessary when I’m not going to be editing dependencies). If I don’t import, then “jump to definition” doesn’t work within that file.
I'm having similar problems with lsp-jedi.
With the emacs-jedi package (which isn't an LSP system), I am able to get virtualenvs to be recognised with use of .dir-locals.el, and with just one installation of jedi per major Python version (3.6, 3.7) etc. I had a very simple script that created .dir-locals.el from a template when I needed to start work on a new project.
Can anyone share their recommendations and workflow for this kind of thing?