[debugger] fix unfolding of method after setting breakpoint on it IDEA-326458

Also fix some warnings

^IDEA-326458 fixed

GitOrigin-RevId: 3ac8b6b77bbcc78c7f464d04617b19546fe9b63c
This commit is contained in:
Vladimir Parfinenko
2023-07-27 20:22:12 +00:00
committed by intellij-monorepo-bot
parent 656937249f
commit a09e0e1b5f
2 changed files with 5 additions and 6 deletions
@@ -23,7 +23,6 @@ import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.actionSystem.EditorAction;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -32,12 +31,12 @@ public class ExpandRegionAction extends EditorAction implements ActionRemoteBeha
super(new BaseFoldingHandler() {
@Override
public void doExecute(@NotNull Editor editor, @Nullable Caret caret, DataContext dataContext) {
expandRegionAtCaret(editor.getProject(), editor);
expandRegionAtCaret(editor);
}
});
}
private static void expandRegionAtCaret(final Project project, @Nullable final Editor editor) {
private static void expandRegionAtCaret(@Nullable final Editor editor) {
if (editor == null) return;
final int[] offsets = editor.getCaretModel().getAllCarets().stream()
@@ -46,8 +45,8 @@ public class ExpandRegionAction extends EditorAction implements ActionRemoteBeha
expandRegionAtOffsets(editor, offsets);
}
public static void expandRegionAtOffset(@NotNull Project project, @NotNull final Editor editor, final int offset) {
expandRegionAtOffsets(editor, new int[offset]);
public static void expandRegionAtOffset(@NotNull final Editor editor, final int offset) {
expandRegionAtOffsets(editor, new int[]{offset});
}
public static void expandRegionAtOffsets(@NotNull final Editor editor, final int[] offsets) {
@@ -146,7 +146,7 @@ public final class XBreakpointUtil {
if (editor != null && lineStart != lineWinner) {
int offset = editor.getDocument().getLineStartOffset(lineWinner);
ExpandRegionAction.expandRegionAtOffset(project, editor, offset);
ExpandRegionAction.expandRegionAtOffset(editor, offset);
if (moveCaret) {
editor.getCaretModel().moveToOffset(offset);
}