From 8698c44e2a65357518eb59d0f5e33498082a3198 Mon Sep 17 00:00:00 2001 From: Donnie West Date: Thu, 17 Oct 2019 21:16:04 -0500 Subject: [PATCH] Fix tsserver not returning details for items with empty source --- autoload/ale/completion.vim | 13 ++++++++++--- test/completion/test_lsp_completion_messages.vader | 2 -- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index a15ca514..8b29d848 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -492,10 +492,17 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort let l:identifiers = [] for l:name in l:names - call add(l:identifiers, { + let l:identifier = { \ 'name': l:name.word, - \ 'source': get(l:name, 'source', ''), - \}) + \} + let l:source = get(l:name, 'source', '') + + " Empty source results in no details for the completed item + if !empty(l:source) + call extend(l:identifier, { 'source': l:source }) + endif + + call add(l:identifiers, l:identifier) endfor let b:ale_completion_info.request_id = ale#lsp#Send( diff --git a/test/completion/test_lsp_completion_messages.vader b/test/completion/test_lsp_completion_messages.vader index b997ac86..4b7392f5 100644 --- a/test/completion/test_lsp_completion_messages.vader +++ b/test/completion/test_lsp_completion_messages.vader @@ -190,10 +190,8 @@ Execute(The right message sent to the tsserver LSP when the first completion mes \ 'source': '/path/to/foo.ts', \ }, { \ 'name': 'FooBar', - \ 'source': '', \ }, { \ 'name': 'frazzle', - \ 'source': '', \ }], \ 'offset': 1, \ 'line': 1,