Skip to content

Commit ee2bb88

Browse files
authored
Set meaningful title to QuickFix window instead of :setqflist() (#1502)
fixes #293 fixes #1483
1 parent c58edb9 commit ee2bb88

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

autoload/lsp/ui/vim.vim

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,7 @@ function! s:handle_symbol(server, last_command_id, type, data) abort
270270

271271
let l:list = lsp#ui#vim#utils#symbols_to_loc_list(a:server, a:data)
272272

273-
if has('patch-8.2.2147')
274-
call setqflist(l:list)
275-
call setqflist([], 'a', {'title': a:type})
276-
else
277-
call setqflist([])
278-
call setqflist(l:list)
279-
endif
273+
call lsp#ui#vim#utils#setqflist(l:list, a:type)
280274

281275
if empty(l:list)
282276
call lsp#utils#error('No ' . a:type .' found')
@@ -319,8 +313,7 @@ function! s:handle_location(ctx, server, type, data) abort "ctx = {counter, list
319313
let l:level = count(l:parent[l:pos-1].text, g:lsp_tree_incoming_prefix)
320314
let a:ctx['list'] = extend(l:parent, map(a:ctx['list'], 'extend(v:val, {"text": repeat("' . g:lsp_tree_incoming_prefix . '", l:level+1) . v:val.text})'), l:pos)
321315
endif
322-
call setqflist([])
323-
call setqflist(a:ctx['list'])
316+
call lsp#ui#vim#utils#setqflist(a:ctx['list'], a:type)
324317
echo 'Retrieved ' . a:type
325318
botright copen
326319
if get(a:ctx, 'add_tree', v:false)
@@ -540,8 +533,7 @@ function! s:handle_call_hierarchy(ctx, server, type, data) abort
540533
let l:level = count(l:parent[l:pos-1].text, g:lsp_tree_incoming_prefix)
541534
let a:ctx['list'] = extend(l:parent, map(a:ctx['list'], 'extend(v:val, {"text": repeat("' . g:lsp_tree_incoming_prefix . '", l:level+1) . v:val.text})'), l:pos)
542535
endif
543-
call setqflist([])
544-
call setqflist(a:ctx['list'])
536+
call lsp#ui#vim#utils#setqflist(a:ctx['list'], a:type)
545537
echo 'Retrieved ' . a:type
546538
botright copen
547539
if get(a:ctx, 'add_tree', v:false)

autoload/lsp/ui/vim/utils.vim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,13 @@ endfunction
162162
function! s:get_diagnostic_severity_text(severity) abort
163163
return s:diagnostic_severity[a:severity]
164164
endfunction
165+
166+
function! lsp#ui#vim#utils#setqflist(list, type) abort
167+
if has('patch-8.2.2147')
168+
call setqflist(a:list)
169+
call setqflist([], 'a', {'title': a:type})
170+
else
171+
call setqflist([])
172+
call setqflist(a:list)
173+
endif
174+
endfunction

0 commit comments

Comments
 (0)