mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 10:20:11 -04:00
feat(indents): add support for language injection
This commit is contained in:
parent
3ff725e654
commit
7654bbc04b
1 changed files with 6 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
local parsers = require "nvim-treesitter.parsers"
|
local parsers = require "nvim-treesitter.parsers"
|
||||||
local queries = require "nvim-treesitter.query"
|
local queries = require "nvim-treesitter.query"
|
||||||
local tsutils = require "nvim-treesitter.ts_utils"
|
local tsutils = require "nvim-treesitter.ts_utils"
|
||||||
|
local highlighter = require "vim.treesitter.highlighter"
|
||||||
|
|
||||||
local function get_first_node_at_line(root, lnum)
|
local function get_first_node_at_line(root, lnum)
|
||||||
local col = vim.fn.indent(lnum)
|
local col = vim.fn.indent(lnum)
|
||||||
|
|
@ -38,9 +39,11 @@ local get_indents = tsutils.memoize_by_buf_tick(function(bufnr, root, lang)
|
||||||
aligned_indent = {},
|
aligned_indent = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, node, metadata in queries.iter_captures(bufnr, "indents", root, lang) do
|
highlighter.active[bufnr].tree:for_each_tree(function(tstree, tree)
|
||||||
map[name][node:id()] = metadata or {}
|
for name, node, metadata in queries.iter_captures(bufnr, "indents", tstree:root(), tree:lang()) do
|
||||||
end
|
map[name][node:id()] = metadata or {}
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
return map
|
return map
|
||||||
end, {
|
end, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue