Getting PSIElement(s) from XExpression


How does one get PSIElement(s) from an XExpression? When writing the conditional for a breakpoint there is highlighting and auto-complete but when listening to breakpoints via XBreakpointListener all you have available to you is the condition in essentially raw string format. Given that the conditional has syntax highlight and code completion, I imagine there is some way to get PSIElement(s) out of XExpression(s).

Also, how do you force someone to input the conditional when they create the breakpoint? I'm extending JavaBreakpointType and returning JavaDebuggerEditorsProvider on getEditorsProvider, which allows me to set the conditional after the breakpoint has been set. How would I also force the conditional to be set for the breakpoint to take effect in the first place?

Comment actions Permalink

Hi, you can create a PsiCodeFragment from the codition, see com.intellij.debugger.ui.breakpoints.Breakpoint#createConditionCodeFragment

As for forcing a condition - I'm not sure, we do not have this in any debuggers yet.

Comment actions Permalink

Thanks for the advice. That works perfectly.

As for forcing a conditional, I found out creating a breakpoint while holding shift allows you to configure breakpoints before using them so that'll work just fine.


Please sign in to leave a comment.