问题
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-virtualenv
so...
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