[formatter] moved registry flag upper on call stack, do not create AdjustFormattingRangesState if it is disabled.

This commit is contained in:
Yaroslav Lepenkin
2016-06-30 19:03:14 +03:00
parent de0f67efc6
commit 166464a38f
2 changed files with 3 additions and 3 deletions
@@ -22,7 +22,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.codeStyle.CodeStyleSettings;
@@ -1287,7 +1286,7 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
@Nullable
@Override
public ExtraReformatRanges getExtraRangesToFormat(FormatTextRanges ranges) {
if (Registry.is("smart.reformat.vcs.changes") && ranges.isInsertedBlock(this) && myNode.textContains('\n')) {
if (ranges.isInsertedBlock(this) && myNode.textContains('\n')) {
List<TextRange> extra = calculateExtraRanges(myNode);
return new ExtraReformatRanges(extra);
}
@@ -19,6 +19,7 @@ package com.intellij.formatting;
import com.intellij.formatting.engine.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import org.jetbrains.annotations.NotNull;
@@ -69,7 +70,7 @@ public class FormatProcessor {
myWrapState = new WrapBlocksState(builder, blockIndentOptions);
FormatTextRanges ranges = options.myAffectedRanges;
if (ranges != null) {
if (ranges != null && Registry.is("smart.reformat.vcs.changes")) {
AdjustFormatRangesState adjustRangesState = new AdjustFormatRangesState(block, ranges);
myStateProcessor = new StateProcessor(adjustRangesState);
myStateProcessor.setNextState(myWrapState);