aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKiyoon Kim <yoonkr33@gmail.com>2023-02-12 18:18:48 +0000
committerStephan Seitz <stephan.seitz@fau.de>2023-02-12 14:26:14 -0800
commit7eb5f1a2e3949496f26c4084b521b30f2d08137a (patch)
tree63621a878942ca51a5dee11e1e43bf30a90e92c3
parentchore(fish): update test command highlight query (#4306) (diff)
downloadnvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar.gz
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar.bz2
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar.lz
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar.xz
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.tar.zst
nvim-treesitter-7eb5f1a2e3949496f26c4084b521b30f2d08137a.zip
properly replace deprecated tsutils functions
-rw-r--r--doc/nvim-treesitter.txt5
-rw-r--r--lua/nvim-treesitter/indent.lua3
-rw-r--r--tests/query/highlights_spec.lua4
-rw-r--r--tests/query/injection_spec.lua4
4 files changed, 6 insertions, 10 deletions
diff --git a/doc/nvim-treesitter.txt b/doc/nvim-treesitter.txt
index 4feabb739..61507cb58 100644
--- a/doc/nvim-treesitter.txt
+++ b/doc/nvim-treesitter.txt
@@ -412,11 +412,6 @@ node_to_lsp_range(node)~
Get an lsp formatted range from a node range
- *ts_utils.get_node_range*
-get_node_range(node_or_range)~
-
-Get the range from either a node or a range
-
*ts_utils.node_length*
node_length(node)~
diff --git a/lua/nvim-treesitter/indent.lua b/lua/nvim-treesitter/indent.lua
index 0eac0a911..a53d38c8d 100644
--- a/lua/nvim-treesitter/indent.lua
+++ b/lua/nvim-treesitter/indent.lua
@@ -1,6 +1,7 @@
local parsers = require "nvim-treesitter.parsers"
local queries = require "nvim-treesitter.query"
local tsutils = require "nvim-treesitter.ts_utils"
+local ts = vim.treesitter
local M = {}
@@ -82,7 +83,7 @@ function M.get_indent(lnum)
return
end
local local_root = tstree:root()
- if tsutils.is_in_node_range(local_root, lnum - 1, 0) then
+ if ts.is_in_node_range(local_root, lnum - 1, 0) then
if not root or tsutils.node_length(root) >= tsutils.node_length(local_root) then
root = local_root
lang_tree = tree
diff --git a/tests/query/highlights_spec.lua b/tests/query/highlights_spec.lua
index 8bfd3c2ec..548a7eeba 100644
--- a/tests/query/highlights_spec.lua
+++ b/tests/query/highlights_spec.lua
@@ -1,6 +1,6 @@
local highlighter = require "vim.treesitter.highlighter"
-local ts_utils = require "nvim-treesitter.ts_utils"
local parsers = require "nvim-treesitter.parsers"
+local ts = vim.treesitter
local COMMENT_NODES = {
markdown = "html_block",
@@ -67,7 +67,7 @@ local function check_assertions(file)
assert.Truthy(node)
assert.is.number(row)
assert.is.number(col)
- if hl and ts_utils.is_in_node_range(node, row, col) then
+ if hl and ts.is_in_node_range(node, row, col) then
local c = query._query.captures[capture] -- name of the capture in the query
if c ~= nil and c ~= "spell" and c ~= "conceal" then
captures[c] = true
diff --git a/tests/query/injection_spec.lua b/tests/query/injection_spec.lua
index 28e6c727f..7efbab315 100644
--- a/tests/query/injection_spec.lua
+++ b/tests/query/injection_spec.lua
@@ -1,8 +1,8 @@
require "nvim-treesitter.highlight" -- yes, this is necessary to set the hlmap
local highlighter = require "vim.treesitter.highlighter"
local configs = require "nvim-treesitter.configs"
-local ts_utils = require "nvim-treesitter.ts_utils"
local parsers = require "nvim-treesitter.parsers"
+local ts = vim.treesitter
local function check_assertions(file)
local buf = vim.fn.bufadd(file)
@@ -39,7 +39,7 @@ local function check_assertions(file)
local root = tstree:root()
--- If there are multiple tree with the smallest range possible
--- Check all of them to see if they fit or not
- if not ts_utils.is_in_node_range(root, row, col) or root == top_level_root then
+ if not ts.is_in_node_range(root, row, col) or root == top_level_root then
return
end
if assertion.expected_capture_name == tree:lang() then