Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit ce92c8e

Browse files
committed
Clear highlighting when no remaining symbols/regions exist (#61)
1 parent 130fd41 commit ce92c8e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

autoload/lsp_cxx_hl/hl.vim

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ endfunction
6464
" Notify of new semantic highlighting symbols
6565
function! lsp_cxx_hl#hl#notify_symbols(bufnr, symbols) abort
6666
if g:lsp_cxx_hl_use_nvim_text_props
67-
if get(b:, 'lsp_cxx_hl_disabled', 0)
67+
if len(a:symbols) == 0
68+
call lsp_cxx_hl#textprop_nvim#symbols#clear(a:bufnr)
69+
elseif get(b:, 'lsp_cxx_hl_disabled', 0)
6870
call lsp_cxx_hl#hl#clear()
6971
else
7072
call lsp_cxx_hl#textprop_nvim#symbols#notify(a:bufnr, a:symbols)
7173
endif
7274
elseif g:lsp_cxx_hl_use_text_props
73-
if get(b:, 'lsp_cxx_hl_disabled', 0)
75+
if len(a:symbols) == 0
76+
call lsp_cxx_hl#textprop#symbols#clear(a:bufnr)
77+
elseif get(b:, 'lsp_cxx_hl_disabled', 0)
7478
call lsp_cxx_hl#hl#clear()
7579
else
7680
call lsp_cxx_hl#textprop#symbols#notify(a:bufnr, a:symbols)
@@ -89,13 +93,17 @@ endfunction
8993
" Notify of new preprocessor skipped regions
9094
function! lsp_cxx_hl#hl#notify_skipped(bufnr, skipped) abort
9195
if g:lsp_cxx_hl_use_nvim_text_props
92-
if get(b:, 'lsp_cxx_hl_disabled', 0)
96+
if len(a:skipped) == 0
97+
call lsp_cxx_hl#textprop_nvim#skipped#clear(a:bufnr)
98+
elseif get(b:, 'lsp_cxx_hl_disabled', 0)
9399
call lsp_cxx_hl#hl#clear()
94100
else
95101
call lsp_cxx_hl#textprop_nvim#skipped#notify(a:bufnr, a:skipped)
96102
endif
97103
elseif g:lsp_cxx_hl_use_text_props
98-
if get(b:, 'lsp_cxx_hl_disabled', 0)
104+
if len(a:skipped) == 0
105+
call lsp_cxx_hl#textprop#skipped#clear(a:bufnr)
106+
elseif get(b:, 'lsp_cxx_hl_disabled', 0)
99107
call lsp_cxx_hl#hl#clear()
100108
else
101109
call lsp_cxx_hl#textprop#skipped#notify(a:bufnr, a:skipped)

0 commit comments

Comments
 (0)