public void Execute(Action <DaemonStageResult> committer) { // Getting PSI (AST) for the file being highlighted var sourceFile = myDaemonProcess.SourceFile; var file = sourceFile.GetPsiServices().Files.GetDominantPsiFile <CSharpLanguage>(sourceFile) as ICSharpFile; if (file == null) { return; } // Running visitor against the PSI var elementProcessor = new ComplexityAnalysisElementProcessor(myDaemonProcess, myThreshold); file.ProcessDescendants(elementProcessor); // Checking if the daemon is interrupted by user activity if (myDaemonProcess.InterruptFlag) { throw new ProcessCancelledException(); } // Commit the result into document committer(new DaemonStageResult(elementProcessor.Highlightings)); }
public void Execute(Action<DaemonStageResult> commiter) { // Getting PSI (AST) for the file being highlighted var file = myDaemonProcess.SourceFile.GetNonInjectedPsiFile<CSharpLanguage>() as ICSharpFile; if (file == null) return; // Running visitor against the PSI var elementProcessor = new ComplexityAnalysisElementProcessor(myDaemonProcess, myThreshold); file.ProcessDescendants(elementProcessor); // Checking if the daemon is interrupted by user activity if (myDaemonProcess.InterruptFlag) throw new ProcessCancelledException(); // Commit the result into document commiter(new DaemonStageResult(elementProcessor.Highlightings)); }