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));
                    }
                }
            }
        }
Esempio n. 2
0
        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);
            }
        }
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 5
0
        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);
                }
            }
        }
Esempio n. 6
0
        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 bool CheckAndAnalyze(IMethodDeclaration methodDeclaration, IHighlightingConsumer consumer)
        {
            if (consumer == null)
            {
                return(false);
            }

            if (!RiderIconProviderUtil.IsCodeVisionEnabled(mySettingsStore.BoundSettingsStore, myCodeInsightProvider.ProviderId,
                                                           () => { }, out _))
            {
                return(false);
            }

            var declaredElement = methodDeclaration.DeclaredElement;

            myCodeInsightProvider.AddHighlighting(consumer, methodDeclaration, declaredElement, BurstCodeAnalysisUtil.BURST_DISPLAY_NAME,
                                                  BurstCodeAnalysisUtil.BURST_TOOLTIP,
                                                  BurstCodeAnalysisUtil.BURST_DISPLAY_NAME,
                                                  myIconHost.Transform(InsightUnityIcons.InsightUnity.Id),
                                                  GetBurstActions(methodDeclaration),
                                                  null);

            return(false);
        }