From c9f34ac179231239debae627ca01c0c376dba56d Mon Sep 17 00:00:00 2001 From: ray-x Date: Mon, 31 Jan 2022 23:30:59 +1100 Subject: [PATCH] check doc highlight --- lua/navigator/dochighlight.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/navigator/dochighlight.lua b/lua/navigator/dochighlight.lua index 9c5344e..a00cbde 100644 --- a/lua/navigator/dochighlight.lua +++ b/lua/navigator/dochighlight.lua @@ -124,6 +124,9 @@ end -- returns r1 < r2 based on start of range local function before(r1, r2) + if not r1 or not r2 then + return false + end if r1.start.line < r2.start.line then return true end @@ -142,7 +145,7 @@ local handle_document_highlight = mk_handler(function(_, result, ctx) log('ducment highlight error', result, ctx) return end - if type(result) ~= 'table' then + if type(result) ~= 'table' or vim.fn.empty(result) == 1 then log('clear up', result) vim.lsp.util.buf_clear_references(ctx.bufnr) return