Questions about expression evaluator in custom debugger Follow
Answered
I'm implementing a custom debugger and need to support expression evaluator in a number of custom languages.
I create and return a list of supported languages in the
getSupportedLanguages()
method of the editors provider but there are several issues:- I see the drop-down populated with my languages, but in addition of it there’s also a language of the currently opened file displayed - how can I avoid it? I.e. if I have an XML file open, stop at the breakpoint and evaluate expression, I see
XML
displayed in the dropdown, but when I click on it, I see two languages that I return in thegetSupportedLanguages
. And the same problem is when I add a conditional breakpoint, I see this XML option there in addition to the languages that I support. What I need is to get rid of the XML language in the drop-down, I only need `datasonnet` and `simple`. - Is there any way to modify the expression evaluator UI to add some additional parameters I need to pass to the evaluator?
It would be great if anyone can point me to some examples or even give me some insight on how the existing expression evaluation in IntelliJ is implemented.
Thanks a lot in advance!
Please sign in to leave a comment.
Hi, unfortunately default language is taken from the current breakpoint file language, check https://github.com/JetBrains/intellij-community/blob/263520365a82f17cc68d38ee9cac1d9d6ae7e864/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java#L218 and LanguageChooser at the line 511
Default expression evaluator UI is not customizable at the moment https://github.com/JetBrains/intellij-community/blob/263520365a82f17cc68d38ee9cac1d9d6ae7e864/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java#L44
but you can create your own dialog and evaluate action and reuse some components like XDebuggerTreePanel or EvaluationInputComponent
Thanks, Egor, so looks like I should start with overriding the Evaluate action, correct? What is the ID of the action and how can I override it?
I went as far as adding `<xdebugger.support ...` to my `plugin.xml`, and I created an override for the getEvaluateHandler() method:
Then I created my own action handler, but from what I can tell, when I evaluate expression, this handler is never used, instead, the default handler is used instead. After some debugging I found that `DebuggerSupport.getDebuggerSupports()` returns a list of debugger supports and the one I created is not the first one in the list. The first one is XDebuggerSupport and as a result my code is never called.
So is there a way to disable the XDebuggerSupport?
The default action is
it is easier to create your own action and place it on the debugger toolbar. In your own action there's no need to bother with DebuggerSupport, just call your own handler.
But then is it possible to unregister the default action or at least disable it when I'm in the context of debugging a certain project?
it is not recommended, for now it maybe easier to register your xdebuggersupport impl with order like this: order="before XDebuggerSupport"