Skip to content

Commit 4c14bd4

Browse files
committed
Revert "Add LanguageClient#reopenHoverInSeparateWindow()"
This reverts commit 18640c2. This reverts commit f40a1c3.
1 parent 6f4ce81 commit 4c14bd4

File tree

3 files changed

+10
-74
lines changed

3 files changed

+10
-74
lines changed

Diff for: autoload/LanguageClient.vim

+10-41
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function! s:CloseFloatingHoverOnCursorMove(win_id, opened) abort
273273
" was really moved
274274
return
275275
endif
276-
silent! autocmd! plugin-LC-neovim-close-hover
276+
autocmd! plugin-LC-neovim-close-hover
277277
let winnr = win_id2win(a:win_id)
278278
if winnr == 0
279279
return
@@ -285,7 +285,7 @@ function! s:CloseFloatingHoverOnBufEnter(win_id, bufnr) abort
285285
let winnr = win_id2win(a:win_id)
286286
if winnr == 0
287287
" Float window was already closed
288-
silent! autocmd! plugin-LC-neovim-close-hover
288+
autocmd! plugin-LC-neovim-close-hover
289289
return
290290
endif
291291
if winnr == winnr()
@@ -296,7 +296,7 @@ function! s:CloseFloatingHoverOnBufEnter(win_id, bufnr) abort
296296
" When current buffer opened hover window, it's not another buffer. Skipped
297297
return
298298
endif
299-
silent! autocmd! plugin-LC-neovim-close-hover
299+
autocmd! plugin-LC-neovim-close-hover
300300
execute winnr . 'wincmd c'
301301
endfunction
302302

@@ -392,22 +392,17 @@ function! s:OpenHoverPreview(bufname, lines, filetype) abort
392392
endif
393393
endfunction
394394

395-
function! s:GetHoverPreviewBufnr() abort
395+
function! s:MoveIntoHoverPreview() abort
396396
for bufnr in range(1, bufnr('$'))
397397
if bufname(bufnr) ==# '__LanguageClient__'
398-
return bufnr
398+
let winnr = bufwinnr(bufnr)
399+
if winnr != -1
400+
execute winnr . 'wincmd w'
401+
endif
402+
return v:true
399403
endif
400404
endfor
401-
return -1
402-
endfunction
403-
404-
function! s:MoveIntoHoverPreview() abort
405-
let winnr = bufwinnr(s:GetHoverPreviewBufnr())
406-
if winnr == -1
407-
return v:false
408-
endif
409-
execute winnr . 'wincmd w'
410-
return v:true
405+
return v:false
411406
endfunction
412407

413408
let s:id = 1
@@ -1303,30 +1298,4 @@ function! LanguageClient#debugInfo(...) abort
13031298
return LanguageClient#Call('languageClient/debugInfo', l:params, l:Callback)
13041299
endfunction
13051300

1306-
function! LanguageClient#reopenHoverInSeparateWindow() abort
1307-
let bufnr = s:GetHoverPreviewBufnr()
1308-
if bufnr == -1
1309-
echo 'No hover found'
1310-
return
1311-
endif
1312-
1313-
let lines = nvim_buf_get_lines(bufnr, 1, -1, v:false)
1314-
let filetype = nvim_buf_get_option(bufnr, 'filetype')
1315-
let name = bufname(bufnr)
1316-
1317-
silent! autocmd! plugin-LC-neovim-close-hover
1318-
let winnr = bufwinnr(bufnr)
1319-
if winnr != -1
1320-
execute winnr . 'wincmd c'
1321-
endif
1322-
1323-
execute 'silent! noswapfile pedit!' name
1324-
wincmd P
1325-
setlocal buftype=nofile nobuflisted bufhidden=wipe nonumber norelativenumber signcolumn=no
1326-
let &filetype = filetype
1327-
call setline(1, lines)
1328-
setlocal nomodified nomodifiable
1329-
wincmd p
1330-
endfunction
1331-
13321301
let g:LanguageClient_loaded = s:Launch()

Diff for: doc/LanguageClient.txt

-7
Original file line numberDiff line numberDiff line change
@@ -633,13 +633,6 @@ Signature: LanguageClient#debugInfo(...)
633633

634634
Print out debug info.
635635

636-
*LanguageClient#reopenHoverInSeparateWindow*
637-
Signature: LanguageClient#reopenHoverInSeparateWindow()
638-
639-
When a hover is open in floating window, calling this function reopens the
640-
content in a separate preview window. This function is useful when you want to
641-
keep it open.
642-
643636
==============================================================================
644637
5. Events *LanguageClientEvents*
645638

Diff for: tests/LanguageClient_test.py

-26
Original file line numberDiff line numberDiff line change
@@ -333,29 +333,3 @@ def test_textDocument_hover_float_window_move_cursor_into_window(nvim):
333333
# Check float window buffer was closed by :close in the window
334334
assert all(
335335
b for b in nvim.buffers if not b.name.endswith("__LanguageClient__"))
336-
337-
338-
def test_textDocument_hover_float_window_reopen_in_preview_window(nvim):
339-
if not nvim.funcs.exists("*nvim_open_win"):
340-
pytest.skip("Neovim 0.3.0 or earlier does not support floating window")
341-
342-
nvim.command("edit! {}".format(PATH_INDEXJS))
343-
time.sleep(1)
344-
345-
_open_float_window(nvim)
346-
347-
try:
348-
nvim.call("LanguageClient#reopenHoverInSeparateWindow")
349-
preview_buf = next(
350-
b for b in nvim.buffers if b.name.endswith("__LanguageClient__"))
351-
352-
winnr = nvim.funcs.bufwinnr(preview_buf.number)
353-
assert winnr > 0
354-
355-
win_id = nvim.funcs.win_getid(winnr)
356-
assert win_id > 0
357-
358-
assert nvim.api.win_get_option(win_id, 'previewwindow') == 1
359-
assert nvim.api.buf_get_option(preview_buf, 'filetype') == 'markdown'
360-
finally:
361-
nvim.api.win_close(win_id, True)

0 commit comments

Comments
 (0)