aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehwang Jung <tomtomjhj@gmail.com>2023-06-28 03:05:44 +0900
committerGitHub <noreply@github.com>2023-06-27 19:05:44 +0100
commite85e7fc7bcccfa3b8f9e52ec4d6cb21591b50468 (patch)
tree968f2c240cb18556a56da10431f809308c934a5b
parentc7e7f1d4b4b62c75bb54e652f25c6c6b8785a7f4 (diff)
downloadrneovim-e85e7fc7bcccfa3b8f9e52ec4d6cb21591b50468.tar.gz
rneovim-e85e7fc7bcccfa3b8f9e52ec4d6cb21591b50468.tar.bz2
rneovim-e85e7fc7bcccfa3b8f9e52ec4d6cb21591b50468.zip
fix(treesitter): handle empty region when logging (#24173)
-rw-r--r--runtime/lua/vim/treesitter/languagetree.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua
index cabfa8ccc0..bf6333aaa4 100644
--- 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)