fix(indents): indents for error block (css, lua) (#3207)

This commit is contained in:
Kiyan 2022-07-21 13:48:03 +02:00 committed by GitHub
parent 223a58bfca
commit d7f06bfb13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 12 deletions

View file

@ -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