Added an undocumented JediLoadProject for now

This commit is contained in:
Dave Halter
2020-08-01 13:32:48 +02:00
parent 6efd966481
commit 74fd73d017
3 changed files with 30 additions and 0 deletions

View File

@@ -428,6 +428,10 @@ function! jedi#choose_environment(args) abort
PythonJedi jedi_vim.choose_environment()
endfun
function! jedi#load_project(args) abort
PythonJedi jedi_vim.load_project()
endfun
function! jedi#py_import_completions(argl, cmdl, pos) abort
PythonJedi jedi_vim.py_import_completions()
endfun

View File

@@ -54,6 +54,7 @@ endif
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
command! -nargs=? -complete=file JediChooseEnvironment :call jedi#choose_environment(<q-args>)
command! -nargs=? -complete=file JediLoadProject :call jedi#load_project(<q-args>)
function! s:jedi_debug_info()

View File

@@ -240,6 +240,7 @@ def get_project():
return project
@catch_and_print_exceptions
def choose_environment():
args = shsplit(vim.eval('a:args'))
@@ -257,11 +258,35 @@ def choose_environment():
vim_command('noremap <buffer> <CR> :PythonJedi jedi_vim.choose_environment_hit_enter()<CR>')
@catch_and_print_exceptions
def choose_environment_hit_enter():
vim.vars['jedi#environment_path'] = vim.current.line
vim_command('bd')
@catch_and_print_exceptions
def load_project():
path = vim.eval('a:args')
vim.vars['jedi#project_path'] = path
env_path = vim_eval("g:jedi#environment_path")
if env_path == 'auto':
env_path = None
if path:
try:
project = jedi.Project.load(path)
except FileNotFoundError:
project = jedi.Project(path, environment_path=env_path)
project.save()
else:
project = jedi.get_default_project()
path = project.path
project.save()
global _current_project_cache
cache_key = dict(project_path=path, environment_path=env_path)
_current_project_cache = cache_key, project
@catch_and_print_exceptions
def get_script(source=None):
jedi.settings.additional_dynamic_modules = [