Files
vim-lsp-mirror/autoload/lsp/utils/args.vim
Prabir Shrestha 6bb6069f94 Diagnostics for all buffers (#982)
* render diagnostics in loclist and fix args paser
* document --buffers flag for LspDocumentDiagnostics
* do not show diagnostics if it is disabled for buffer
* remove old code and fix plug mapping for lsp-document-diagnostics
* add unit tests for document diagnostics command
2020-12-27 22:44:18 -08:00

26 lines
860 B
VimL

function! lsp#utils#args#_parse(args, opt) abort
let l:result = {}
for l:item in split(a:args, ' ')
let l:parts = split(l:item, '=')
let l:key = l:parts[0]
let l:value = get(l:parts, 1, '')
let l:key = l:key[2:]
if has_key(a:opt, l:key)
if has_key(a:opt[l:key], 'type')
let l:type = a:opt[l:key]['type']
if l:type == type(v:true)
if l:value ==# 'false' || l:value ==# '0' || l:value ==# ''
let l:value = 0
else
let l:value = 1
endif
elseif l:type ==# type(0)
let l:value = str2nr(l:value)
endif
endif
endif
let l:result[l:key] = l:value
endfor
return l:result
endfunction