mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
WI-2085: PHP: Enter after a statement adds superfluous indent
This commit is contained in:
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.formatter.common.AbstractBlock;
|
||||
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
|
||||
import com.intellij.psi.templateLanguages.OuterLanguageElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
@@ -163,6 +164,14 @@ public abstract class AbstractSyntheticBlock implements Block{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the block contains a single node which belongs to the outer (template) language.
|
||||
* @return True if it does, False otherwise.
|
||||
*/
|
||||
public boolean isOuterLanguageBlock() {
|
||||
return (myStartTreeNode == myEndTreeNode) && (myStartTreeNode instanceof OuterLanguageElement);
|
||||
}
|
||||
|
||||
public boolean isLeaf() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -177,6 +177,7 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea
|
||||
|
||||
@NotNull
|
||||
public ChildAttributes getChildAttributes(final int newChildIndex) {
|
||||
if (isOuterLanguageBlock()) return ChildAttributes.DELEGATE_TO_NEXT_CHILD;
|
||||
final List<Block> subBlocks = getSubBlocks();
|
||||
final int prevBlockIndex = newChildIndex - 1;
|
||||
if (prevBlockIndex >= 0 && prevBlockIndex < subBlocks.size()) {
|
||||
|
||||
Reference in New Issue
Block a user