What is the correct way of adding a custom action to a menu in Rider ReSharper plugin?

There is a plugin.xml file where I tried to do something like this:

<actions>
    <group id="org.intellij.sdk.action.GroupedActions"
           text="Test Actions"
           popup="true">
        <add-to-group group-id="GoToMenu" />
        <action id="ReSharperPlugin.TestPlugin.TestAction" class="ReSharperPlugin.TestPlugin.TestAction"/>
    </group>
</actions>

However, it seems like the “class” reference is not correct, “I see java.lang.ClassNotFoundException” in the logs on startup. This probably makes sense, since it is not a Java class. Some old ReSharper documentation refers to Action.xml file to specify this, but it seems to be outdated. What is the right way of doing this?

0
3 comments

Hello Dmitry,

When implementing a custom action in a plugin for Rider, you can implement it as a pure frontend action (without writing anything in C#): You declare the action in plugin.xml and point the class field to the exact kotlin / java class that implements the logic of your action.

Rider is IntelliJ platform-based, so the plugin for IDEA can work for Rider the same way).

However, once you want to implement anything in C#, things get more complicated. I published this article: SUPPORT-A-3195 How to implement an action on the backend and invoke it from frontend. Hope that helps!

We have a slack channel for plugin writers. There our developers can assist with any questions about plugin development. If you are interested, please submit a support ticket (Help | Contact Support). Share your email in the request and mention you would like to join the plugin developers Slack channel)

Have a nice day!

1

Works like charm and finally makes sense! Thank you Dmitry and thanks for putting together an article for it, I'm sure other developers like me will appreciate finding it in the future!

-1
Hello Dmitry,

I am glad to hear that I was able to help.
Should you have any other questions or difficulties in the future, do not hesitate to contact support.

Have a nice day!
0

Please sign in to leave a comment.