aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2024-04-29 19:31:59 +0200
committerGitHub <noreply@github.com>2024-04-29 19:31:59 +0200
commita1c9da2d5af002ec5e9eb5ac1c0c61fc12ec4190 (patch)
tree782be8ed4e68780c14edd9912692e1bba192545b /src/nvim/lua
parentca432069eb6f5453acab896acdb8e0363c232629 (diff)
parent0df681a91d6b86395609e6fc40efb4d8623d72c9 (diff)
downloadrneovim-a1c9da2d5af002ec5e9eb5ac1c0c61fc12ec4190.tar.gz
rneovim-a1c9da2d5af002ec5e9eb5ac1c0c61fc12ec4190.tar.bz2
rneovim-a1c9da2d5af002ec5e9eb5ac1c0c61fc12ec4190.zip
Merge pull request #28566 from bfredl/memoize
fix(treesitter): make tests for memoize more robust, also fix memoize to work
Diffstat (limited to 'src/nvim/lua')
-rw-r--r--src/nvim/lua/treesitter.c1
-rw-r--r--src/nvim/lua/treesitter.h5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index f4bc454790..8befc6d32d 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -1318,6 +1318,7 @@ int tslua_parse_query(lua_State *L)
size_t len;
const char *src = lua_tolstring(L, 2, &len);
+ tslua_query_parse_count++;
uint32_t error_offset;
TSQueryError error_type;
TSQuery *query = ts_query_new(lang, src, (uint32_t)len, &error_offset, &error_type);
diff --git a/src/nvim/lua/treesitter.h b/src/nvim/lua/treesitter.h
index 4ef9a10602..14df06e184 100644
--- a/src/nvim/lua/treesitter.h
+++ b/src/nvim/lua/treesitter.h
@@ -1,7 +1,12 @@
#pragma once
#include <lua.h> // IWYU pragma: keep
+#include <stdint.h>
+
+#include "nvim/macros_defs.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/treesitter.h.generated.h"
#endif
+
+EXTERN uint64_t tslua_query_parse_count INIT( = 0);