mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 11:36:54 -04:00
Add virtual range for creating node-like objects from multiple nodes
This commit is contained in:
parent
c3b526fe51
commit
aa4c3e83e3
3 changed files with 151 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
local api = vim.api
|
||||
local tsq = require'vim.treesitter.query'
|
||||
local tsrange = require'nvim-treesitter.tsrange'
|
||||
local utils = require'nvim-treesitter.utils'
|
||||
local parsers = require'nvim-treesitter.parsers'
|
||||
local caching = require'nvim-treesitter.caching'
|
||||
|
|
@ -98,6 +99,10 @@ function M.iter_prepared_matches(query, qnode, bufnr, start_row, end_row)
|
|||
if pred[1] == "set!" and type(pred[2]) == "string" then
|
||||
insert_to_path(prepared_match, split(pred[2]), pred[3])
|
||||
end
|
||||
if pred[1] == "make-range!" and type(pred[2]) == "string" and #pred == 4 then
|
||||
insert_to_path(prepared_match, split(pred[2]..'.node'),
|
||||
tsrange.TSRange.from_nodes(bufnr, match[pred[3]], match[pred[4]]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue