protected override void Analyze(IFieldDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { var field = element.DeclaredElement; if (field != null && Api.IsUnityField(field)) { var highlighting = new UnityGutterMarkInfo(element, "This field is initialised by Unity"); consumer.AddHighlighting(highlighting); } }
protected override void Analyze(IClassLikeDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { var @class = element.DeclaredElement; if (@class != null && Api.IsUnityType(@class)) { var highlighting = new UnityGutterMarkInfo(element, "Unity scripting component"); consumer.AddHighlighting(highlighting); } }
protected override void Analyze(IMethodDeclaration methodDeclaration, IHighlightingConsumer consumer, IReadOnlyCallGraphContext context) { if (!IsGutterMarkEnabled) { return; } var items = myBurstCodeInsights.GetBurstActions(methodDeclaration, context); var gutterMark = new UnityGutterMarkInfo(items, methodDeclaration, BurstCodeAnalysisUtil.BURST_TOOLTIP); consumer.AddHighlighting(gutterMark); }
public virtual void AddHighlighting(IHighlightingConsumer consumer, ICSharpDeclaration element, string tooltip) { var mode = SettingsStore.GetValue((UnitySettings key) => key.GutterIconMode); if (mode == GutterIconMode.None) { return; } var highlighting = new UnityGutterMarkInfo(element, tooltip); consumer.AddHighlighting(highlighting); }
protected override void Analyze(IConstructorDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { if (!element.IsStatic) { return; } var containingType = element.GetContainingTypeDeclaration()?.DeclaredElement; if (containingType != null && containingType.HasAttributeInstance(KnownTypes.InitializeOnLoadAttribute, false)) { var highlighting = new UnityGutterMarkInfo(element, "Called when Unity first launches the editor, the player, or recompiles scripts"); consumer.AddHighlighting(highlighting); } }
private void AddGutterMark(IDeclaration declaration, UnityEventFunction eventFunction, IHighlightingConsumer consumer) { var tooltip = "Unity event function"; if (!string.IsNullOrEmpty(eventFunction.Description)) { tooltip += Environment.NewLine + Environment.NewLine + eventFunction.Description; } if (eventFunction.Coroutine) { tooltip += Environment.NewLine + "This function can be a coroutine."; } var highlighting = new UnityGutterMarkInfo(declaration, tooltip); consumer.AddHighlighting(highlighting); }
protected override void Analyze(IClassLikeDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { var typeElement = element.DeclaredElement; if (typeElement != null) { if (Api.IsUnityType(typeElement)) { var highlighting = new UnityGutterMarkInfo(element, "Unity scripting component"); consumer.AddHighlighting(highlighting); } else if (Api.IsSerializableType(typeElement)) { var highlighting = new UnityGutterMarkInfo(element, "Unity custom serializable type"); consumer.AddHighlighting(highlighting); } } }