Assign ENTER to plugin shortcut

Hi, my Intellij plugin want to achieve certain function(i.e. pop out a JDialog showing some messages ) after User presses "enter" when they re writing codes on IDE. So I registered my action as below. But it looks like after that, the default action for enter when writing codes(i.e. change to a new line) will never happen. So I wonder if we can assign priorities to our actions, so that the default action will happen first and then my own plugin action happens sequencly?

0
5 comments

You might want to try writing it as a `com.intellij.codeInsight.editorAction.TypeHandlerDelegate` subclass and registering it like 

<typedHandler implementation="org.elixir_lang.TypedHandler"/>

I use it (https://github.com/KronicDeth/intellij-elixir/blob/v6.4.0/src/org/elixir_lang/TypedHandler.java) for some brace matching for non-standard braces, but they fire for any typing, so it will work for Enter too I would think.

1
Avatar
Permanently deleted user

Thanks a lot ! However I found that TypeHandlerDelegate cannot detect whether 'ENTER' is pressed or not :(

0
Avatar
Permanently deleted user

Trying to make this question in another way, how can we detect a "press-ENTER" behavior from users when they're writing codes?

0

You want to implement com.intellij.codeInsight.editorActions.enter.EnterHandlerDelegate - there are plenty of examples in the Community source code.

1
Avatar
Permanently deleted user

OMG, it works perfectly! Thank you so much Colin :)

0

Please sign in to leave a comment.