I’m trying to add breakpoints programmatically using the following code snippet:
val breakpoint = XDebuggerManager.getInstance(project).breakpointManager.addLineBreakpoint(
PhpLineBreakpointType.getInstance(),
vFile.url,
lineIndex,
PhpLineBreakpointType.getInstance().createBreakpointProperties(vFile, lineIndex),
false
) as? XLineBreakpoint<*> ?: continue
breakpoint.isEnabled = bp.isEnabled
breakpoint.suspendPolicy = bp.suspend
bp.condition?.let { breakpoint.conditionExpression = XExpressionImpl.fromText(it) }
bp.logExpression?.let { breakpoint.logExpressionObject = XExpressionImpl.fromText(it) }
breakpoint.isLogMessage = bp.logMessage
The breakpoints are created successfully and appear in Run | View Breakpoints, but they are not shown in the editor gutter right away. Interestingly, once I interact with any of the breakpoints in the dialog (e.g., select one in the tree), all of them are then displayed correctly in the editor.
I’ve looked into the IntelliJ IDEA Community Edition source code for a way to trigger a UI update, but many breakpoint-related mechanisms rely on internal APIs that aren’t accessible from plugin code. So far, I haven’t found a way to force the UI refresh for breakpoints after adding them programmatically.
Is there a recommended approach to programmatically refresh the editor UI or notify the system after breakpoints are added?