Skip to content

Commit 65e9036

Browse files
committed
fix: added error message to debug failing extmarks #117
1 parent 040aeb6 commit 65e9036

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lua/lazy/view/text.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local Config = require("lazy.core.config")
2+
local Util = require("lazy.util")
23

34
---@alias TextSegment {str: string, hl?:string|Extmark}
45
---@alias Extmark {hl_group?:string, col?:number, end_col?:number}
@@ -86,7 +87,13 @@ function Text:render(buf)
8687

8788
local extmark_col = extmark.col or col
8889
extmark.col = nil
89-
vim.api.nvim_buf_set_extmark(buf, Config.ns, l - 1, extmark_col, extmark)
90+
local ok = pcall(vim.api.nvim_buf_set_extmark, buf, Config.ns, l - 1, extmark_col, extmark)
91+
if not ok then
92+
Util.error(
93+
"Failed to set extmark. Please report a bug with this info:\n"
94+
.. vim.inspect({ segment = segment, line = line })
95+
)
96+
end
9097
end
9198

9299
col = col + width

0 commit comments

Comments
 (0)