aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-01-25 23:14:41 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-01-25 23:39:25 +0100
commit83b51b36aa46d4bb25fada6eda22102e0aa5ef19 (patch)
tree6c62c14be5fa6f5d5f85c72b1dec29075cbb475e
parent35a147fa77f28e3e9b5eaa217b5b383b59b6c9d2 (diff)
downloadrneovim-83b51b36aa46d4bb25fada6eda22102e0aa5ef19.tar.gz
rneovim-83b51b36aa46d4bb25fada6eda22102e0aa5ef19.tar.bz2
rneovim-83b51b36aa46d4bb25fada6eda22102e0aa5ef19.zip
fixup: raise TS min version
-rw-r--r--cmake/FindTreesitter.cmake20
-rw-r--r--src/nvim/CMakeLists.txt2
-rw-r--r--src/nvim/lua/treesitter.c6
3 files changed, 1 insertions, 27 deletions
diff --git a/cmake/FindTreesitter.cmake b/cmake/FindTreesitter.cmake
index 8dac13337b..0d0897be70 100644
--- a/cmake/FindTreesitter.cmake
+++ b/cmake/FindTreesitter.cmake
@@ -7,23 +7,3 @@ mark_as_advanced(TREESITTER_LIBRARY TREESITTER_INCLUDE_DIR)
add_library(treesitter INTERFACE)
target_include_directories(treesitter SYSTEM BEFORE INTERFACE ${TREESITTER_INCLUDE_DIR})
target_link_libraries(treesitter INTERFACE ${TREESITTER_LIBRARY})
-
-# TODO(lewis6991): remove when min TS version is 0.20.9
-list(APPEND CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}")
-list(APPEND CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}")
-check_c_source_compiles("
-#include <tree_sitter/api.h>
-int
-main(void)
-{
- TSQueryCursor *cursor = ts_query_cursor_new();
- ts_query_cursor_set_max_start_depth(cursor, 32);
- return 0;
-}
-" TS_HAS_SET_MAX_START_DEPTH)
-list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${TREESITTER_INCLUDE_DIR}")
-list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${TREESITTER_LIBRARY}")
-
-if(TS_HAS_SET_MAX_START_DEPTH)
- target_compile_definitions(treesitter INTERFACE NVIM_TS_HAS_SET_MAX_START_DEPTH)
-endif()
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index b1ee3d93db..1a51ff6b71 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -33,7 +33,7 @@ find_package(Libuv 1.28.0 REQUIRED)
find_package(Libvterm 0.3.3 REQUIRED)
find_package(Lpeg REQUIRED)
find_package(Msgpack 1.0.0 REQUIRED)
-find_package(Treesitter 0.20.8 REQUIRED)
+find_package(Treesitter 0.20.9 REQUIRED)
find_package(Unibilium 2.0 REQUIRED)
target_link_libraries(main_lib INTERFACE
diff --git a/src/nvim/lua/treesitter.c b/src/nvim/lua/treesitter.c
index 008b3f2e95..8b62bff496 100644
--- a/src/nvim/lua/treesitter.c
+++ b/src/nvim/lua/treesitter.c
@@ -1449,10 +1449,7 @@ static int node_rawquery(lua_State *L)
cursor = ts_query_cursor_new();
}
-#ifdef NVIM_TS_HAS_SET_MAX_START_DEPTH
- // reset the start depth
ts_query_cursor_set_max_start_depth(cursor, UINT32_MAX);
-#endif
ts_query_cursor_set_match_limit(cursor, 256);
ts_query_cursor_exec(cursor, query, node);
@@ -1475,11 +1472,8 @@ static int node_rawquery(lua_State *L)
if (lua_type(L, -2) == LUA_TSTRING) {
char *k = (char *)lua_tostring(L, -2);
if (strequal("max_start_depth", k)) {
- // TODO(lewis6991): remove ifdef when min TS version is 0.20.9
-#ifdef NVIM_TS_HAS_SET_MAX_START_DEPTH
uint32_t max_start_depth = (uint32_t)lua_tointeger(L, -1);
ts_query_cursor_set_max_start_depth(cursor, max_start_depth);
-#endif
}
}
lua_pop(L, 1); // pop the value; lua_next will pop the key.