From f66a60805dd5480982d1b12a263724cfd56b1bfe Mon Sep 17 00:00:00 2001 From: Denys Date: Mon, 9 May 2022 18:01:21 +0200 Subject: docs: correct description of LanguageTree:contains() --- runtime/lua/vim/treesitter/languagetree.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index b83df65151..af878aed0e 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -497,8 +497,6 @@ end --- Determines whether {range} is contained in this language tree --- ---- This goes down the tree to recursively check children. ---- ---@param range A range, that is a `{ start_line, start_col, end_line, end_col }` table. function LanguageTree:contains(range) for _, tree in pairs(self._trees) do -- cgit From fec944142bbbe5ed07867c9409c1e07598a1ef99 Mon Sep 17 00:00:00 2001 From: Denys Date: Tue, 10 May 2022 10:00:04 +0200 Subject: refactor: simple logic in tree_contains() --- runtime/lua/vim/treesitter/languagetree.lua | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/treesitter/languagetree.lua b/runtime/lua/vim/treesitter/languagetree.lua index af878aed0e..c23ac4468d 100644 --- a/runtime/lua/vim/treesitter/languagetree.lua +++ b/runtime/lua/vim/treesitter/languagetree.lua @@ -488,11 +488,7 @@ local function tree_contains(tree, range) local start_fits = start_row < range[1] or (start_row == range[1] and start_col <= range[2]) local end_fits = end_row > range[3] or (end_row == range[3] and end_col >= range[4]) - if start_fits and end_fits then - return true - end - - return false + return start_fits and end_fits end --- Determines whether {range} is contained in this language tree -- cgit