summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorFred Emmott <fe@fb.com>2018-07-30 15:19:59 -0700
committerFred Emmott <fe@fb.com>2018-08-02 09:06:48 -0700
commit2768bf15ba5ca95f126405459c4a8180e814af18 (patch)
tree49ac9e30790dc36498bf6dcd915e1031f86e0ce3 /autoload
parent16d0c52d24e8948b8bd8030e3fd112e0b6361c06 (diff)
downloadale-2768bf15ba5ca95f126405459c4a8180e814af18.zip
Handle LSP codes for `%code%` in message formats
fixes #1767
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/lsp/response.vim14
1 files changed, 12 insertions, 2 deletions
diff --git a/autoload/ale/lsp/response.vim b/autoload/ale/lsp/response.vim
index 48740ad1..b389ab18 100644
--- a/autoload/ale/lsp/response.vim
+++ b/autoload/ale/lsp/response.vim
@@ -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'