summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <RyanSquared@users.noreply.github.com>2018-11-30 09:36:37 -0600
committerGitHub <noreply@github.com>2018-11-30 09:36:37 -0600
commit8176f79fa1a0bbfd64662bc45675d49de2694bbd (patch)
treebb8145e69bf1bcb8968b29cb1a68c47ceb83674d
parent0a384a49d371838903d8401c5358ec60f3f4266d (diff)
parentd2b0ae8108b2ee395d4eb43c49d68b322a023a30 (diff)
downloadale-8176f79fa1a0bbfd64662bc45675d49de2694bbd.zip
Merge pull request #1734 from sridhars/master
Add language server source in ALEDetail
-rw-r--r--autoload/ale/lsp/response.vim4
-rw-r--r--test/lsp/test_read_lsp_diagnostics.vader21
2 files changed, 24 insertions, 1 deletions
diff --git a/autoload/ale/lsp/response.vim b/autoload/ale/lsp/response.vim
index 69e88d56..08b36808 100644
--- a/autoload/ale/lsp/response.vim
+++ b/autoload/ale/lsp/response.vim
@@ -66,6 +66,10 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n")
endif
+ if has_key(l:diagnostic, 'source')
+ let l:loclist_item.detail = printf('[%s] %s', l:diagnostic.source, l:diagnostic.message)
+ endif
+
call add(l:loclist, l:loclist_item)
endfor
diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader
index be50fbe8..a5c5ded3 100644
--- a/test/lsp/test_read_lsp_diagnostics.vader
+++ b/test/lsp/test_read_lsp_diagnostics.vader
@@ -89,6 +89,26 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle messages without codes)
\ },
\ ]}})
+Execute(ale#lsp#response#ReadDiagnostics() should include sources in detail):
+ AssertEqual [
+ \ {
+ \ 'type': 'E',
+ \ 'text': 'Something went wrong!',
+ \ 'detail': '[tslint] Something went wrong!',
+ \ 'lnum': 10,
+ \ 'col': 15,
+ \ 'end_lnum': 12,
+ \ 'end_col': 23,
+ \ }
+ \ ],
+ \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
+ \ {
+ \ 'range': Range(9, 14, 11, 22),
+ \ 'message': 'Something went wrong!',
+ \ 'source': 'tslint',
+ \ }
+ \ ]}})
+
Execute(ale#lsp#response#ReadDiagnostics() should consider -1 to be a meaningless code):
AssertEqual [
\ {
@@ -108,7 +128,6 @@ Execute(ale#lsp#response#ReadDiagnostics() should consider -1 to be a meaningles
\ },
\ ]}})
-
Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages):
AssertEqual [
\ {