Custom macro
Is it possible to create (a plugin that that provides) a custom macro in File > Settings > Tools > External Tools > Create Tool > Insert Macro ?
I see that all macros there extend com.intellij.ide.macro.Macro and I already created myne to extend it as well. However there should be a way to register it to be displayed in the UI.
The problem is that the default macros are registered within MacroManager.registerMacro() which is a private method and I can not use it. Perhaps I have to use plugin.xml somehow?
Please sign in to leave a comment.
Add a line to plugin.xml:
<macro implementation="Full class name of your implementation"/>
Hi Vassiliy,
thanks, but I already tried that without success. The problem is that IDEA tries to register my macro with internal call to MacroManager.registerMacro(), which first has a check if the macro is one of several predefined once:
(see details here: https://github.com/JetBrains/intellij-community/blob/210e0ed138627926e10094bb9c76026319cec178/platform/lang-impl/src/com/intellij/ide/macro/MacroManager.java#L106)
So far the only way I found to overcome this is to name my macro as one of the macros predefined in PathMacrosImpl.getToolMacroNames(), which is actually a hack.
So looking at this assert statement, it looks like creating custom macros is not currently supported. I was curious if anyone in the forum has achived this.
I've logged an issue regarding this topic. Please feel free to vote for it.
https://youtrack.jetbrains.com/issue/IDEA-153788
Do I understand correctly, it's fixed since this commit? https://github.com/JetBrains/intellij-community/commit/fdf6dbcb8ccace8d9cad4f7e6400df834e197687
Tpasternak Indeed