summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSantos Gallegos <stsewd@protonmail.com>2020-09-11 15:03:31 -0500
committerStephan Seitz <stephan.lauf@yahoo.de>2020-09-12 10:51:06 +0200
commit31e6d1e64758e1bff1f6eb27a5fd513e0366f773 (patch)
treeff05c5f23e56a063cee60054a29de7b217bb6e65 /lua
parente1434ff68b1f94690c1430388fd9cb95c89c1347 (diff)
TextObjects: refactor wrong func names
Reading the code, these functions should be named differently https://github.com/nvim-treesitter/nvim-treesitter/blob/a755017dd52947672af458743b88e59a59cd592f/lua/nvim-treesitter/query.lua#L203-L203
Diffstat (limited to 'lua')
-rw-r--r--lua/nvim-treesitter/textobjects/shared.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/lua/nvim-treesitter/textobjects/shared.lua b/lua/nvim-treesitter/textobjects/shared.lua
index 3a00da42..96c93f6d 100644
--- a/lua/nvim-treesitter/textobjects/shared.lua
+++ b/lua/nvim-treesitter/textobjects/shared.lua
@@ -89,7 +89,7 @@ function M.next_textobject(node, query_string, same_parent, overlapping_range_ok
else
_, _, search_start = node:end_()
end
- local function scoring_function(match)
+ local function filter_function(match)
if match.node == node then return end
if not same_parent or node:parent() == match.node:parent() then
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
end
end
- local function filter_function(match)
+ local function scoring_function(match)
local _, _, node_start = match.node:start()
return -node_start
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
end
@@ -121,7 +121,7 @@ function M.previous_textobject(node, query_string, same_parent, overlapping_rang
_, _, search_end = node:start()
end
- local function scoring_function(match)
+ local function filter_function(match)
if not same_parent or node:parent() == match.node:parent() then
local _, _, end_ = match.node:end_()
local _, _, start = match.node:start()
@@ -129,12 +129,12 @@ function M.previous_textobject(node, query_string, same_parent, overlapping_rang
end
end
- local function filter_function(match)
+ local function scoring_function(match)
local _, _, node_end = match.node:end_()
return node_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
end