mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-03 12:06:55 -04:00
fix(indents): indents for error block (css, lua) (#3207)
This commit is contained in:
parent
223a58bfca
commit
d7f06bfb13
6 changed files with 24 additions and 12 deletions
|
|
@ -149,12 +149,19 @@ function M.get_indent(lnum)
|
|||
end
|
||||
|
||||
-- do not indent for nodes that starts-and-ends on same line and starts on target line (lnum)
|
||||
local should_process = not is_processed_by_row[srow]
|
||||
local is_in_err = false
|
||||
if should_process then
|
||||
local parent = node:parent()
|
||||
is_in_err = parent and parent:has_error()
|
||||
end
|
||||
if
|
||||
not is_processed_by_row[srow]
|
||||
-- Dear stylua, please don't change the semantics of this statement!
|
||||
-- stylua: ignore start
|
||||
and (q.indent[node:id()] and srow ~= erow and ((srow ~= lnum - 1) or q.indent[node:id()].start_at_same_line))
|
||||
-- stylua: ignore end
|
||||
should_process
|
||||
and (
|
||||
q.indent[node:id()]
|
||||
and (srow ~= erow or is_in_err)
|
||||
and (srow ~= lnum - 1 or q.indent[node:id()].start_at_same_line)
|
||||
)
|
||||
then
|
||||
indent = indent + indent_size
|
||||
is_processed = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue