Support lsp_document_symbol_detail option (#1482)

* Support `lsp_document_symbol_detail` option

to show details

* fixup! Support `lsp_document_symbol_detail` option
This commit is contained in:
Satoru Kitaguchi
2023-08-05 10:58:33 +09:00
committed by GitHub
parent 39bad0b67e
commit 2be2b07b53
3 changed files with 21 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ function! lsp#ui#vim#utils#symbols_to_loc_list(server, result) abort
\ 'filename': l:path,
\ 'lnum': l:line,
\ 'col': l:col,
\ 'text': lsp#ui#vim#utils#_get_symbol_text_from_kind(a:server, l:symbol['kind']) . ' : ' . l:symbol['name'],
\ 'text': lsp#ui#vim#utils#_get_symbol_text_from_kind(a:server, l:symbol['kind']) . ' : ' . g:lsp_document_symbol_detail ? l:symbol['detail'] : l:symbol['name'],
\ })
endif
else
@@ -84,7 +84,7 @@ function! lsp#ui#vim#utils#symbols_to_loc_list(server, result) abort
\ 'filename': l:path,
\ 'lnum': l:line,
\ 'col': l:col,
\ 'text': lsp#ui#vim#utils#_get_symbol_text_from_kind(a:server, l:symbol['kind']) . ' : ' . l:symbol['name'],
\ 'text': lsp#ui#vim#utils#_get_symbol_text_from_kind(a:server, l:symbol['kind']) . ' : ' . g:lsp_document_symbol_detail ? l:symbol['detail'] : l:symbol['name'],
\ })
if has_key(l:symbol, 'children') && !empty(l:symbol['children'])
call s:symbols_to_loc_list_children(a:server, l:path, l:list, l:symbol['children'], 1)

View File

@@ -74,6 +74,7 @@ CONTENTS *vim-lsp-contents*
g:lsp_document_highlight_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_document_symbol_detail |g:lsp_document_symbol_detail|
g:lsp_peek_alignment |g:lsp_peek_alignment|
g:lsp_preview_max_width |g:lsp_preview_max_width|
g:lsp_preview_max_height |g:lsp_preview_max_height|
@@ -951,6 +952,22 @@ g:lsp_get_supported_capabilities *g:lsp_get_supported_capabilities*
calling `lsp#default_get_supported_capabilities` from within your
function.
g:lsp_document_symbol_detail *g:lsp_document_symbol_detail*
Type: |Number|
Default: `0`
Determines whether document symbol shows details or not. Set to `1` to
show details.
Note: showing details needs to turn on setting below: >
\ 'capabilities': {
\ 'textDocument': {
\ 'documentSymbol': {
\ 'hierarchicalDocumentSymbolSupport': v:true,
\ },
\ },
\ },
g:lsp_peek_alignment *g:lsp_peek_alignment*
Type: |String|
Default: `"center"`

View File

@@ -85,6 +85,8 @@ let g:lsp_code_action_ui = get(g:, 'lsp_code_action_ui', 'preview')
let g:lsp_get_supported_capabilities = get(g:, 'lsp_get_supported_capabilities', [function('lsp#default_get_supported_capabilities')])
let g:lsp_document_symbol_detail = get(g:, 'lsp_document_symbol_detail', 0)
let g:lsp_experimental_workspace_folders = get(g:, 'lsp_experimental_workspace_folders', 0)
if g:lsp_auto_enable