diff options
author | Michael Strobel <71396679+Kibadda@users.noreply.github.com> | 2023-08-16 15:49:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-16 08:49:14 -0500 |
commit | e7801775060e2d8f9f20572fac687f438e81caa0 (patch) | |
tree | 0b8c6eefffe1dd750b1dab9453a9ef2554dc975a /test/functional/lua/diagnostic_spec.lua | |
parent | 9cb7e00b9748b08fce661f8cbeb06c5994c749ae (diff) | |
download | rneovim-e7801775060e2d8f9f20572fac687f438e81caa0.tar.gz rneovim-e7801775060e2d8f9f20572fac687f438e81caa0.tar.bz2 rneovim-e7801775060e2d8f9f20572fac687f438e81caa0.zip |
feat(diagnostic): filter diagnostics by specific severities (#24736)
Allow users to filter diagnostics by specifying severities
Diffstat (limited to 'test/functional/lua/diagnostic_spec.lua')
-rw-r--r-- | test/functional/lua/diagnostic_spec.lua | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/functional/lua/diagnostic_spec.lua b/test/functional/lua/diagnostic_spec.lua index 17b2d7da4f..27ba70f057 100644 --- a/test/functional/lua/diagnostic_spec.lua +++ b/test/functional/lua/diagnostic_spec.lua @@ -860,7 +860,7 @@ end) ]]) end) - it('returns only requested diagnostics when severity is supplied', function() + it('returns only requested diagnostics when severity range is supplied', function() eq({2, 3, 2}, exec_lua [[ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { make_error("Error 1", 1, 1, 1, 5), @@ -882,6 +882,28 @@ end) ]]) end) + it('returns only requested diagnostics when severities are supplied', function() + eq({1, 1, 2}, exec_lua [[ + vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { + make_error("Error 1", 1, 1, 1, 5), + make_warning("Warning on Server 1", 1, 1, 2, 3), + make_info("Ignored information", 1, 1, 2, 3), + make_hint("Here's a hint", 1, 1, 2, 3), + }) + + return { + #vim.diagnostic.get(diagnostic_bufnr, { severity = {vim.diagnostic.severity.WARN} }), + #vim.diagnostic.get(diagnostic_bufnr, { severity = {vim.diagnostic.severity.ERROR} }), + #vim.diagnostic.get(diagnostic_bufnr, { + severity = { + vim.diagnostic.severity.INFO, + vim.diagnostic.severity.WARN, + } + }), + } + ]]) + end) + it('allows filtering by line', function() eq(1, exec_lua [[ vim.diagnostic.set(diagnostic_ns, diagnostic_bufnr, { |