From 40c8d2fc2b729dd442eda093cf8c9496d6e23732 Mon Sep 17 00:00:00 2001 From: Charles Moscofian Date: Wed, 20 Sep 2023 01:55:48 +0200 Subject: [PATCH] fix: only validate severity table when using a range (#2709) The only possibility for having a table with different severities to pass to `vim.diagnostics.get()` as opts is when setting a range (limit and bound), so just check for an empty table when a range is set. --- lua/telescope/builtin/__diagnostics.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/telescope/builtin/__diagnostics.lua b/lua/telescope/builtin/__diagnostics.lua index 10ea463..e55a130 100644 --- a/lua/telescope/builtin/__diagnostics.lua +++ b/lua/telescope/builtin/__diagnostics.lua @@ -86,9 +86,9 @@ local diagnostics_to_tbl = function(opts) if opts.severity_bound ~= nil then diagnosis_opts.severity["max"] = opts.severity_bound end - end - if vim.version().minor > 9 and vim.tbl_isempty(diagnosis_opts.severity) then - diagnosis_opts.severity = nil + if vim.version().minor > 9 and vim.tbl_isempty(diagnosis_opts.severity) then + diagnosis_opts.severity = nil + end end opts.root_dir = opts.root_dir == true and vim.loop.cwd() or opts.root_dir