mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-17 23:44:17 +08:00
Switch to v:t_ variables for type checks
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user