mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
Add g:lsp_virtual_text_prefix option (#521)
This option allows prepending characters or text to the diagnostics which are display as virtual text. It allows virtual text to be differentiated from the code
This commit is contained in:
committed by
Thomas Faingnaert
parent
47a883d7b2
commit
dd584dfcbf
@@ -81,7 +81,8 @@ function! s:place_virtual(server_name, path, diagnostics) abort
|
||||
|
||||
let l:name = get(s:severity_sign_names_mapping, l:item['severity'], 'LspError')
|
||||
let l:hl_name = l:name . 'Text'
|
||||
call nvim_buf_set_virtual_text(l:bufnr, l:ns, l:line, [[l:item['message'], l:hl_name]], {})
|
||||
call nvim_buf_set_virtual_text(l:bufnr, l:ns, l:line,
|
||||
\ [[g:lsp_virtual_text_prefix . l:item['message'], l:hl_name]], {})
|
||||
endfor
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -349,6 +349,19 @@ g:lsp_virtual_text_enabled *g:lsp_virtual_text_enable
|
||||
let g:lsp_virtual_text_enabled = 0
|
||||
<
|
||||
|
||||
g:lsp_virtual_text_prefix *g:lsp_virtual_text_prefix*
|
||||
Type: |String|
|
||||
Default: `""` for neovim 0.3+
|
||||
|
||||
Adds the prefix to the diagnostics to be shown as virtual text. Requires
|
||||
NeoVim with version 0.3 or newer.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:lsp_virtual_text_prefix = "> "
|
||||
let g:lsp_virtual_text_prefix = " ‣ "
|
||||
<
|
||||
|
||||
g:lsp_highlights_enabled *g:lsp_highlights_enabled*
|
||||
Type: |Number|
|
||||
Default: `1` for neovim 0.3+
|
||||
|
||||
@@ -11,6 +11,7 @@ let g:lsp_debug_servers = get(g:, 'lsp_debug_servers', [])
|
||||
let g:lsp_signs_enabled = get(g:, 'lsp_signs_enabled', exists('*sign_define') && (has('nvim') || has('patch-8.1.0772')))
|
||||
let g:lsp_signs_priority = get(g:, 'lsp_signs_priority', 10)
|
||||
let g:lsp_virtual_text_enabled = get(g:, 'lsp_virtual_text_enabled', exists('*nvim_buf_set_virtual_text'))
|
||||
let g:lsp_virtual_text_prefix = get(g:, 'lsp_virtual_text_prefix', '')
|
||||
let g:lsp_highlights_enabled = get(g:, 'lsp_highlights_enabled', exists('*nvim_buf_add_highlight'))
|
||||
let g:lsp_textprop_enabled = get(g:, 'lsp_textprop_enabled', exists('*prop_add') && !g:lsp_highlights_enabled)
|
||||
let g:lsp_signs_error = get(g:, 'lsp_signs_error', {})
|
||||
|
||||
Reference in New Issue
Block a user