mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Correct wrap processing at the core formatter (PhpFormatterTest.testReformatWI10456)
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.intellij.formatting;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.TextChange;
|
||||
@@ -25,13 +23,10 @@ import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.impl.BulkChangesMerger;
|
||||
import com.intellij.openapi.editor.impl.TextChangeImpl;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.formatter.DocumentBasedFormattingModel;
|
||||
import com.intellij.psi.formatter.PsiBasedFormattingModel;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -538,8 +533,7 @@ class FormatProcessor {
|
||||
return true;
|
||||
}
|
||||
if (wrap != null && wrap.getFirstEntry() != null) {
|
||||
//myCurrentBlock = wrap.getFirstEntry();
|
||||
myCurrentBlock = getFirstBlockOnNewLine();
|
||||
myCurrentBlock = wrap.getFirstEntry();
|
||||
wrap.markAsUsed();
|
||||
return true;
|
||||
}
|
||||
@@ -582,18 +576,6 @@ class FormatProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private LeafBlockWrapper getFirstBlockOnNewLine() {
|
||||
LeafBlockWrapper current = myCurrentBlock;
|
||||
while (current != null) {
|
||||
WhiteSpace whiteSpace = current.getWhiteSpace();
|
||||
if (whiteSpace.containsLineFeeds() && whiteSpace.containsLineFeedsInitially()) return current;
|
||||
if (current.getPreviousBlock() == null) return current;
|
||||
current = current.getPreviousBlock();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to answer if wrap of the {@link #myWrapCandidate} object (if any) may be replaced by the given wrap.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user