aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/treesitter.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-03-10 13:35:07 +0000
committerGitHub <noreply@github.com>2023-03-10 13:35:07 +0000
commit845efb8e12cb014b385deac62fb83622a99024ec (patch)
tree3686fc9ffbdd4bd2afeb4419ff649ef6e0f34c55 /src/nvim/lua/treesitter.c
parent75537768ef0b8cc35ef9c6aa906237e449640b46 (diff)
parent46b73bf22cb951151de9bf0712d42e194000b677 (diff)
downloadrneovim-845efb8e12cb014b385deac62fb83622a99024ec.tar.gz
rneovim-845efb8e12cb014b385deac62fb83622a99024ec.tar.bz2
rneovim-845efb8e12cb014b385deac62fb83622a99024ec.zip
Merge pull request #22594 from lewis6991/perf/treefold
Diffstat (limited to 'src/nvim/lua/treesitter.c')
-rw-r--r--src/nvim/lua/treesitter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index ae69f3f120..289a0cb9b4 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -405,8 +405,6 @@ static int parser_parse(lua_State *L)
old_tree = tmp ? *tmp : NULL;
}
- bool include_bytes = (lua_gettop(L) >= 3) && lua_toboolean(L, 3);
-
TSTree *new_tree = NULL;
size_t len;
const char *str;
@@ -443,6 +441,8 @@ static int parser_parse(lua_State *L)
return luaL_argerror(L, 3, "expected either string or buffer handle");
}
+ bool include_bytes = (lua_gettop(L) >= 4) && lua_toboolean(L, 4);
+
// Sometimes parsing fails (timeout, or wrong parser ABI)
// In those case, just return an error.
if (!new_tree) {