Skip to content

Commit 04bdd56

Browse files
authored
add feature to customize highlight for floating hover window (#966)
* add g:LanguageClient_floatingHoverHighlight * make g:LanguageClient_floatingHoverHighlight accept arbitrary highlights
1 parent 148880c commit 04bdd56

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

autoload/LanguageClient.vim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ function! s:AddHighlights(source, highlights) abort
259259
endfunction
260260

261261
" Get an variable value.
262-
" Get variable from uffer local, or else global, or else default, or else v:null.
262+
" Get variable from buffer local, or else global, or else default, or else v:null.
263263
function! s:GetVar(...) abort
264264
let name = a:1
265265

@@ -404,7 +404,8 @@ function! s:OpenHoverPreview(bufname, lines, filetype) abort
404404

405405
execute 'noswapfile edit!' a:bufname
406406

407-
setlocal winhl=Normal:CursorLine
407+
let float_win_highlight = s:GetVar('LanguageClient_floatingHoverHighlight', 'Normal:CursorLine')
408+
execute printf('setlocal winhl=%s', float_win_highlight)
408409
elseif display_approach ==# 'popup_win'
409410
let pop_win_id = popup_atcursor(a:lines, {})
410411
call setbufvar(winbufnr(pop_win_id), '&filetype', a:filetype)

doc/LanguageClient.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,13 @@ supported. Check by running >
358358
Default: 1 when a floating window is supported, otherwise 0
359359
Valid Options: 1 | 0
360360

361-
2.26 g:LanguageClient_usePopupHover *g:LanguageClient_usePopupHover*
361+
2.27 g:LanguageClient_floatingHoverHighlight *g:LanguageClient_floatingHoverHighlight*
362+
363+
Control how floating window hover highlights are displayed.
364+
365+
Default: Normal:CursorLine
366+
367+
2.28 g:LanguageClient_usePopupHover *g:LanguageClient_usePopupHover*
362368

363369
When the value is set to 1, |LanguageClient#textDocument_hover()| opens
364370
documentation in a popup window instead of preview.
@@ -369,7 +375,7 @@ supported, which is supported only in vim 8.2+. Check by running >
369375
Default: 1 when a popup window is supported, otherwise 0
370376
Valid Options: 1 | 0
371377

372-
2.27 g:LanguageClient_virtualTextPrefix *g:LanguageClient_virtualTextPrefix*
378+
2.29 g:LanguageClient_virtualTextPrefix *g:LanguageClient_virtualTextPrefix*
373379

374380
When the value is set to a valid string and |g:LanguageClient_useVirtualText| is
375381
enabled, all virtual text lines are prefixed with the defined string.
@@ -379,14 +385,14 @@ supported.
379385
Default: Empty string ('')
380386
Valid Options: string
381387

382-
2.28 g:LanguageClient_diagnosticsMaxSeverity *g:LanguageClient_diagnosticsMaxSeverity*
388+
2.30 g:LanguageClient_diagnosticsMaxSeverity *g:LanguageClient_diagnosticsMaxSeverity*
383389

384390
Maximum severity to show diagnostic messages.
385391

386392
Default: "Hint"
387393
Valid options: "Error" | "Warning" | "Information" | "Hint"
388394

389-
2.29 g:LanguageClient_echoProjectRoot *g:LanguageClient_echoProjectRoot*
395+
2.31 g:LanguageClient_echoProjectRoot *g:LanguageClient_echoProjectRoot*
390396

391397
Whether to echo messages in vim of the form: "Project root: /home/user/myproject" when
392398
the root of a project is detected using g:LanguageClient_rootMarkers.

0 commit comments

Comments
 (0)