Describe the environment_path option properly

This commit is contained in:
Dave Halter
2020-07-30 18:16:35 +02:00
parent c4fc2cde8c
commit 2949389be4
3 changed files with 19 additions and 5 deletions

View File

@@ -208,6 +208,11 @@ get more information. If you set them to ``""``, they are not assigned.
let g:jedi#completions_command = "<C-Space>"
let g:jedi#rename_command = "<leader>r"
A few examples of setting up your project:
.. code-block:: vim
let g:jedi#environment_path = "<leader>d"
Finally, if you don't want completion, but all the other features, use:

View File

@@ -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*

View File

@@ -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]