public override void AddFrequentlyCalledMethodHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration cSharpDeclaration, string text, string tooltip, IReadOnlyCallGraphContext context) { var boundStore = SettingsStore.BoundSettingsStore; // here is order of IsCodeVisionEnabled and hasHotIcon matters also // hasHotIcon and IsCodeVisionEnabled checks if hot icon should be enabled. if it shouldn't - nothing would be displayed if (!cSharpDeclaration.HasHotIcon(PerformanceContextProvider, boundStore, context)) { return; } void Fallback() => base.AddFrequentlyCalledMethodHighlighting(consumer, cSharpDeclaration, text, tooltip, context); var providerId = myCodeInsightProvider.ProviderId; if (!RiderIconProviderUtil.IsCodeVisionEnabled(boundStore, providerId, Fallback, out _)) { return; } // code vision var actions = GetActions(cSharpDeclaration, context); var extraActions = RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost); var iconModel = myIconHost.Transform(InsightUnityIcons.InsightHot.Id); myCodeInsightProvider.AddHighlighting(consumer, cSharpDeclaration, cSharpDeclaration.DeclaredElement, text, tooltip, text, iconModel, actions, extraActions); }
protected override void AddMonoBehaviourHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, DaemonProcessKind kind) { if (!myAssetSerializationMode.IsForceText || !Settings.GetValue((UnitySettings key) => key.EnableInspectorPropertiesEditor) || !Settings.GetValue((UnitySettings key) => key.IsAssetIndexingEnabled)) { AddHighlighting(consumer, element, text, tooltip, kind); return; } if (RiderIconProviderUtil.IsCodeVisionEnabled(Settings, myFieldUsageProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } var isProcessing = myDeferredCacheController.IsProcessingFiles(); myFieldUsageProvider.AddInspectorHighlighting(consumer, element, element.DeclaredElement, text, tooltip, isProcessing ? "Inspector values are not available during asset indexing" : text, isProcessing ? myIconHost.Transform(CodeInsightsThemedIcons.InsightWait.Id) : myIconHost.Transform(InsightUnityIcons.InsightUnity.Id), GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myConnectionTracker)); } }
public override void AddEventFunctionHighlighting(IHighlightingConsumer consumer, IMethod method, UnityEventFunction eventFunction, string text, DaemonProcessKind kind) { var iconId = method.HasHotIcon(ContextProvider, SettingsStore.BoundSettingsStore, kind) ? InsightUnityIcons.InsightHot.Id : InsightUnityIcons.InsightUnity.Id; if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddEventFunctionHighlighting(consumer, method, eventFunction, text, kind); }, out var useFallback)) { foreach (var declaration in method.GetDeclarations()) { if (declaration is ICSharpDeclaration cSharpDeclaration) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(cSharpDeclaration); } myCodeInsightProvider.AddHighlighting(consumer, cSharpDeclaration, method, text, eventFunction.Description ?? string.Empty, text, myIconHost.Transform(iconId), GetEventFunctionActions(cSharpDeclaration), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); } } } }
public override void AddFrequentlyCalledMethodHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration declaration, string text, string tooltip, DaemonProcessKind kind) { var isHot = declaration.HasHotIcon(CallGraphSwaExtensionProvider, SettingsStore.BoundSettingsStore, MarksProvider, kind, myProvider); if (!isHot) { return; } if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddFrequentlyCalledMethodHighlighting(consumer, declaration, text, tooltip, kind); }, out var useFallback)) { IEnumerable <BulbMenuItem> actions; if (declaration.DeclaredElement is IMethod method && UnityApi.IsEventFunction(method)) { actions = GetEventFunctionActions(declaration); } 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 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)); }
protected override void AddHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, DaemonProcessKind kind) { if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } myCodeInsightProvider.AddHighlighting(consumer, element, element.DeclaredElement, text, tooltip, text, myIconHost.Transform(InsightUnityIcons.InsightUnity.Id), GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); } }
protected override void AddHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, DaemonProcessKind kind) { var iconId = element.HasHotIcon(CallGraphSwaExtensionProvider, SettingsStore.BoundSettingsStore, MarksProvider, kind, ElementIdProvider) ? InsightUnityIcons.InsightHot.Id : InsightUnityIcons.InsightUnity.Id; if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } IconModel iconModel = myIconHost.Transform(iconId); if (myAssetIndexingSupport.IsEnabled.Value && myAssetSerializationMode.IsForceText) { if (myDeferredCacheController.IsProcessingFiles()) { iconModel = myIconHost.Transform(CodeInsightsThemedIcons.InsightWait.Id); } if (!myDeferredCacheController.CompletedOnce.Value) { tooltip = "Usages in assets are not available during asset indexing"; } } if (!myAssetIndexingSupport.IsEnabled.Value || !myDeferredCacheController.CompletedOnce.Value || !myAssetSerializationMode.IsForceText) { myCodeInsightProvider.AddHighlighting(consumer, element, element.DeclaredElement, text, tooltip, text, iconModel, GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); } else { var count = UnityEventsElementContainer.GetAssetUsagesCount(element.DeclaredElement, out var estimate); myUsagesCodeVisionProvider.AddHighlighting(consumer, element, element.DeclaredElement, count, "Click to view usages in assets", "Assets usages", estimate, iconModel); } } }
protected override void AddHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, DaemonProcessKind kind) { var iconId = element.HasHotIcon(Swa, CallGraphSwaExtensionProvider, Settings, Analyzer, kind) ? InsightUnityIcons.InsightHot.Id : InsightUnityIcons.InsightUnity.Id; if (RiderIconProviderUtil.IsCodeVisionEnabled(Settings, myCodeInsightProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } myCodeInsightProvider.AddHighlighting(consumer, element, element.DeclaredElement, text, tooltip, text, myIconHost.Transform(iconId), GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myConnectionTracker)); } }
protected override void AddHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, IReadOnlyCallGraphContext context) { var iconId = element.HasHotIcon(ContextProvider, SettingsStore.BoundSettingsStore, context) ? InsightUnityIcons.InsightHot.Id : InsightUnityIcons.InsightUnity.Id; if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myFieldUsageProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, context); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } myFieldUsageProvider.AddHighlighting(consumer, element, element.DeclaredElement, text, tooltip, text, myIconHost.Transform(iconId), GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); } }
protected override void AddMonoBehaviourHiglighting(IHighlightingConsumer consumer, IClassLikeDeclaration declaration, string text, string tooltip, DaemonProcessKind kind) { if (RiderIconProviderUtil.IsCodeVisionEnabled(Settings, myCodeInsightProvider.ProviderId, () => { base.AddHighlighting(consumer, declaration, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(declaration); } if (!myUnityYamlSupport.IsUnityYamlParsingEnabled.Value || !myAssetSerializationMode.IsForceText) { myCodeInsightProvider.AddHighlighting(consumer, declaration, declaration.DeclaredElement, text, tooltip, text, myIconHost.Transform(InsightUnityIcons.InsightUnity.Id), GetActions(declaration), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myConnectionTracker)); } } }
public override void AddEventFunctionHighlighting(IHighlightingConsumer consumer, IMethod method, UnityEventFunction eventFunction, string text, IReadOnlyCallGraphContext context) { var boundStore = SettingsStore.BoundSettingsStore; var providerId = myCodeInsightProvider.ProviderId; void Fallback() => base.AddEventFunctionHighlighting(consumer, method, eventFunction, text, context); // here is order of IsCodeVisionEnabled and hasHotIcon matters // hasHotIcon differs if hot icon or event function icon, it depends on multiple settings if (!RiderIconProviderUtil.IsCodeVisionEnabled(boundStore, providerId, Fallback, out var useFallback)) { return; } var iconId = method.HasHotIcon(PerformanceContextProvider, boundStore, context) ? InsightUnityIcons.InsightHot.Id : InsightUnityIcons.InsightUnity.Id; var iconModel = myIconHost.Transform(iconId); var extraActions = RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost); foreach (var declaration in method.GetDeclarations()) { if (!(declaration is ICSharpDeclaration cSharpDeclaration)) { continue; } if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(cSharpDeclaration); } var actions = GetEventFunctionActions(cSharpDeclaration, context); myCodeInsightProvider.AddHighlighting(consumer, cSharpDeclaration, method, text, eventFunction.Description ?? string.Empty, text, iconModel, actions, extraActions); } }
protected override void AddMonoBehaviourHighlighting(IHighlightingConsumer consumer, IClassLikeDeclaration declaration, string text, string tooltip, DaemonProcessKind kind) { if (RiderIconProviderUtil.IsCodeVisionEnabled(SettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId, () => { base.AddHighlighting(consumer, declaration, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(declaration); } IconModel iconModel = myIconHost.Transform(InsightUnityIcons.InsightUnity.Id); if (myAssetIndexingSupport.IsEnabled.Value && myAssetSerializationMode.IsForceText) { if (myDeferredCacheController.IsProcessingFiles()) { iconModel = myIconHost.Transform(CodeInsightsThemedIcons.InsightWait.Id); } if (!myDeferredCacheController.CompletedOnce.Value) { tooltip = "Usages in assets are not available during asset indexing"; } } if (!myAssetIndexingSupport.IsEnabled.Value || !myDeferredCacheController.CompletedOnce.Value || !myAssetSerializationMode.IsForceText) { myCodeInsightProvider.AddHighlighting(consumer, declaration, declaration.DeclaredElement, text, tooltip, text, iconModel, GetActions(declaration), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myBackendUnityHost)); } else { var count = myAssetScriptUsagesElementContainer.GetUsagesCount(declaration, out var estimatedResult); myUsagesCodeVisionProvider.AddHighlighting(consumer, declaration, declaration.DeclaredElement, count, "Click to view usages in assets", "Assets usages", estimatedResult, iconModel); } } }
protected override void AddMonoBehaviourHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string text, string tooltip, DaemonProcessKind kind) { if (!myAssetSerializationMode.IsForceText || !Settings.GetValue((UnitySettings key) => key.EnableInspectorPropertiesEditor)) { AddHighlighting(consumer, element, text, tooltip, kind); return; } if (RiderIconProviderUtil.IsCodeVisionEnabled(Settings, myFieldUsageProvider.ProviderId, () => { base.AddHighlighting(consumer, element, text, tooltip, kind); }, out var useFallback)) { if (!useFallback) { consumer.AddImplicitConfigurableHighlighting(element); } myFieldUsageProvider.AddInspectorHighlighting(consumer, element, element.DeclaredElement, text, tooltip, text, myIconHost.Transform(InsightUnityIcons.InsightUnity.Id), GetActions(element), RiderIconProviderUtil.GetExtraActions(mySolutionTracker, myConnectionTracker)); } }