finally got float window working with variable evaluation
This commit is contained in:
parent
85ca867cc2
commit
7c4eef9096
3 changed files with 38 additions and 0 deletions
|
|
@ -29,6 +29,18 @@ function! vimspector#internal#balloon#BalloonExpr() abort
|
|||
\ . 'vim.eval( "v:beval_text" ) )' )
|
||||
endfunction
|
||||
|
||||
" Returns: py.ShowBalloon( winnr, expresssion )
|
||||
function! vimspector#internal#balloon#Tooltip() abort
|
||||
" winnr + 1 because for *no good reason* winnr is 0 based here unlike
|
||||
" everywhere else
|
||||
" int() because for *no good reason* winnr is a string.
|
||||
return py3eval('_vimspector_session.ShowBalloon('
|
||||
\ . 'int( vim.eval( "v:beval_winnr" ) ) + 1,'
|
||||
\ . 'vim.eval( "expand(\"<cexpr>\")" ) )' )
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
" Boilerplate {{{
|
||||
let &cpoptions=s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -47,6 +47,28 @@ function! vimspector#internal#state#GetAPIPrefix() abort
|
|||
return s:prefix
|
||||
endfunction
|
||||
|
||||
" REMOVEME: this is just a temporary thing to get float window working
|
||||
" Returns: py.ShowBalloon( winnr, expresssion )
|
||||
function! vimspector#internal#state#Tooltip() abort
|
||||
" winnr + 1 because for *no good reason* winnr is 0 based here unlike
|
||||
" everywhere else
|
||||
" int() because for *no good reason* winnr is a string.
|
||||
return py3eval('_vimspector_session.ShowBalloon('
|
||||
\ . 'int( vim.eval( "winnr()" ) ) ,'
|
||||
\ . 'vim.eval( "expand(\"<cexpr>\")" ) )' )
|
||||
endfunction
|
||||
|
||||
function! vimspector#internal#state#TooltipExec(body) abort
|
||||
let buf = nvim_create_buf(v:false, v:true)
|
||||
call nvim_buf_set_lines(buf, 0, -1, v:true, a:body)
|
||||
let opts = { 'relative': 'cursor', 'width': 40, 'height': 2, 'col': 0, 'row': 1, 'anchor': 'NW', 'style': 'minimal' }
|
||||
let g:float_win = nvim_open_win(buf, 0, opts)
|
||||
|
||||
augroup vimspector#internal#balloon#nvim_float
|
||||
autocmd!
|
||||
autocmd CursorMoved * :call nvim_win_close(g:float_win, 1) | autocmd! vimspector#internal#balloon#nvim_float
|
||||
augroup END
|
||||
endfunction
|
||||
" Boilerplate {{{
|
||||
let &cpoptions=s:save_cpo
|
||||
unlet s:save_cpo
|
||||
|
|
|
|||
|
|
@ -635,6 +635,10 @@ def ParseVariables( variables_list,
|
|||
|
||||
|
||||
def DisplayBaloon( is_term, display ):
|
||||
if int(vim.eval("has('nvim')")):
|
||||
vim.eval("vimspector#internal#state#TooltipExec({})".format(display))
|
||||
return
|
||||
|
||||
if not is_term:
|
||||
display = '\n'.join( display )
|
||||
# To enable the Windows GUI to display the balloon correctly
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue