Skip to content

Commit

Permalink
fix(106): iter_matches backwards compatibility for nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
barreiroleo authored and TheLeoP committed Nov 20, 2024
1 parent 53ed685 commit 2db6d37
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/refactoring/refactor/106.lua
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,14 @@ local function extract_setup(refactor)
local body_sexpr = "(" .. table.concat(body_sexprs, " . ") .. ")"
local query = vim.treesitter.query.parse(lang, body_sexpr)

for _, match in query:iter_matches(refactor.root, refactor.bufnr, 0, -1) do
local matches = query:iter_matches(
refactor.root,
refactor.bufnr,
0,
-1,
{ all = false }
)
for _, match in matches do
if match then
local first = match[1] --[[@as TSNode]]
local last = match[#match] --[[@as TSNode]]
Expand Down

0 comments on commit 2db6d37

Please sign in to comment.