mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
WEB-5568 Expand CoffeeScript Formatter Options to Match Other Languages
Respect 'relative to parent' indent flag during child code style attributes processing
This commit is contained in:
@@ -341,6 +341,10 @@ public abstract class AbstractBlockWrapper {
|
||||
if (childIndent == null) childIndent = (IndentImpl)Indent.getContinuationWithoutFirstIndent(indentOption.USE_RELATIVE_INDENTS);
|
||||
|
||||
IndentData indent = getIndent(indentOption, index, childIndent);
|
||||
if (childIndent.isRelativeToDirectParent() && myParent != null) {
|
||||
return new IndentData(indent.getIndentSpaces() + CoreFormatterUtil.getOffsetBefore(CoreFormatterUtil.getFirstLeaf(myParent)),
|
||||
indent.getSpaces());
|
||||
}
|
||||
if (myParent == null || (myFlags & CAN_USE_FIRST_CHILD_INDENT_AS_BLOCK_INDENT) != 0 && getWhiteSpace().containsLineFeeds()) {
|
||||
return indent.add(getWhiteSpace());
|
||||
}
|
||||
|
||||
@@ -250,6 +250,15 @@ public class CoreFormatterUtil {
|
||||
if (indent.getType() == Indent.Type.NONE) return new IndentData(0);
|
||||
if (indent.getType() == Indent.Type.SPACES) return new IndentData(0, indent.getSpaces());
|
||||
return new IndentData(options.INDENT_SIZE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static LeafBlockWrapper getFirstLeaf(@NotNull AbstractBlockWrapper block) {
|
||||
if (block instanceof LeafBlockWrapper) {
|
||||
return (LeafBlockWrapper)block;
|
||||
}
|
||||
else {
|
||||
return getFirstLeaf(((CompositeBlockWrapper)block).getChildren().get(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user