From f30ae17f508c12ee43a673d902ab50b75119f45c Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Thu, 30 Nov 2023 14:48:25 +0800 Subject: [PATCH] fix: prevent try to display lines on invalid buffer --- lua/lsp-lens/lens-util.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lsp-lens/lens-util.lua b/lua/lsp-lens/lens-util.lua index 9818425..8baeae6 100644 --- a/lua/lsp-lens/lens-util.lua +++ b/lua/lsp-lens/lens-util.lua @@ -156,6 +156,9 @@ local function normalize_rangeStart_character(bufnr, query) end local function display_lines(bufnr, query_results) + if vim.fn.bufexists(bufnr) == 0 then + return + end local ns_id = vim.api.nvim_create_namespace("lsp-lens") delete_existing_lines(bufnr, ns_id) for _, query in pairs(query_results or {}) do