From f5e0f17968eae6770cc0da136d8c9a4b23bc6da2 Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Thu, 3 Dec 2020 20:22:15 +0100 Subject: lsp: Change diagnosticg.get_all to return {bufnr: Diagnostic[]} (#13310) Allows users to associate the diagnostics with the right bufnr. --- test/functional/plugin/lsp/diagnostic_spec.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'test/functional/plugin') diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua index 11b2beba7a..3a676359ab 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -68,20 +68,23 @@ describe('vim.lsp.diagnostic', function() describe('vim.lsp.diagnostic', function() describe('handle_publish_diagnostics', function() it('should be able to retrieve diagnostics from all buffers and clients', function() - eq(3, exec_lua [[ + local result = exec_lua [[ vim.lsp.diagnostic.save( { make_error('Diagnostic #1', 1, 1, 1, 1), make_error('Diagnostic #2', 2, 1, 2, 1), - }, 0, 1 + }, 1, 1 ) vim.lsp.diagnostic.save( { make_error('Diagnostic #3', 3, 1, 3, 1), - }, 1, 2 + }, 2, 2 ) - return #vim.lsp.diagnostic.get_all() - ]]) + return vim.lsp.diagnostic.get_all() + ]] + eq(2, #result) + eq(2, #result[1]) + eq('Diagnostic #1', result[1][1].message) end) it('should be able to save and count a single client error', function() eq(1, exec_lua [[ @@ -153,7 +156,6 @@ describe('vim.lsp.diagnostic', function() } ]]) end) - it('should handle one server clearing highlights while the other still has highlights', function() -- 1 Error (1) -- 1 Warning (2) -- cgit