public override void AddFrequentlyCalledMethodHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration declaration, string text, string tooltip, DaemonProcessKind kind) { var isHot = declaration.HasHotIcon(ContextProvider, SettingsStore.BoundSettingsStore, kind); if (!isHot) { return; } if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddFrequentlyCalledMethodHighlighting(consumer, declaration, text, tooltip, kind); }, out _)) { IEnumerable <BulbMenuItem> actions; if (declaration.DeclaredElement is IMethod method && UnityApi.IsEventFunction(method)) { actions = GetEventFunctionActions(declaration); } else { if (declaration is IMethodDeclaration methodDeclaration) { var textControl = myTextControlManager.LastFocusedTextControl.Value; var compactList = new CompactList <BulbMenuItem>(); var performanceDisableAction = new PerformanceAnalysisDisableByCommentBulbAction(methodDeclaration); var performanceDisableBulbItem = new BulbMenuItem( new IntentionAction.MyExecutableProxi(performanceDisableAction, mySolution, textControl), performanceDisableAction.Text, BulbThemedIcons.ContextAction.Id, BulbMenuAnchors.FirstClassContextItems); compactList.Add(performanceDisableBulbItem); if (!UnityCallGraphUtil.HasAnalysisComment(methodDeclaration, ExpensiveCodeMarksProvider.MarkId, ReSharperControlConstruct.Kind.Restore)) { var expensiveBulbAction = new AddExpensiveCommentBulbAction(methodDeclaration); var expensiveBulbItem = new BulbMenuItem( new IntentionAction.MyExecutableProxi(expensiveBulbAction, mySolution, textControl), expensiveBulbAction.Text, BulbThemedIcons.ContextAction.Id, BulbMenuAnchors.FirstClassContextItems); compactList.Add(expensiveBulbItem); } actions = compactList; } else { actions = EmptyList <BulbMenuItem> .Instance; } } myCodeInsightProvider.AddHighlighting(consumer, declaration, declaration.DeclaredElement, text, tooltip, text, myIconHost.Transform(InsightUnityIcons.InsightHot.Id), actions, RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); }
public static BulbMenuItem BulbActionToMenuItem([NotNull] IBulbAction bulbAction, [NotNull] ITextControl textControl, [NotNull] ISolution solution, [NotNull] IconId iconId) { var proxi = new IntentionAction.MyExecutableProxi(bulbAction, solution, textControl); var menuText = bulbAction.Text; var anchor = BulbMenuAnchors.FirstClassContextItems; var bulbMenuItem = new BulbMenuItem(proxi, menuText, iconId, anchor); return(bulbMenuItem); }