Beware of developing a 'simple' plugin for Rider :)

I am posting this as a warning for naive people like myself.
I had an idea to create a simple plugin to help my own development.

The idea:
a) Right click a method => add custom context menu action
b) Use some logic => find parent method of this selected method
c) Clicking the said context menu action => find usages of desired ‘parent’ method

Total time spent: 2 weeks.
Total documentation consumed: 20-30+ pages
Total plugins&samples download/tested: 15+
Total time finding & guessing resources via Perplexity, Grok 3, Claude 3.7, ChatGPT 4 = MANY, many hours
Plugin Slack chat: not working any more.
Try guessing API => test => fail x 100s of times

Final code working per goal, after 2 weeks:
a) Right click shows a new action on the context menu: 0%
Spent 1 week trying to get right-click context menu to have an extra option. I’m sure you are thinking “It can’t be that hard, I’ve seen the extra options in other plugins.” I warned you. I don’t think I suffered any major lack of effort or intelligence.
b) Find specific method’s parent method.: 70%
Partial success. Couldn’t do the whole thing since documentation is non-existent. Or very well hidden. A lot of guessing. Even more failing.
c) Showing Find Usages window result for my particular method: 0%
Again, no documentations. So many different versions. Unclear which documentation is relevant and for what. (ReSharper, IntelliJ…)

There is a major problem finding ANY relevant and current documentation, references.

When you hear the words “Rider plugin development is not easy”, BELIEVE IT.

Beware.

From my own experience, LLMs are terribly bad at plugin development. I guess they (LLMs providers) did not steal enough data on the Internet. They are better for developing JS stuff, things like that.

So, my advice would be:

I’m not saying it’s easy. The learning curve can be discouraging, but this is absolutely not specific to plugin development. This is not as easy as plugin development for Chrome or Firefox, or for VSCode, but the IJ Platform is much powerful (really).

2 Likes

I started developing a plugin at the start of the year. And will agree that it is sometimes an uphill battle. But! These have worked for me

But hopefully this forum can also be a help. Do you have a github repo with the current progress?

I unfortunately don’t know how to find usages of a method. But I think that what you want to do can be achived through a ContextAction.

But roughly the skeleton should be something like this

[ContextAction(
    Name = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    Description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
    GroupType = typeof(CSharpContextActions))]
public class FindUsagesOfParentAction : ContextActionBase
{
    private readonly ICSharpContextActionDataProvider _provider;

    public FindUsagesOfParentAction(ICSharpContextActionDataProvider provider)
    {
        _provider = provider;
    }
    
    // This is called when the user clicks the action
    protected override Action<ITextControl>? ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
    {
        if (_provider.GetSelectedTreeNode<IMethodDeclaration>() is not { } methodDeclaration)
        {
            // Do something with this
            // If you don't modify the class you are in just return null
            return null;
        }

        return null;
    }

    public override string Text => "Find parent usages";
    public override bool IsAvailable(IUserDataHolder cache)
    {
        // This might catch the outer method. 
        if (_provider.GetSelectedTreeNode<IMethodDeclaration>() is not { } methodDeclaration)
            return false;

        return true;
    }
}

This should at least present you with a context action when on a method.

I hope this help just a bit.