public void Execute(Action <DaemonStageResult> commiter)
        {
            var consumer = new DefaultHighlightingConsumer(this, settingsStore);

#if SDK70
            foreach (IFile psiFile in DaemonProcess.SourceFile.EnumeratePsiFiles())
#else
            foreach (IFile psiFile in EnumeratePsiFiles())
#endif
            {
                IFile file = psiFile;
                psiFile.ProcessChildren <ITypeDeclaration>(declaration =>
                {
                    if (declaration.DeclaredElement == null) // type is not (yet) declared
                    {
                        return;
                    }

                    RegistrationInfo registrationInfo = patternManager.GetRegistrationsForFile(file.GetSourceFile()).
                                                        FirstOrDefault(c => c.Registration.IsSatisfiedBy(declaration.DeclaredElement));
                    if (registrationInfo != null)
                    {
                        IPsiSourceFile psiSourceFile = registrationInfo.GetSourceFile();
                        consumer.AddHighlighting(new RegisteredByContainerHighlighting(registrationInfo),
                                                 declaration.GetNameDocumentRange(),
                                                 psiSourceFile.GetTheOnlyPsiFile(psiSourceFile.PrimaryPsiLanguage));

                        typeUsageManager.MarkTypeAsUsed(declaration);
                    }
                });
            }

            commiter(new DaemonStageResult(consumer.Highlightings));
        }
Beispiel #2
0
        private void ProcessFile(IFile psiFile, DefaultHighlightingConsumer consumer)
        {
            foreach (var declaration in psiFile.ThisAndDescendants <ITypeDeclaration>())
            {
                if (declaration.DeclaredElement == null) // type is not (yet) declared
                {
                    return;
                }

                RegistrationInfo registrationInfo = patternManager.GetRegistrationsForFile(psiFile.GetSourceFile()).
                                                    FirstOrDefault(c => c.Registration.IsSatisfiedBy(declaration.DeclaredElement));
                if (registrationInfo != null)
                {
                    consumer.AddHighlighting(new RegisteredByContainerHighlighting(registrationInfo), declaration.GetNameDocumentRange(), psiFile);
                }
            }
        }