protected override void CollectHighlightings(IPsiDocumentRangeView psiDocumentRangeView, HighlightingsConsumer consumer) { var view = psiDocumentRangeView.View <CSharpLanguage>(); var node = view.GetSelectedTreeNode <IFunctionDeclaration>(); if (node == null) { return; } var solution = psiDocumentRangeView.Solution; var settingsStore = psiDocumentRangeView.GetSettingsStore(); if (settingsStore.GetValue((UnitySettings key) => key.PerformanceHighlightingMode) != PerformanceHighlightingMode.CurrentMethod) { return; } var contextProvider = solution.GetComponent <PerformanceCriticalContextProvider>(); var swea = solution.GetComponent <SolutionAnalysisService>(); var declaredElement = node.DeclaredElement; if (contextProvider.IsMarkedSweaDependent(declaredElement, swea)) { consumer.ConsumeHighlighting(new UnityPerformanceContextHighlightInfo(node.GetDocumentRange())); } }
protected override void CollectHighlightings(IPsiDocumentRangeView psiDocumentRangeView, HighlightingsConsumer consumer) { var settingsStore = psiDocumentRangeView.GetSettingsStore(); if (!settingsStore.GetValue((UnitySettings key) => key.EnablePerformanceCriticalCodeHighlighting)) { return; } if (settingsStore.GetValue((UnitySettings key) => key.PerformanceHighlightingMode) != PerformanceHighlightingMode.CurrentMethod) { return; } var view = psiDocumentRangeView.View <CSharpLanguage>(); var node = view.GetSelectedTreeNode <IFunctionDeclaration>(); if (node != null) { var declaredElement = node.DeclaredElement; if (declaredElement == null) { return; } var solution = psiDocumentRangeView.Solution; var swa = solution.GetComponent <SolutionAnalysisService>(); var callGraphExtension = solution.GetComponent <CallGraphSwaExtensionProvider>(); var callGraphAnalyzer = solution.GetComponent <PerformanceCriticalCodeCallGraphMarksProvider>(); var elementIdProvider = solution.GetComponent <IElementIdProvider>(); var usageChecker = swa.UsageChecker; if (usageChecker == null) { return; } var elementId = elementIdProvider.GetElementId(declaredElement); if (!elementId.HasValue) { return; } if (callGraphExtension.IsMarkedByCallGraphRootMarksProvider(callGraphAnalyzer.Id, false, elementId.Value)) { consumer.ConsumeHighlighting(new UnityPerformanceContextHighlightInfo(node.GetDocumentRange())); } } }
protected override void CollectHighlightings(IPsiDocumentRangeView psiDocumentRangeView, HighlightingsConsumer consumer) { var view = psiDocumentRangeView.View <CSharpLanguage>(); var node = view.GetSelectedTreeNode <IFunctionDeclaration>(); if (node == null) { return; } var solution = psiDocumentRangeView.Solution; var swa = solution.GetComponent <SolutionAnalysisService>(); if (!UnityCallGraphUtil.IsSweaCompleted(swa)) { return; } var contextProvider = solution.GetComponent <PerformanceCriticalContextProvider>(); var settingsStore = psiDocumentRangeView.GetSettingsStore(); if (contextProvider.IsContextAvailable == false) { return; } if (settingsStore.GetValue((UnitySettings key) => key.PerformanceHighlightingMode) != PerformanceHighlightingMode.CurrentMethod) { return; } var kind = UnityCallGraphUtil.GetProcessKindForGraph(swa); if (contextProvider.HasContext(node, kind)) { consumer.ConsumeHighlighting(new UnityPerformanceContextHighlightInfo(node.GetDocumentRange())); } }