From ee70b2e9848d94e091cefd59ab8f95d3957522dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Heinrich?= Date: Fri, 1 Apr 2022 16:00:49 +0200 Subject: [PATCH 1/2] fix(definition_preview): empty check now checks as many nested tables as necessary to find a result --- lua/lspsaga/libs.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/lspsaga/libs.lua b/lua/lspsaga/libs.lua index 9cf403b..5443512 100644 --- a/lua/lspsaga/libs.lua +++ b/lua/lspsaga/libs.lua @@ -70,16 +70,20 @@ function libs.result_isempty(res) end for _, v in pairs(res) do if next(v) == nil then - return true + goto continue end if not v.result then - return true + goto continue end if next(v.result) == nil then - return true + goto continue end + if next(v.result) ~= nil then + return false + end + ::continue:: end - return false + return true end function libs.split_by_pathsep(text, start_pos) From 210af69c36cfa6edbad48d81583468c861a12f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Heinrich?= Date: Sat, 2 Apr 2022 17:42:10 +0200 Subject: [PATCH 2/2] fix(lsp_finder): ignore definition responses with emtpy result tables --- lua/lspsaga/provider.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lspsaga/provider.lua b/lua/lspsaga/provider.lua index 4ecdffe..aa95edb 100644 --- a/lua/lspsaga/provider.lua +++ b/lua/lspsaga/provider.lua @@ -35,7 +35,7 @@ local send_request = function(timeout) for i, response in ipairs(responses) do if type(response) == "table" then for _, res in pairs(response) do - if res.result then + if res.result and next(res.result) ~= nil then coroutine.yield(res.result, i) end end