Beispiel #1
0
        public override ICollection <IOccurence> Search(IProgressIndicator progressIndicator)
        {
            var typeElements = new List <ITypeDeclaration>();

            var multiCoreFibersPool = new MultiCoreFibersPool("Search type declarations", locks);

            using (IMultiCoreFibers multiCoreFibers = multiCoreFibersPool.Create())
            {
                foreach (var project in solution.GetAllProjects())
                {
                    var sourceFiles = project.GetAllProjectFiles().SelectMany(projectFile => projectFile.ToSourceFiles());
                    foreach (var psiSourceFile in sourceFiles)
                    {
                        IFile file = psiSourceFile.GetCSharpFile();
                        if (file == null)
                        {
                            continue;
                        }

                        multiCoreFibers.EnqueueJob(() => file.ProcessChildren <ITypeDeclaration>(typeElements.Add));
                    }
                }
            }

            return((from typeDeclaration in typeElements
                    let element = typeDeclaration.DeclaredElement
                                  where element != null
                                  where componentRegistration.IsSatisfiedBy(element)
                                  select new DeclaredElementOccurence(element)).Cast <IOccurence>().ToList());
        }
        public override void Execute(Action <DaemonStageResult> commiter)
        {
            Action globalHighlighter = () =>
            {
                var consumer = new DefaultHighlightingConsumer(this, mySettingsStore);
                File.ProcessThisAndDescendants(new GlobalProcessor(this, consumer));
                commiter(new DaemonStageResult(consumer.Highlightings)
                {
                    Layer = 1
                });
            };

            using (IMultiCoreFibers fibers = DaemonProcess.CreateFibers())
            {
                // highlgiht global space
                //if (DaemonProcess.FullRehighlightingRequired)
                fibers.EnqueueJob(globalHighlighter);
            }

            // remove all old highlightings
            //if (DaemonProcess.FullRehighlightingRequired)
            commiter(new DaemonStageResult(EmptyArray <HighlightingInfo> .Instance));
        }