From 4474a3a48bd3a7aae993013a8e8c7f75f8169fbb Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Fri, 25 Nov 2016 23:35:31 -0500 Subject: [PATCH] Add a better warning for not finding definition --- autoload/langserver/goto.vim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/autoload/langserver/goto.vim b/autoload/langserver/goto.vim index 8fade52..048ff33 100644 --- a/autoload/langserver/goto.vim +++ b/autoload/langserver/goto.vim @@ -6,16 +6,15 @@ function! langserver#goto#callback(id, data, event) abort endif if has_key(a:data, 'response') + if empty(a:data['response']['result']) + call langserver#log#log('warning', 'No definition found for: ' . string(a:data['request']), v:true) + return + endif + if type(a:data['response']['result']) == type([]) let l:parsed_data = a:data['response']['result'][0] elseif type(a:data['response']['result']) == type({}) - " Check if we have an empty dictionary - if empty(a:data['response']['result']) - call langserver#log#log('warning', 'No definition found for: ' . string(a:data['request']), v:true) - return - else - let l:parsed_data = a:data['response']['result'] - endif + let l:parsed_data = a:data['response']['result'] endif else return