commit e85e7fc7bcccfa3b8f9e52ec4d6cb21591b50468
parent c7e7f1d4b4b62c75bb54e652f25c6c6b8785a7f4
Author: Jaehwang Jung <tomtomjhj@gmail.com>
Date: Wed, 28 Jun 2023 03:05:44 +0900
fix(treesitter): handle empty region when logging (#24173)
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
@@ -447,6 +447,9 @@ end
---@private
---@param region Range6[]
local function region_tostr(region)
+ if #region == 0 then
+ return '[]'
+ end
local srow, scol = region[1][1], region[1][2]
local erow, ecol = region[#region][4], region[#region][5]
return string.format('[%d:%d-%d:%d]', srow, scol, erow, ecol)