List<GutterMark> (@NotNull List<GutterMark> marks) { // In general, it seems ok to merge breakpoints because they are drawn one over another in the new UI. // But we disable it in the old mode just for ease of regressions debugging. if (!XDebuggerUtil.areInlineBreakpointsEnabled()) return marks; var breakpointCount = ContainerUtil.count(marks, m -> m instanceof CommonBreakpointGutterIconRenderer); if (breakpointCount <= 1) { return marks; } var newMarks = new ArrayList<GutterMark>(marks.size() - breakpointCount + 1); var breakpoints = new ArrayList<XBreakpointBase<?, ?, ?>>(breakpointCount); var breakpointMarkPosition = -1; for (GutterMark mark : marks) { assert !(mark instanceof MultipleBreakpointGutterIconRenderer) : "they are not expected to be created before processing"; if (mark instanceof XBreakpointBase<?,?,?>.BreakpointGutterIconRenderer singleBreakpointMark) { breakpoints.add(singleBreakpointMark.getBreakpoint()); breakpointMarkPosition = newMarks.size(); continue; } newMarks.add(mark); } // FIXME[inline-bp]: do we need to cache this instance? newMarks.add(breakpointMarkPosition, new MultipleBreakpointGutterIconRenderer(breakpoints)); return newMarks; }