profile
viewpoint

Ask questions[REQUEST] Automatically activate a pipenv environment if available

It would be really nice if doom-emacs tried to run pipenv-activate on Python files.

Rationale:

  1. Spacemacs does it
  2. It's a noop if a pipenv is not available
  3. (most important) in LSP mode, lsp-mode activates automatically for every file. If the language server is installed into a virtual environment, lsp-mode will not find it without activated virtualenv.

A possible complication is that while lsp-mode starts a language server per workspace, pyvenv applies its configuration globally, so that something like a pipenv-deactivate + pipenv-activate combo is needed every time a buffer is opened or switched to.

hlissner/doom-emacs

Answer questions hlissner

I'll look into restarting LSP servers when the python environment changes. I don't think this is acceptable on buffer switch, but it makes sense to do so upon a) first entering a python-mode buffer (calling pipenv-deactivate and pipenv-activate on python-mode-hook would happen soon enough for LSP to see the changes) and b) when switching workspaces. I'll look into implementing these.

useful!
source:https://uonfu.com/
answerer
Henrik Lissner hlissner Toronto, ON https://henrik.io In a relationship with gamedev, pixel art & esoteric text editors. Send help. Or cookies.
Github User Rank List