multiples jediepcserver.py for multiples virtualenvs

南笙酒味 提交于 2019-12-08 12:50:34

问题


I'm trying to run multiples jediepcserver.py for multiples virtualenvs for different projects. My idea is to have the proper autocompletion in each of the projects that I'm working on Emacs.

For example, I'm working on two projects at the moment, one using Django 1.5 and another one using Django 1.7, so autocompletion should be different for each of the projects.

This is my configuration file:

(setq python-environment-directory "~/.virtualenvs")


(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)

(setq jedi:environment-root "jedi")  ; name of the virtualenv
(setq jedi:server-command '("/home/humitos/.emacs.d/vendor/emacs-jedi/jediepcserver.py"))
(setq jedi:server-args 
      '("--virtual-env" "~/.virtualenvs/jedi"
    "--log" "/tmp/jediepcserver.log"
    "--log-level" "DEBUG"))

(setq jedi:complete-on-dot t)

(setq jedi:get-in-function-call-delay 500)

I tried to use .dir-locals.el inside the projects but I couldn't make it work.

(setq jedi:server-args 
      '("--virtual-env" "~/.virtualenvs/my-venv-project"
    "--log" "/tmp/jediepcserver.log"
        "--log-level" "DEBUG"))

I think this should be possible but I'm sure that I'm missing something in the configuration. What is that?

Thanks in advance.


回答1:


From the documentation:

If you want to use a specific version of Python, setup jedi:environment-virtualenv variable appropriately and reinstall jediepcserver.py.

It also says you must configure jedi:environment-root if you set jedi:environment-virtualenvso...

my .dir-locals.el looks like this

((python-mode . ((python-shell-virtualenv-root . "/home/ale/.virtualenvs/env/")
      (jedi:environment-root . "/home/ale/.virtualenvs/env/")
      (jedi:environment-virtualenv . ("virtualenv" "--python" "/usr/bin/python3.4")) 
      )))

And the I reinstall the jediserver, it seems to work!

Forgive me for the missing ())())()()(((



来源:https://stackoverflow.com/questions/23874202/multiples-jediepcserver-py-for-multiples-virtualenvs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!