diff options
author | Mathias Fußenegger <mfussenegger@users.noreply.github.com> | 2020-11-14 20:39:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-14 14:39:05 -0500 |
commit | 0798ad3a3a071db1b647df5aecd7698ed9aff7d9 (patch) | |
tree | b4765f09d44759356246ccf0acb984a8447494ba /test/functional/plugin/lsp/diagnostic_spec.lua | |
parent | 27d630926cab78511075159012ce6ac920d8747e (diff) | |
download | rneovim-0798ad3a3a071db1b647df5aecd7698ed9aff7d9.tar.gz rneovim-0798ad3a3a071db1b647df5aecd7698ed9aff7d9.tar.bz2 rneovim-0798ad3a3a071db1b647df5aecd7698ed9aff7d9.zip |
lsp: Expose all diagnostics (#13285)
* lsp: Remove duplicate `diagnostics` fallback in diagnostic.display
* lsp: Expose all diagnostics
Before the changes in #12655 it was possible to retrieve all diagnostics
via `vim.lsp.util.diagnostics_by_buf`.
This adds a `diagnostic.get_all()` to enable users to retrieve all
diagnostics.
Use cases for that could include loading all diagnostics into the
quickfix list, or to build an enhanced goto_next that can move across
buffers.
Diffstat (limited to 'test/functional/plugin/lsp/diagnostic_spec.lua')
-rw-r--r-- | test/functional/plugin/lsp/diagnostic_spec.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/functional/plugin/lsp/diagnostic_spec.lua b/test/functional/plugin/lsp/diagnostic_spec.lua index 0fb55da4bd..11b2beba7a 100644 --- a/test/functional/plugin/lsp/diagnostic_spec.lua +++ b/test/functional/plugin/lsp/diagnostic_spec.lua @@ -67,6 +67,22 @@ 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 [[ + vim.lsp.diagnostic.save( + { + make_error('Diagnostic #1', 1, 1, 1, 1), + make_error('Diagnostic #2', 2, 1, 2, 1), + }, 0, 1 + ) + vim.lsp.diagnostic.save( + { + make_error('Diagnostic #3', 3, 1, 3, 1), + }, 1, 2 + ) + return #vim.lsp.diagnostic.get_all() + ]]) + end) it('should be able to save and count a single client error', function() eq(1, exec_lua [[ vim.lsp.diagnostic.save( |