mirror of
https://github.com/davidhalter/jedi-vim.git
synced 2025-12-06 10:54:22 +08:00
Added an undocumented JediLoadProject for now
This commit is contained in:
@@ -428,6 +428,10 @@ function! jedi#choose_environment(args) abort
|
|||||||
PythonJedi jedi_vim.choose_environment()
|
PythonJedi jedi_vim.choose_environment()
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
|
function! jedi#load_project(args) abort
|
||||||
|
PythonJedi jedi_vim.load_project()
|
||||||
|
endfun
|
||||||
|
|
||||||
function! jedi#py_import_completions(argl, cmdl, pos) abort
|
function! jedi#py_import_completions(argl, cmdl, pos) abort
|
||||||
PythonJedi jedi_vim.py_import_completions()
|
PythonJedi jedi_vim.py_import_completions()
|
||||||
endfun
|
endfun
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ endif
|
|||||||
command! -nargs=1 -complete=custom,jedi#py_import_completions Pyimport :call jedi#py_import(<q-args>)
|
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 JediChooseEnvironment :call jedi#choose_environment(<q-args>)
|
||||||
|
command! -nargs=? -complete=file JediLoadProject :call jedi#load_project(<q-args>)
|
||||||
|
|
||||||
|
|
||||||
function! s:jedi_debug_info()
|
function! s:jedi_debug_info()
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ def get_project():
|
|||||||
return project
|
return project
|
||||||
|
|
||||||
|
|
||||||
|
@catch_and_print_exceptions
|
||||||
def choose_environment():
|
def choose_environment():
|
||||||
args = shsplit(vim.eval('a:args'))
|
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>')
|
vim_command('noremap <buffer> <CR> :PythonJedi jedi_vim.choose_environment_hit_enter()<CR>')
|
||||||
|
|
||||||
|
|
||||||
|
@catch_and_print_exceptions
|
||||||
def choose_environment_hit_enter():
|
def choose_environment_hit_enter():
|
||||||
vim.vars['jedi#environment_path'] = vim.current.line
|
vim.vars['jedi#environment_path'] = vim.current.line
|
||||||
vim_command('bd')
|
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
|
@catch_and_print_exceptions
|
||||||
def get_script(source=None):
|
def get_script(source=None):
|
||||||
jedi.settings.additional_dynamic_modules = [
|
jedi.settings.additional_dynamic_modules = [
|
||||||
|
|||||||
Reference in New Issue
Block a user