Switch to v:t_ variables for type checks

This commit is contained in:
w0rp
2018-07-25 01:27:28 +01:00
parent 9f8c37e17c
commit 06132954b1
17 changed files with 84 additions and 62 deletions

View File

@@ -113,7 +113,7 @@ function! ale#completion#Filter(buffer, suggestions, prefix) abort
for l:item in a:suggestions
" A List of String values or a List of completion item Dictionaries
" is accepted here.
let l:word = type(l:item) == type('') ? l:item : l:item.word
let l:word = type(l:item) is v:t_string ? l:item : l:item.word
" Add suggestions if the suggestion starts with a case-insensitive
" match for the prefix.
@@ -133,7 +133,7 @@ function! ale#completion#Filter(buffer, suggestions, prefix) abort
" Remove suggestions with words in the exclusion List.
call filter(
\ l:filtered_suggestions,
\ 'index(l:excluded_words, type(v:val) is type('''') ? v:val : v:val.word) < 0',
\ 'index(l:excluded_words, type(v:val) is v:t_string ? v:val : v:val.word) < 0',
\)
endif
@@ -315,10 +315,10 @@ function! ale#completion#ParseLSPCompletions(response) abort
let l:item_list = []
if type(get(a:response, 'result')) is type([])
if type(get(a:response, 'result')) is v:t_list
let l:item_list = a:response.result
elseif type(get(a:response, 'result')) is type({})
\&& type(get(a:response.result, 'items')) is type([])
elseif type(get(a:response, 'result')) is v:t_dict
\&& type(get(a:response.result, 'items')) is v:t_list
let l:item_list = a:response.result.items
endif