Skip to content

Commit

Permalink
Return floating_preview window id
Browse files Browse the repository at this point in the history
Make ale#floating_preview#Show more similar to popup_create and return
the id of the window so it's easy to set the filetype of the resulting
buffer.

Update test stub version of Show() to return a win id (the current window
since it's not actually creating a window).

Test
* both tests still pass
  • Loading branch information
idbrii committed Oct 17, 2024
1 parent 48d73c8 commit a1fe863
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions autoload/ale/floating_preview.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function! ale#floating_preview#Show(lines, ...) abort
else
call s:VimShow(a:lines, l:options)
endif

return w:preview.id
endfunction

function! s:NvimShow(lines, options) abort
Expand Down
1 change: 1 addition & 0 deletions test/test_floating_preview.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Before:
function! ale#floating_preview#Show(lines, ...) abort
let g:floating_preview_show_called = 1
let g:floated_lines = a:lines
return win_getid()
endfunction

let g:ale_buffer_info = {
Expand Down
1 change: 1 addition & 0 deletions test/test_hover.vader
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Before:
function! ale#floating_preview#Show(lines, ...) abort
let g:floating_preview_show_called = 1
let g:floated_lines = a:lines
return win_getid()
endfunction

function! ale#lsp_linter#StartLSP(buffer, linter, callback) abort
Expand Down

0 comments on commit a1fe863

Please sign in to comment.