mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
TextObjects: refactor wrong func names
Reading the code, these functions should be named differently
a755017dd5/lua/nvim-treesitter/query.lua (L203-L203)
This commit is contained in:
parent
e1434ff68b
commit
31e6d1e647
1 changed files with 6 additions and 6 deletions
|
|
@ -89,7 +89,7 @@ function M.next_textobject(node, query_string, same_parent, overlapping_range_ok
|
||||||
else
|
else
|
||||||
_, _, search_start = node:end_()
|
_, _, search_start = node:end_()
|
||||||
end
|
end
|
||||||
local function scoring_function(match)
|
local function filter_function(match)
|
||||||
if match.node == node then return end
|
if match.node == node then return end
|
||||||
if not same_parent or node:parent() == match.node:parent() then
|
if not same_parent or node:parent() == match.node:parent() then
|
||||||
local _, _, start = match.node:start()
|
local _, _, start = match.node:start()
|
||||||
|
|
@ -97,12 +97,12 @@ function M.next_textobject(node, query_string, same_parent, overlapping_range_ok
|
||||||
return start > search_start and end_ >= node_end
|
return start > search_start and end_ >= node_end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function filter_function(match)
|
local function scoring_function(match)
|
||||||
local _, _, node_start = match.node:start()
|
local _, _, node_start = match.node:start()
|
||||||
return -node_start
|
return -node_start
|
||||||
end
|
end
|
||||||
|
|
||||||
local next_node = queries.find_best_match(bufnr, query_string, 'textobjects', scoring_function, filter_function)
|
local next_node = queries.find_best_match(bufnr, query_string, 'textobjects', filter_function, scoring_function)
|
||||||
|
|
||||||
return next_node and next_node.node
|
return next_node and next_node.node
|
||||||
end
|
end
|
||||||
|
|
@ -121,7 +121,7 @@ function M.previous_textobject(node, query_string, same_parent, overlapping_rang
|
||||||
_, _, search_end = node:start()
|
_, _, search_end = node:start()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function scoring_function(match)
|
local function filter_function(match)
|
||||||
if not same_parent or node:parent() == match.node:parent() then
|
if not same_parent or node:parent() == match.node:parent() then
|
||||||
local _, _, end_ = match.node:end_()
|
local _, _, end_ = match.node:end_()
|
||||||
local _, _, start = match.node:start()
|
local _, _, start = match.node:start()
|
||||||
|
|
@ -129,12 +129,12 @@ function M.previous_textobject(node, query_string, same_parent, overlapping_rang
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function filter_function(match)
|
local function scoring_function(match)
|
||||||
local _, _, node_end = match.node:end_()
|
local _, _, node_end = match.node:end_()
|
||||||
return node_end
|
return node_end
|
||||||
end
|
end
|
||||||
|
|
||||||
local previous_node = queries.find_best_match(bufnr, query_string, 'textobjects', scoring_function, filter_function)
|
local previous_node = queries.find_best_match(bufnr, query_string, 'textobjects', filter_function, scoring_function)
|
||||||
|
|
||||||
return previous_node and previous_node.node
|
return previous_node and previous_node.node
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue