summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Emmott <fe@fb.com>2018-08-15 14:46:57 -0700
committerFred Emmott <fe@fb.com>2018-08-15 14:46:57 -0700
commit4923d48d53a2ca64d2a125ff5ea4e4c9aa744f48 (patch)
tree05c7ad4c27e75f0a9ae46298890b305910500f79
parent764da48c576c2be6b6d02ae6a7f59f9167b11de3 (diff)
downloadale-4923d48d53a2ca64d2a125ff5ea4e4c9aa744f48.zip
Correct related information line numbers from 0-based to 1-based
-rw-r--r--autoload/ale/lsp/response.vim5
-rw-r--r--test/lsp/test_read_lsp_diagnostics.vader4
2 files changed, 5 insertions, 4 deletions
diff --git a/autoload/ale/lsp/response.vim b/autoload/ale/lsp/response.vim
index 4b895ac7..69e88d56 100644
--- a/autoload/ale/lsp/response.vim
+++ b/autoload/ale/lsp/response.vim
@@ -59,10 +59,11 @@ function! ale#lsp#response#ReadDiagnostics(response) abort
let l:related = deepcopy(l:diagnostic.relatedInformation)
call map(l:related, {key, val ->
\ ale#path#FromURI(val.location.uri) .
- \ ':' . val.location.range.start.line . ':' . val.location.range.start.character .
+ \ ':' . (val.location.range.start.line + 1) .
+ \ ':' . (val.location.range.start.character + 1) .
\ ":\n\t" . val.message
\ })
- let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n") . "\n"
+ let l:loclist_item.detail = l:diagnostic.message . "\n" . join(l:related, "\n")
endif
call add(l:loclist, l:loclist_item)
diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader
index d795ae29..be50fbe8 100644
--- a/test/lsp/test_read_lsp_diagnostics.vader
+++ b/test/lsp/test_read_lsp_diagnostics.vader
@@ -149,7 +149,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for det
\ 'col': 3,
\ 'end_lnum': 1,
\ 'end_col': 3,
- \ 'detail': "Something went wrong!\n/tmp/someotherfile.txt:42:79:\n\tmight be this"
+ \ 'detail': "Something went wrong!\n/tmp/someotherfile.txt:43:80:\n\tmight be this"
\ }
\ ],
\ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [
@@ -162,7 +162,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for det
\ 'uri': 'file:///tmp/someotherfile.txt',
\ 'range': {
\ 'start': { 'line': 42, 'character': 79 },
- \ 'end': { 'line': 43, 'character': 80 },
+ \ 'end': { 'line': 142, 'character': 179},
\ }
\ }
\ }]