How to create a Rider plugin action

Viewed 513
  1. I created a new custom Rider plugin using the template found at https://github.com/JetBrains/resharper-rider-plugin.
  2. I added a new custom action like:
        [Action("ActionShowMessageBox", "Show message box", Id = 5432144)]
        public class ActionShowMessageBox : IExecutableAction, IInsertLast<ToolsMenu>{
            public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate) => true;

            public void Execute(IDataContext context, DelegateExecute nextExecute){
                var solution = context.GetData(JetBrains.ProjectModel.DataContext.ProjectModelDataConstants.SOLUTION);
                MessageBox.ShowInfo(solution?.SolutionFile != null
                    ? $"{solution.SolutionFile?.Name} solution is opened"
                    : "No solution is opened");
            }
            
        }

  1. I hit F5 to debug open a project and then i search for my action using Ctrl+Shift+A. My action is not listed there nor displayed in the ToolsMenu as per declaration.

enter image description here

1 Answers

actually building a Rider plugins is a bit more complex and requires modification of more files than the simple attempt i tried. My solution was to use the next snippet instead which installs a ready to run sample and explore for there.

initially i used and added the action manually.

dotnet new resharper-rider-plugin --name Xpand 

but instead I could use

dotnet new resharper-rider-plugin --name Xpand --include-samples

and play around with the preinstall action, plugin.xml and kotlin files that they all play role to it.

Related