我想得到关于树保姆的信息。其中,我想得到@punctuation.delimiter的价值。我怎么才能拿到呢?
@punctuation.delimiter
https://github.com/nvim-treesitter/nvim-treesitter/blob/419153c1f1992ced7f9462d92f0d7505c6ff3137/queries/rust/highlights.scm#L131
在上述情况下,“:”、“。”我想得到字符串":“、”、“。
发布于 2022-05-11 17:16:00
您可以通过比较这个“装饰器”的名称和节点的字符类型来检查它:
for _, match, _ in query:iter_matches(parent_node, 0, start_row, end_row) do for id, node in pairs(match) do if character_type == 'punctuation.delimiter' then -- do your stuff end end end
下面是是我如何尝试“访问”查询文件中的那些“装饰者”的一个例子。
https://stackoverflow.com/questions/72195547
相似问题