Rename to highlight_references to document_highlight to match lsp (#968)

* rename highlight_references to document_highlight
* add dynamicRegistration to false for documentHighlight client capabilities
This commit is contained in:
Prabir Shrestha
2020-12-24 00:12:45 -08:00
committed by GitHub
parent 42c9618928
commit f9c8184c74
4 changed files with 22 additions and 19 deletions

View File

@@ -64,8 +64,8 @@ function! lsp#enable() abort
call lsp#ui#vim#signature_help#setup()
endif
call lsp#ui#vim#completion#_setup()
call lsp#internal#document_highlight#_enable()
call lsp#internal#diagnostics#_enable()
call lsp#internal#highlight_references#_enable()
call lsp#internal#show_message_request#_enable()
call s:register_events()
endfunction
@@ -80,8 +80,8 @@ function! lsp#disable() abort
call lsp#ui#vim#diagnostics#textprop#disable()
call lsp#ui#vim#signature_help#_disable()
call lsp#ui#vim#completion#_disable()
call lsp#internal#document_highlight#_disable()
call lsp#internal#diagnostics#_disable()
call lsp#internal#highlight_references#_disable()
call lsp#internal#show_message_request#_disable()
call s:unregister_events()
let s:enabled = 0
@@ -484,6 +484,9 @@ function! lsp#default_get_supported_capabilities(server_info) abort
\ 'dynamicRegistration': v:false,
\ 'linkSupport' : v:true
\ },
\ 'documentHighlight': {
\ 'dynamicRegistration': v:false,
\ },
\ 'documentSymbol': {
\ 'dynamicRegistration': v:false,
\ 'symbolKind': {

View File

@@ -1,9 +1,9 @@
let s:use_vim_textprops = has('textprop') && !has('nvim')
let s:prop_id = 11
function! lsp#internal#highlight_references#_enable() abort
function! lsp#internal#document_highlight#_enable() abort
" don't event bother registering if the feature is disabled
if !g:lsp_highlight_references_enabled | return | endif
if !g:lsp_document_highlight_enabled | return | endif
" Highlight group for references
if !hlexists('lspReference')
@@ -24,8 +24,8 @@ function! lsp#internal#highlight_references#_enable() abort
\ lsp#callbag#tap({_ -> s:clear_highlights() }),
\ )
\ ),
\ lsp#callbag#filter({_ -> g:lsp_highlight_references_enabled }),
\ lsp#callbag#debounceTime(g:lsp_highlight_references_delay),
\ lsp#callbag#filter({_ -> g:lsp_document_highlight_enabled }),
\ lsp#callbag#debounceTime(g:lsp_document_highlight_delay),
\ lsp#callbag#map({_->{'bufnr': bufnr('%'), 'curpos': getcurpos()[0:2], 'changedtick': b:changedtick }}),
\ lsp#callbag#distinctUntilChanged({a,b -> a['bufnr'] == b['bufnr'] && a['curpos'] == b['curpos'] && a['changedtick'] == b['changedtick']}),
\ lsp#callbag#filter({_->mode() is# 'n' && getbufvar(bufnr('%'), '&buftype') !=# 'terminal' }),
@@ -45,7 +45,7 @@ function! lsp#internal#highlight_references#_enable() abort
\)
endfunction
function! lsp#internal#highlight_references#_disable() abort
function! lsp#internal#document_highlight#_disable() abort
if exists('s:Dispose')
call s:Dispose()
unlet s:Dispose
@@ -193,7 +193,7 @@ function! s:init_reference_highlight(buf) abort
endfunction
" Cyclically move between references by `offset` occurrences.
function! lsp#internal#highlight_references#jump(offset) abort
function! lsp#internal#document_highlight#jump(offset) abort
if s:use_vim_textprops && !exists('b:lsp_reference_positions') || !exists('w:lsp_reference_positions')
echohl WarningMsg
echom 'References not available'

View File

@@ -37,8 +37,8 @@ CONTENTS *vim-lsp-contents*
g:lsp_highlights_enabled |g:lsp_highlights_enabled|
g:lsp_textprop_enabled |g:lsp_textprop_enabled|
g:lsp_use_event_queue |g:lsp_use_event_queue|
g:lsp_highlight_references_enabled |g:lsp_highlight_references_enabled|
g:lsp_highlight_references_delay |g:lsp_highlight_references_delay|
g:lsp_document_higlight_enabled |g:lsp_document_highlight_enabled|
g:lsp_document_highlight_delay |g:lsp_document_highlight_delay|
g:lsp_get_supported_capabilities |g:lsp_get_supported_capabilities|
g:lsp_peek_alignment |g:lsp_peek_alignment|
g:lsp_preview_max_width |g:lsp_preview_max_width|
@@ -607,15 +607,15 @@ g:lsp_use_event_queue *g:lsp_use_event_queue*
let g:lsp_use_event_queue = 1
let g:lsp_use_event_queue = 0
g:lsp_highlight_references_enabled *g:lsp_highlight_references_enabled*
g:lsp_document_highlight_enabled *g:lsp_document_highlight_enabled*
Type: |Number|
Default: `1`
Enable highlighting of the references to the symbol under the cursor.
Example: >
let g:lsp_highlight_references_enabled = 1
let g:lsp_highlight_references_enabled = 0
let g:lsp_document_highlight_enabled = 1
let g:lsp_document_highlight_enabled = 0
<
To change the style of the highlighting, you can set or link the
@@ -624,16 +624,16 @@ g:lsp_highlight_references_enabled *g:lsp_highlight_references_enabled*
Example: >
highlight lspReference ctermfg=red guifg=red ctermbg=green guibg=green
g:lsp_highlight_references_delay *g:lsp_highlight_references_delay*
g:lsp_document_highlight_delay *g:lsp_document_highlight_delay*
Type: |Number|
Default: `350`
Delay milliseconds to highlight references. Requires
|g:lsp_highlight_references_enabled| set to 1.
|g:lsp_document_highlight_enabled| set to 1.
Example: >
let g:lsp_highlight_references_delay = 200
let g:lsp_highlight_references_delay = 1000
let g:lsp_document_highlight_delay = 200
let g:lsp_document_highlight_delay = 1000
g:lsp_get_supported_capabilities *g:lsp_get_supported_capabilities*
Type: |List|

View File

@@ -35,8 +35,8 @@ let g:lsp_preview_keep_focus = get(g:, 'lsp_preview_keep_focus', 1)
let g:lsp_use_event_queue = get(g:, 'lsp_use_event_queue', has('nvim') || has('patch-8.1.0889'))
let g:lsp_insert_text_enabled= get(g:, 'lsp_insert_text_enabled', 1)
let g:lsp_text_edit_enabled = get(g:, 'lsp_text_edit_enabled', has('patch-8.0.1493'))
let g:lsp_highlight_references_enabled = get(g:, 'lsp_highlight_references_enabled', 1)
let g:lsp_highlight_references_delay = get(g:, 'lsp_highlight_references_delay', 350)
let g:lsp_document_highlight_enabled = get(g:, 'lsp_document_highlight_enabled', 1)
let g:lsp_document_highlight_delay = get(g:, 'lsp_document_highlight_delay', 350)
let g:lsp_preview_float = get(g:, 'lsp_preview_float', 1)
let g:lsp_preview_autoclose = get(g:, 'lsp_preview_autoclose', 1)
let g:lsp_preview_doubletap = get(g:, 'lsp_preview_doubletap', [function('lsp#ui#vim#output#focuspreview')])