public DaemonStageProcessResult Execute() {
            // Creating container to put highlightings to
            DaemonStageProcessResult result = new DaemonStageProcessResult();

            // Getting PSI (AST) for the file being highlighted
            PsiManager manager = PsiManager.GetInstance(m_DaemonProcess.Solution);
            IFile file = manager.GetPsiFile(m_DaemonProcess.ProjectFile);
            if (file == null) {
                return result;
            }

            // Running visitor against the PSI
            CSharpAnalysisElementProcessor elementProcessor = new CSharpAnalysisElementProcessor(m_DaemonProcess);
            file.ProcessDescendants(elementProcessor);

            // Checking if the daemon is interrupted by user activity
            if (m_DaemonProcess.InterruptFlag) {
                throw new ProcessCancelledException();
            }

            // Fill in the result
            result.FullyRehighlighted = true;
            result.Highlightings = elementProcessor.Highlightings.ToArray();

            return result;
        }
        public DaemonStageProcessResult Execute()
        {
            DaemonStageProcessResult result = new DaemonStageProcessResult();
            result.FullyRehighlighted = true;
            result.Highlightings = GetHighlightings();

            return result;
        }
Exemplo n.º 3
0
        public DaemonStageProcessResult Execute()
        {
            DaemonStageProcessResult result = new DaemonStageProcessResult();

            result.FullyRehighlighted = true;
            result.Highlightings      = GetHighlightings();

            return(result);
        }
        ///<summary>
        ///
        ///            Executes the process and returns resulting highlightings and embedded objects to be inserted into the editor.
        ///            The process should check for <see cref="P:JetBrains.ReSharper.Daemon.IDaemonProcess.InterruptFlag" /> periodically (with intervals less than 100 ms)
        ///            and throw <see cref="T:JetBrains.Shell.Progress.ProcessCancelledException" /> if it is true. 
        ///            Failing to do so may cause the program to prevent user from typing while analysing the code.
        ///            
        ///</summary>
        ///
        ///<returns>
        ///New highlightings and embedded objects. Return 
        ///<c>null</c> if this stage doesn't produce
        ///            any of them.
        ///</returns>
        ///
        public DaemonStageProcessResult Execute()
        {
            IHighlightingProcessor processor = CreateProcessor();
            file.ProcessDescendants(processor);
            DaemonStageProcessResult result = new DaemonStageProcessResult();
            result.Highlightings = processor.Highlightings;
            result.RehighlightedRanges = new TextRange[] { new TextRange(0, file.GetTextLength()) };
            return result;

            return result;
        }
        public DaemonStageProcessResult Execute() {
            Logger.LogMessage("NHibernatePlugin: MappingFileAnalysisDaemonStageProcess.Execute called");
            DaemonStageProcessResult result = new DaemonStageProcessResult();

            IFile file = PsiManager.PsiFile(m_DaemonProcess.ProjectFile);
            if (file == null) {
                Logger.LogMessage("   NO PSI FILE !!! {0}", m_DaemonProcess.ProjectFile.Name);
                return result;
            }

            MappingFileAnalysisElementProcessor elementProcessor = new MappingFileAnalysisElementProcessor(m_DaemonProcess);
            file.ProcessDescendants(elementProcessor);

            if (m_DaemonProcess.InterruptFlag) {
                throw new ProcessCancelledException();
            }

            result.FullyRehighlighted = true;
            result.Highlightings = elementProcessor.Highlightings.ToArray();

            return result;
        }