Ejemplo n.º 1
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);
            }
        }