From 0b4c66584002c2fec5bf44d491683a9aa438c500 Mon Sep 17 00:00:00 2001 From: David Briscoe <43559+idbrii@users.noreply.github.com> Date: Sat, 19 Oct 2024 08:13:50 -0700 Subject: [PATCH] Return floating_preview window id (#4828) 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 --- autoload/ale/floating_preview.vim | 2 ++ test/test_floating_preview.vader | 1 + test/test_hover.vader | 1 + 3 files changed, 4 insertions(+) diff --git a/autoload/ale/floating_preview.vim b/autoload/ale/floating_preview.vim index 970a9b30..3e1fabb8 100644 --- a/autoload/ale/floating_preview.vim +++ b/autoload/ale/floating_preview.vim @@ -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 diff --git a/test/test_floating_preview.vader b/test/test_floating_preview.vader index 43415556..f765f3f8 100644 --- a/test/test_floating_preview.vader +++ b/test/test_floating_preview.vader @@ -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 = { diff --git a/test/test_hover.vader b/test/test_hover.vader index 580b8846..db302585 100644 --- a/test/test_hover.vader +++ b/test/test_hover.vader @@ -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