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 IEnumerable <BulbMenuItem> GetBurstActions([NotNull] IMethodDeclaration methodDeclaration, IReadOnlyCallGraphContext context) { var result = new CompactList <BulbMenuItem>(); var textControl = myTextControlManager.LastFocusedTextControl.Value; foreach (var bulbProvider in myBulbProviders) { var menuItems = bulbProvider.GetMenuItems(methodDeclaration, textControl, context); foreach (var item in menuItems) { result.Add(item); } } return(result); }
public static CompactList <IField> GetFieldsByAttribute(this IAttribute attribute) { var list = new CompactList <IField>(); foreach (var fieldDeclaration in FieldDeclarationNavigator.GetByAttribute(attribute)) { if (fieldDeclaration.DeclaredElement != null) { list.Add(fieldDeclaration.DeclaredElement); } } foreach (var constantDeclaration in ConstantDeclarationNavigator.GetByAttribute(attribute)) { if (constantDeclaration.DeclaredElement != null) { list.Add(constantDeclaration.DeclaredElement); } } return(list); }
public void CreateNewList( string listTitle, string optionalDescription, bool isCollaborative, Action <CompactList> success, Action <Exception> error) { List <string> components = new List <string> { "name", listTitle }; if (!string.IsNullOrEmpty(optionalDescription)) { components.Add("description"); components.Add(optionalDescription); } if (isCollaborative) { components.Add("collaborative"); components.Add("true"); // or "true" as docs say? } var uuri = FourSquareWebClient.BuildFourSquareUri( "lists/add", GeoMethodType.Optional, components.ToArray()); var r = new FourSquareServiceRequest { Uri = uuri.Uri, PostString = string.Empty, }; var token = CentralStatusManager.Instance.BeginShowEllipsisMessage("Creating new list"); r.CallAsync( (str, ex) => { Exception exx = ex; try { FourSquare.IgnoreNextNotification = true; var json = FourSquareDataLoaderBase <LoadContext> .ProcessMetaAndNotificationsReturnJson(str); FourSquare.IgnoreNextNotification = false; var vjson = json["list"]; CompactList cl = null; if (vjson != null) { cl = CompactList.ParseJson(vjson); } success(cl); token.CompleteWithAcknowledgement(); } catch (Exception e) { exx = e; } if (exx != null) { error(exx); StatusToken.TryComplete(ref token); } }); }