Skip to content

Commit

Permalink
Handle more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
dansanduleac committed Nov 19, 2019
1 parent b27c11f commit 19e5f6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,9 @@ public PsiElement reformat(PsiElement element, boolean canChangeWhiteSpacesOnly)
}

@Override
public final PsiElement reformatRange(PsiElement element, int startOffset, int endOffset)
public PsiElement reformatRange(PsiElement element, int startOffset, int endOffset)
throws IncorrectOperationException {
// Preserve the fallback defined in CodeStyleManagerImpl
return reformatRange(element, startOffset, endOffset, false);
return delegate.reformatRange(element, startOffset, endOffset);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.ChangedRangesInfo;
import com.intellij.psi.codeStyle.CodeStyleManager;
import com.intellij.psi.impl.CheckUtil;
import com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl;
Expand Down Expand Up @@ -132,6 +133,12 @@ public void reformatText(PsiFile file, Collection<TextRange> ranges) throws Inco
}
}

@Override
public void reformatTextWithContext(PsiFile psiFile, ChangedRangesInfo changedRangesInfo)
throws IncorrectOperationException {
reformatTextWithContext(psiFile, changedRangesInfo.allChangedRanges);
}

@Override
public void reformatTextWithContext(PsiFile file, Collection<TextRange> ranges) {
if (overrideFormatterForFile(file)) {
Expand All @@ -141,6 +148,13 @@ public void reformatTextWithContext(PsiFile file, Collection<TextRange> ranges)
}
}

@Override
public PsiElement reformatRange(PsiElement element, int startOffset, int endOffset)
throws IncorrectOperationException {
// Preserve the fallback defined in CodeStyleManagerImpl
return reformatRange(element, startOffset, endOffset, false);
}

@Override
public PsiElement reformatRange(
PsiElement element, int startOffset, int endOffset, boolean canChangeWhiteSpacesOnly) {
Expand Down

0 comments on commit 19e5f6b

Please sign in to comment.