diff --git a/README.rst b/README.rst index 1da847a..bca0be7 100644 --- a/README.rst +++ b/README.rst @@ -208,6 +208,11 @@ get more information. If you set them to ``""``, they are not assigned. let g:jedi#completions_command = "" let g:jedi#rename_command = "r" +A few examples of setting up your project: + +.. code-block:: vim + + let g:jedi#environment_path = "d" Finally, if you don't want completion, but all the other features, use: diff --git a/doc/jedi-vim.txt b/doc/jedi-vim.txt index 32012d5..2a53532 100644 --- a/doc/jedi-vim.txt +++ b/doc/jedi-vim.txt @@ -44,6 +44,7 @@ Contents *jedi-vim-contents* 6.12. force_py_version |g:jedi#force_py_version| 6.13. smart_auto_mappings |g:jedi#smart_auto_mappings| 6.14. use_tag_stack |g:jedi#use_tag_stack| + 6.15. environment_path |g:jedi#environment_path| 7. Testing |jedi-vim-testing| 8. Contributing |jedi-vim-contributing| 9. License |jedi-vim-license| @@ -506,6 +507,17 @@ definition with arbitrary changes to the |jumplist|. Options: 0 or 1 Default: 1 (enabled by default) +------------------------------------------------------------------------------ +6.15. `g:jedi#environment_path` *g:jedi#environment_path* + +To use a specific virtualenv or a specific Python version it is possible to +set an interpreter. + +Both setting the directory and setting a project is working. + +Examples: "/usr/bin/python3.9", "venv", "../venv", "../venv/bin/python" +Default: "auto" + ============================================================================== 7. Testing *jedi-vim-testing* diff --git a/pythonx/jedi_vim.py b/pythonx/jedi_vim.py index ba0e6c5..056ab97 100644 --- a/pythonx/jedi_vim.py +++ b/pythonx/jedi_vim.py @@ -211,19 +211,16 @@ def _check_jedi_availability(show_error=False): return func_receiver +# Tuple of cache key / project _current_project_cache = None, None -def _create_project_cache_key(project_path, environment_path): - return dict(project_path=project_path, environment_path=environment_path) - - def get_project(): global _current_project_cache vim_environment_path = vim_eval("g:jedi#environment_path") vim_project_path = vim_eval("g:jedi#project_path") - cache_key = _create_project_cache_key(vim_project_path, vim_environment_path) + cache_key = dict(project_path=vim_project_path, environment_path=vim_environment_path) if cache_key == _current_project_cache[0]: return _current_project_cache[1]