@@ -423,25 +423,91 @@ function! jedi#clear_call_signatures()
423423endfunction
424424
425425
426- function ! jedi#configure_call_signatures ()
427- augroup jedi_call_signatures
428- autocmd ! * <buffer>
429- if g: jedi #show_call_signatures == 2 " Command line call signatures
430- autocmd InsertEnter <buffer> let g: jedi #first_col = s: save_first_col ()
431- endif
432- autocmd InsertEnter <buffer> let s: show_call_signatures_last = [0 , 0 , ' ' ]
433- autocmd InsertLeave <buffer> call jedi#clear_call_signatures ()
434- if g: jedi #show_call_signatures_delay > 0
435- autocmd InsertEnter <buffer> let b: _jedi_orig_updatetime = &updatetime
436- \ | let &updatetime = g: jedi #show_call_signatures_delay
437- autocmd InsertLeave <buffer> if exists (' b:_jedi_orig_updatetime' )
438- \ | let &updatetime = b: _jedi_orig_updatetime
439- \ | unlet b: _jedi_orig_updatetime
440- \ | endif
441- autocmd CursorHoldI <buffer> call jedi#show_call_signatures ()
426+ let s: prev_show_call_signatures = 0
427+ function ! jedi#configure_call_signatures (... ) abort
428+ if a: 0
429+ let old = g: jedi #show_call_signatures
430+ let new = a: 1
442431 else
443- autocmd CursorMovedI <buffer> call jedi#show_call_signatures ()
432+ let old = s: prev_show_call_signatures
433+ let new = g: jedi #show_call_signatures
434+ endif
435+
436+ if new == 1 && ! has (' conceal' )
437+ echohl WarningMsg
438+ echom " jedi-vim's show_call_signatures=1 requires the conceal feature."
439+ echohl None
440+ return
441+ endif
442+
443+ let g: jedi #show_call_signatures = new
444+
445+ if new != s: prev_show_call_signatures
446+ " Cleanup.
447+ if s: prev_show_call_signatures == 1
448+ syn clear jediIgnore jediFatSymbol jediFat jediSpace jediFunction
449+ setl conceallevel&
450+ endif
451+ endif
452+ let s: prev_show_call_signatures = g: jedi #show_call_signatures
453+
454+ if g: jedi #show_call_signatures == 0
455+ augroup jedi_call_signatures
456+ au !
457+ augroup END
458+ return
459+
460+ elseif g: jedi #show_call_signatures == 1
461+ let e = g: jedi #call_signature_escape
462+ let full = e .' jedi=.\{-}' .e .' .\{-}' .e .' jedi' .e
463+ let ignore = e .' jedi.\{-}' .e
464+ exe ' syn match jediIgnore "' .ignore .' " contained conceal'
465+ setlocal conceallevel= 2
466+ syn match jediFatSymbol " \* _\* " contained conceal
467+ syn match jediFat " \* _\* .\{ -}\* _\* " contained contains =jediFatSymbol
468+ syn match jediSpace " \v [ ]+( )@=" contained
469+ exe ' syn match jediFunction "' .full.' " keepend extend '
470+ \ .' contains=jediIgnore,jediFat,jediSpace'
471+ \ .' containedin=pythonComment,pythonString,pythonRawString'
472+
473+ hi def link jediIgnore Ignore
474+ hi def link jediFatSymbol Ignore
475+ hi def link jediSpace Normal
476+
477+ if hlexists (' CursorLine' )
478+ hi def link jediFunction CursorLine
479+ else
480+ hi jediFunction term = NONE cterm= NONE ctermfg= 6 guifg= Black gui = NONE ctermbg= 0 guibg= Grey
481+ endif
482+ if hlexists (' TabLine' )
483+ hi def link jediFat TabLine
484+ else
485+ hi jediFat term = bold ,underline cterm= bold ,underline gui = bold ,underline ctermbg= 0 guibg= #555555
486+ endif
444487 endif
488+
489+ augroup jedi_call_signatures
490+ autocmd ! * <buffer>
491+ if g: jedi #show_call_signatures == 2 " Command line call signatures
492+ autocmd InsertEnter <buffer> let g: jedi #first_col = s: save_first_col ()
493+ elseif g: jedi #show_call_signatures == 1
494+ autocmd ColorScheme <buffer> call jedi#configure_call_signatures ()
495+ " autocmd Syntax <buffer> debug call jedi#configure_call_signatures()
496+ endif
497+
498+ autocmd InsertEnter <buffer> let s: show_call_signatures_last = [0 , 0 , ' ' ]
499+ autocmd InsertLeave <buffer> call jedi#clear_call_signatures ()
500+ if g: jedi #show_call_signatures_delay > 0
501+ autocmd InsertEnter <buffer> let b: _jedi_orig_updatetime = &updatetime
502+ \ | let &updatetime = g: jedi #show_call_signatures_delay
503+ autocmd InsertLeave <buffer> if exists (' b:_jedi_orig_updatetime' )
504+ \ | let &updatetime = b: _jedi_orig_updatetime
505+ \ | unlet b: _jedi_orig_updatetime
506+ \ | endif
507+ autocmd CursorHoldI <buffer> call jedi#show_call_signatures ()
508+ else
509+ autocmd CursorMovedI <buffer> call jedi#show_call_signatures ()
510+ endif
445511 augroup END
446512endfunction
447513
@@ -531,37 +597,6 @@ function! jedi#smart_auto_mappings()
531597 return " \<space> "
532598endfunction
533599
534- let s: prev_show_call_signatures = 0
535- function ! jedi#setup_call_signatures (... ) abort
536- if g: jedi #show_call_signatures > 0 && has (' conceal' )
537- " +conceal is the default for vim >= 7.3
538-
539- let s: e = g: jedi #call_signature_escape
540- let s: full = s: e .' jedi=.\{-}' .s: e .' .\{-}' .s: e .' jedi' .s: e
541- let s: ignore = s: e .' jedi.\{-}' .s: e
542- exe ' syn match jediIgnore "' .s: ignore .' " contained conceal'
543- setlocal conceallevel= 2
544- syn match jediFatSymbol " \* _\* " contained conceal
545- syn match jediFat " \* _\* .\{ -}\* _\* " contained contains =jediFatSymbol
546- syn match jediSpace " \v [ ]+( )@=" contained
547- exe ' syn match jediFunction "' .s: full .' " keepend extend '
548- \ .' contains=jediIgnore,jediFat,jediSpace'
549- \ .' containedin=pythonComment,pythonString,pythonRawString'
550- unlet ! s: e s: full s: ignore
551-
552- hi def link jediIgnore Ignore
553- hi def link jediFatSymbol Ignore
554- hi def link jediSpace Normal
555-
556- if exists (' g:colors_name' )
557- hi def link jediFunction CursorLine
558- hi def link jediFat TabLine
559- else
560- hi jediFunction term = NONE cterm= NONE ctermfg= 6 guifg= Black gui = NONE ctermbg= 0 guibg= Grey
561- hi jediFat term = bold ,underline cterm= bold ,underline gui = bold ,underline ctermbg= 0 guibg= #555555
562- endif
563- endif
564- endfunction
565600
566601" PythonJedi jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout, speed=True, warnings=False, notices=False)
567602" PythonJedi jedi_vim.jedi.set_debug_function(jedi_vim.print_to_stdout)
0 commit comments