Skip to content

Commit

Permalink
fix: added error message to debug failing extmarks #117
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Dec 23, 2022
1 parent 040aeb6 commit 65e9036
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/lazy/view/text.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local Config = require("lazy.core.config")
local Util = require("lazy.util")

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

local extmark_col = extmark.col or col
extmark.col = nil
vim.api.nvim_buf_set_extmark(buf, Config.ns, l - 1, extmark_col, extmark)
local ok = pcall(vim.api.nvim_buf_set_extmark, buf, Config.ns, l - 1, extmark_col, extmark)
if not ok then
Util.error(
"Failed to set extmark. Please report a bug with this info:\n"
.. vim.inspect({ segment = segment, line = line })
)
end
end

col = col + width
Expand Down

0 comments on commit 65e9036

Please sign in to comment.