mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
fix(treesitter): make tests for memoize more robust
Instead of painfully messing with timing to determine if queries were reparsed, we can simply keep a counter next to the call to ts_query_new Also memoization had a hidden dependency on the garbage collection of the the key, a hash value which never is kept around in memory. this was done intentionally as the hash does not capture all relevant state for the query (external included files) even if actual query objects still would be reachable in memory. To make the test fully deterministic in CI, we explicitly control GC.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/log.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/lua/treesitter.h"
|
||||
#include "nvim/macros_defs.h"
|
||||
#include "nvim/mapping.h"
|
||||
#include "nvim/mark.h"
|
||||
@@ -1806,12 +1807,13 @@ Float nvim__id_float(Float flt)
|
||||
/// @return Map of various internal stats.
|
||||
Dictionary nvim__stats(Arena *arena)
|
||||
{
|
||||
Dictionary rv = arena_dict(arena, 5);
|
||||
Dictionary rv = arena_dict(arena, 6);
|
||||
PUT_C(rv, "fsync", INTEGER_OBJ(g_stats.fsync));
|
||||
PUT_C(rv, "log_skip", INTEGER_OBJ(g_stats.log_skip));
|
||||
PUT_C(rv, "lua_refcount", INTEGER_OBJ(nlua_get_global_ref_count()));
|
||||
PUT_C(rv, "redraw", INTEGER_OBJ(g_stats.redraw));
|
||||
PUT_C(rv, "arena_alloc_count", INTEGER_OBJ((Integer)arena_alloc_count));
|
||||
PUT_C(rv, "ts_query_parse_count", INTEGER_OBJ((Integer)tslua_query_parse_count));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user