public void CollectRunMarkers(IFile file, IContextBoundSettingsStore settings, IHighlightingConsumer consumer)
        {
            if (!file.GetSolution().GetComponent <UnitySolutionTracker>().IsUnityProjectFolder.HasTrueValue())
            {
                return;
            }
            if (!(file is ICSharpFile csharpFile))
            {
                return;
            }

            foreach (var declaration in CachedDeclarationsCollector.Run <IMethodDeclaration>(csharpFile))
            {
                if (!(declaration.DeclaredElement is IMethod method))
                {
                    continue;
                }

                if (UnityRunMarkerUtil.IsSuitableStaticMethod(method))
                {
                    var range        = declaration.GetNameDocumentRange();
                    var highlighting = new UnityRunMarkerHighlighting(
                        declaration, UnityRunMarkerAttributeIds.RUN_METHOD_MARKER_ID, range,
                        file.GetPsiModule().TargetFrameworkId);
                    consumer.AddHighlighting(highlighting, range);
                }
            }
        }
Exemplo n.º 2
0
        public void CollectRunMarkers(IFile file, IContextBoundSettingsStore settings, IHighlightingConsumer consumer)
        {
            var isLambdaGutterMarksEnabled = settings.GetValue((LambdaGutterMarkSettings s) => s.Enabled);

            if (!isLambdaGutterMarksEnabled)
            {
                return;
            }
            if (!(file is ICSharpFile csharpFile))
            {
                return;
            }
            if (!LambdaFinder.IsLambdaProjectType(file.GetProject()))
            {
                return;
            }

            foreach (var declaration in CachedDeclarationsCollector.Run <IMethodDeclaration>(csharpFile))
            {
                if (!(declaration.DeclaredElement is IMethod method))
                {
                    continue;
                }
                if (!LambdaFinder.IsSuitableLambdaMethod(method))
                {
                    continue;
                }

                var range = declaration.GetNameDocumentRange();

                var highlighting = new RunMarkerHighlighting(declaration,
                                                             LambdaRunMarkerAttributeIds.LAMBDA_RUN_METHOD_MARKER_ID, range,
                                                             file.GetPsiModule().TargetFrameworkId);

                consumer.AddHighlighting(highlighting, range);
            }
        }