Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions autoload/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ let s:default_settings = {
\ 'popup_select_first': 1,
\ 'quickfix_window_height': 10,
\ 'force_py_version': "'auto'",
\ 'virtualenv_path': "''",
\ 'smart_auto_mappings': 0,
\ 'use_tag_stack': 1
\ }
Expand Down
15 changes: 14 additions & 1 deletion pythonx/jedi_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,23 @@ def wrapper(*args, **kwargs):
def get_environment(use_cache=True):
global current_environment

vim_virtualenv_path = vim_eval("g:jedi#virtualenv_path")
vim_force_python_version = vim_eval("g:jedi#force_py_version")
if use_cache and vim_force_python_version == current_environment[0]:

if use_cache and vim_force_python_version == current_environment[0] or vim_virtualenv_path == current_environment[0]:
return current_environment[1]

if vim_virtualenv_path:
try:
environment = jedi.api.environment.create_environment(vim_virtualenv_path)
except jedi.InvalidPythonEnvironment as exc:
environment = jedi.api.environment.get_cached_default_environment()
echo_highlight(
"virutalenv_path=%s is invalid python environment." % (
vim_virtualenv_path))
current_environment = (vim_virtualenv_path, environment)
return environment

environment = None
if vim_force_python_version == "auto":
environment = jedi.api.environment.get_cached_default_environment()
Expand Down