Skip to content

Commit

Permalink
Init first_col with show_call_signatures == 2
Browse files Browse the repository at this point in the history
This is required when lazy-loading jedi-vim on InsertEnter.

Also use a script-local variable to save this state.
  • Loading branch information
blueyed committed Aug 2, 2018
1 parent 124b52e commit f5f5f2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion autoload/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -544,12 +544,17 @@ function! jedi#configure_call_signatures(...) abort
else
hi def jediFat term=bold,underline cterm=bold,underline gui=bold,underline ctermbg=0 guibg=#555555
endif

elseif g:jedi#show_call_signatures == 2
" Init (from InsertEnter), for when jedi-vim is lazy-loaded on
" InsertEnter.
let s:callsig_cmd_first_col = s:save_first_col()
endif

augroup jedi_call_signatures
autocmd! * <buffer>
if g:jedi#show_call_signatures == 2 " Command line call signatures
autocmd InsertEnter <buffer> let g:jedi#first_col = s:save_first_col()
autocmd InsertEnter <buffer> let s:callsig_cmd_first_col = s:save_first_col()
elseif g:jedi#show_call_signatures == 1
autocmd ColorScheme <buffer> call jedi#configure_call_signatures()
" autocmd Syntax <buffer> debug call jedi#configure_call_signatures()
Expand Down
2 changes: 1 addition & 1 deletion pythonx/jedi_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def too_long():
if index is not None:
max_num_spaces -= len(join())
_, column = signatures[0].bracket_start
spaces = min(int(vim_eval('g:jedi#first_col +'
spaces = min(int(vim_eval('s:callsig_cmd_first_col +'
'wincol() - col(".")')) +
column - len(signatures[0].name),
max_num_spaces) * ' '
Expand Down

0 comments on commit f5f5f2a

Please sign in to comment.