mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
Allow indent.propagate and indent.increment metadata on @indent.begin
This commit is contained in:
parent
55e44f8f28
commit
5fe901f76b
1 changed files with 8 additions and 5 deletions
|
|
@ -252,16 +252,19 @@ function M.get_indent(lnum)
|
||||||
local parent = node:parent()
|
local parent = node:parent()
|
||||||
is_in_err = parent and parent:has_error()
|
is_in_err = parent and parent:has_error()
|
||||||
end
|
end
|
||||||
|
local begin_metadata = q["indent.begin"][node:id()]
|
||||||
if
|
if
|
||||||
should_process
|
should_process
|
||||||
and (
|
and (
|
||||||
q["indent.begin"][node:id()]
|
begin_metadata
|
||||||
and (srow ~= erow or is_in_err or q["indent.begin"][node:id()]["indent.immediate"])
|
and (srow ~= erow or is_in_err or begin_metadata["indent.immediate"])
|
||||||
and (srow ~= lnum - 1 or q["indent.begin"][node:id()]["indent.start_at_same_line"])
|
and (srow ~= lnum - 1 or begin_metadata["indent.start_at_same_line"])
|
||||||
)
|
)
|
||||||
then
|
then
|
||||||
indent = indent + indent_size
|
indent = indent + (begin_metadata["indent.increment"] or indent_size)
|
||||||
is_processed = true
|
if not begin_metadata["indent.propagate"] then
|
||||||
|
is_processed = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_in_err and not q["indent.align"][node:id()] then
|
if is_in_err and not q["indent.align"][node:id()] then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue