【问题标题】:How to create a Rider plugin action如何创建 Rider 插件操作
【发布时间】:2021-09-15 14:47:19
【问题描述】:
  1. 我使用https://github.com/JetBrains/resharper-rider-plugin 中的模板创建了一个新的自定义 Rider 插件。
  2. 我添加了一个新的自定义操作,例如:
        [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. 我点击F5 调试打开一个项目,然后我使用Ctrl+Shift+A 搜索我的操作。根据声明,我的操作未在此处列出,也未显示在 ToolsMenu 中。

【问题讨论】:

    标签: c# plugins resharper rider


    【解决方案1】:

    实际上构建一个 Rider 插件比我尝试的简单尝试要复杂一些,并且需要修改更多文件。我的解决方案是使用下一个 sn-p 代替它安装一个准备运行的示例并在那里进行探索。

    最初我使用并手动添加了动作。

    dotnet new resharper-rider-plugin --name Xpand 
    

    但我可以使用

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

    并使用它们都扮演角色的预安装操作、plugin.xml 和 kotlin 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-13
      • 2014-03-08
      • 2011-09-20
      • 1970-01-01
      相关资源
      最近更新 更多