From 484a70f0c0c9109ab6825fa67e481d862237207c Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 15 Aug 2018 14:19:32 -0700 Subject: Use new-ish LSP 'relatedInformation' field for :ALEDetail --- test/lsp/test_read_lsp_diagnostics.vader | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/lsp/test_read_lsp_diagnostics.vader') diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader index df187a24..c1df55f0 100644 --- a/test/lsp/test_read_lsp_diagnostics.vader +++ b/test/lsp/test_read_lsp_diagnostics.vader @@ -140,6 +140,35 @@ Execute(ale#lsp#response#ReadDiagnostics() should handle multiple messages): \ }, \ ]}}) +Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for detail): + AssertEqual [ + \ { + \ 'type': 'E', + \ 'text': 'Something went wrong!', + \ 'lnum': 1, + \ 'col': 3, + \ 'end_lnum': 1, + \ 'end_col': 3, + \ 'relatedInformation': [{ + \ 'message': 'might be this', + \ 'location': { + \ 'uri': 'file:///tmp/someotherfile.txt', + \ 'range': { + \ 'start': { 'line': 42, 'character': 79 }, + \ 'end': { 'line': 43, 'character': 80 }, + \ } + \ } + \ }] + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(0, 2, 0, 2), + \ 'message': 'Something went wrong!', + \ 'detail': 'file:///tmp/someotherfile.txt:42:79: might be this' + \ } + \ ]}}) + Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle tsserver responses): AssertEqual \ [ -- cgit v1.2.3 From c467db3ed99dc7c911ddb1fefa9d66ac84fc76a6 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 15 Aug 2018 14:31:30 -0700 Subject: Better formatting --- test/lsp/test_read_lsp_diagnostics.vader | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/lsp/test_read_lsp_diagnostics.vader') diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader index c1df55f0..6708ad2f 100644 --- a/test/lsp/test_read_lsp_diagnostics.vader +++ b/test/lsp/test_read_lsp_diagnostics.vader @@ -165,7 +165,7 @@ Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for det \ { \ 'range': Range(0, 2, 0, 2), \ 'message': 'Something went wrong!', - \ 'detail': 'file:///tmp/someotherfile.txt:42:79: might be this' + \ 'detail': "Something went wrong!\n/tmp/someotherfile.txt:42:79:\n\tmight be this" \ } \ ]}}) -- cgit v1.2.3 From 764da48c576c2be6b6d02ae6a7f59f9167b11de3 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 15 Aug 2018 14:40:51 -0700 Subject: Test file was the wrong way around --- test/lsp/test_read_lsp_diagnostics.vader | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'test/lsp/test_read_lsp_diagnostics.vader') diff --git a/test/lsp/test_read_lsp_diagnostics.vader b/test/lsp/test_read_lsp_diagnostics.vader index 6708ad2f..d795ae29 100644 --- a/test/lsp/test_read_lsp_diagnostics.vader +++ b/test/lsp/test_read_lsp_diagnostics.vader @@ -149,6 +149,13 @@ 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" + \ } + \ ], + \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ + \ { + \ 'range': Range(0, 2, 0, 2), + \ 'message': 'Something went wrong!', \ 'relatedInformation': [{ \ 'message': 'might be this', \ 'location': { @@ -160,13 +167,6 @@ Execute(ale#lsp#response#ReadDiagnostics() should use relatedInformation for det \ } \ }] \ } - \ ], - \ ale#lsp#response#ReadDiagnostics({'params': {'uri': 'filename.ts', 'diagnostics': [ - \ { - \ 'range': Range(0, 2, 0, 2), - \ 'message': 'Something went wrong!', - \ 'detail': "Something went wrong!\n/tmp/someotherfile.txt:42:79:\n\tmight be this" - \ } \ ]}}) Execute(ale#lsp#response#ReadTSServerDiagnostics() should handle tsserver responses): -- cgit v1.2.3 From 4923d48d53a2ca64d2a125ff5ea4e4c9aa744f48 Mon Sep 17 00:00:00 2001 From: Fred Emmott Date: Wed, 15 Aug 2018 14:46:57 -0700 Subject: Correct related information line numbers from 0-based to 1-based --- test/lsp/test_read_lsp_diagnostics.vader | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/lsp/test_read_lsp_diagnostics.vader') 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}, \ } \ } \ }] -- cgit v1.2.3