Handle LSP codes for %code% in message formats

fixes #1767
This commit is contained in:
Fred Emmott
2018-07-30 15:19:59 -07:00
parent 16d0c52d24
commit 2768bf15ba
5 changed files with 27 additions and 5 deletions

View File

@@ -47,7 +47,12 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
endif
if has_key(l:diagnostic, 'code')
let l:loclist_item.nr = l:diagnostic.code
if type(l:diagnostic.code) == v:t_string
let l:loclist_item.code = l:diagnostic.code
elseif type(l:diagnostic.code) == v:t_number && l:diagnostic.code != -1
let l:loclist_item.code = string(l:diagnostic.code)
let l:loclist_item.nr = l:diagnostic.code
endif
endif
call add(l:loclist, l:loclist_item)
@@ -70,7 +75,12 @@ function! ale#lsp#response#ReadTSServerDiagnostics(response) abort
\}
if has_key(l:diagnostic, 'code')
let l:loclist_item.nr = l:diagnostic.code
if type(l:diagnostic.code) == v:t_string
let l:loclist_item.code = l:diagnostic.code
elseif type(l:diagnostic.code) == v:t_number && l:diagnostic.code != -1
let l:loclist_item.code = string(l:diagnostic.code)
let l:loclist_item.nr = l:diagnostic.code
endif
endif
if get(l:diagnostic, 'category') is# 'warning'