protected void HighlightInFile(Action <ICgFile, IHighlightingConsumer> fileHighlighter, Action <DaemonStageResult> commiter) { var consumer = new FilteringHighlightingConsumer(this, mySettingsStore, myFile); fileHighlighter(myFile, consumer); commiter(new DaemonStageResult(consumer.Highlightings)); }
public override void Execute(Action <DaemonStageResult> committer) { var highlightingConsumer = new FilteringHighlightingConsumer(new PerformanceHighlightingConsumer(DaemonProcess.SourceFile, File), DaemonProcess.SourceFile, File, DaemonProcess.ContextBoundSettingsStore); AnalyzeFile(File, highlightingConsumer); committer(new DaemonStageResult(highlightingConsumer.Highlightings)); }
public void Execute(Action <DaemonStageResult> committer) { var consumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, _file, DaemonProcess.ContextBoundSettingsStore); _file.ProcessDescendants(_elementProcessor, consumer); committer(new DaemonStageResult(consumer.Highlightings)); }
protected override void DoExecute(Action <IEnumerable <HighlightingInfo> > committer) { var consumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, File, Settings); File.ProcessThisAndDescendants(new Processor(this, consumer)); committer.Invoke(consumer.Highlightings); }
private void HighlightInFile(Action <ICgFile, IHighlightingConsumer> fileHighlighter, Action <DaemonStageResult> committer) { var consumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, myFile, DaemonProcess.ContextBoundSettingsStore); fileHighlighter(myFile, consumer); committer(new DaemonStageResult(consumer.Highlightings)); }
protected void HighlightInFile(Action <IShaderLabFile, IHighlightingConsumer> fileHighlighter, Action <DaemonStageResult> commiter) { var consumer = new FilteringHighlightingConsumer(myFile.GetSourceFile(), myFile); fileHighlighter(myFile, consumer); commiter(new DaemonStageResult(consumer.Highlightings)); }
public ProjectAnalysisElementProcessor(ProjectAnalysisDaemonStageProcess stageProcess, IDaemonProcess process, IContextBoundSettingsStore settings) { _highlightingConsumer = new FilteringHighlightingConsumer(stageProcess.File.GetSourceFile(), stageProcess.File, settings); _process = process; _settings = settings; }
public override void Execute(Action <DaemonStageResult> committer) { var highlightingConsumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, File, DaemonProcess.ContextBoundSettingsStore); File.ProcessThisAndDescendants(this, highlightingConsumer); committer(new DaemonStageResult(highlightingConsumer.Highlightings)); }
/// <summary> /// The execute. /// </summary> /// <param name="committer"> /// The committer. /// </param> public void Execute(Action <DaemonStageResult> committer) { StyleCopTrace.In(); try { if (this.daemonProcess == null) { return; } if (this.daemonProcess.InterruptFlag) { return; } DaemonData daemonData; bool shouldProcessNow; daemonData = this.file.UserData.GetOrCreateDataUnderLock( DaemonDataKey, () => new DaemonData(this.lifetime, this.threading, this.daemon, this.daemonProcess.Document)); shouldProcessNow = daemonData.OnDaemonCalled(); if (shouldProcessNow) { Lifetimes.Using( apiLifetime => { var runner = this.apiPool.GetInstance(apiLifetime).Runner; runner.Execute( this.daemonProcess.SourceFile.ToProjectFile(), this.daemonProcess.Document, this.file); // This filters the highlights, based on "ReSharper disable" comments, etc. var filteringConsumer = new FilteringHighlightingConsumer(this, this.settings, this.file); foreach (var highlightingInfo in runner.ViolationHighlights) { filteringConsumer.ConsumeHighlighting(highlightingInfo); } committer(new DaemonStageResult(filteringConsumer.Highlightings)); }); } else { // NOTE: This wouldn't be necessary if the StyleCop analysis were more lightweight, // e.g. by using ReSharper's ASTs rather than re-parsing the file on each change daemonData.ScheduleReHighlight(); } } catch (JetBrains.Application.Progress.ProcessCancelledException) { } StyleCopTrace.Out(); }
protected void HighlightInFile(Action <ICgFile, IHighlightingConsumer> fileHighlighter, Action <DaemonStageResult> commiter) { #if RIDER var consumer = new FilteringHighlightingConsumer(myFile.GetSourceFile(), myFile); #else var consumer = new FilteringHighlightingConsumer(this, mySettingsStore, myFile); #endif fileHighlighter(myFile, consumer); commiter(new DaemonStageResult(consumer.Highlightings)); }
public override void Execute(Action <DaemonStageResult> committer) { File.GetPsiServices().Locks.AssertReadAccessAllowed(); var highlightingConsumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, File, DaemonProcess.ContextBoundSettingsStore); File.ProcessThisAndDescendants(this, highlightingConsumer); committer(new DaemonStageResult(highlightingConsumer.Highlightings)); }
public override void Execute(Action <DaemonStageResult> committer) { var highlightingConsumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, File, DaemonProcess.ContextBoundSettingsStore); File.ProcessThisAndDescendants(this, highlightingConsumer); foreach (var declaration in File.Descendants <ICSharpFunctionDeclaration>()) { var declaredElement = declaration.DeclaredElement; if (declaredElement == null) { continue; } if (myEventFunctions != null && Enumerable.Contains(myEventFunctions, declaredElement)) { var method = (declaredElement as IMethod).NotNull("method != null"); var eventFunction = myAPI.GetUnityEventFunction(method); if (eventFunction == null) // happens after event function refactoring { continue; } myCommonIconProvider.AddEventFunctionHighlighting(highlightingConsumer, method, eventFunction, "Event function", myContext); myMarkedDeclarations.Add(method); } else { if (myMarkedDeclarations.Contains(declaredElement)) { continue; } myCommonIconProvider.AddFrequentlyCalledMethodHighlighting(highlightingConsumer, declaration, "Frequently called", "Frequently called code", myContext); } } committer(new DaemonStageResult(highlightingConsumer.Highlightings)); }
public override void Execute(Action <DaemonStageResult> committer) { var highlightingConsumer = new FilteringHighlightingConsumer(DaemonProcess.SourceFile, File, DaemonProcess.ContextBoundSettingsStore); File.ProcessThisAndDescendants(this, highlightingConsumer); foreach (var declaration in File.Descendants <ICSharpDeclaration>()) { var declaredElement = declaration.DeclaredElement; if (declaredElement == null) { continue; } if (myEventFunctions != null && myEventFunctions.Contains(declaredElement)) { var method = (declaredElement as IMethod).NotNull("method != null"); myUnityHighlightingContributor.AddUnityImplicitHighlightingForEventFunction(highlightingConsumer, method, myAPI.GetUnityEventFunction(method), myProcessKind); myMarkedDeclarations.Add(method); } else { if (myMarkedDeclarations.Contains(declaredElement)) { continue; } myUnityHighlightingContributor.AddHighlighting(highlightingConsumer, declaration, "Frequently called code", "Frequently called", myProcessKind, true); } } committer(new DaemonStageResult(highlightingConsumer.Highlightings)); }
public ElementProcessor([NotNull] CSharpDaemon myDaemon) { Consumer = new FilteringHighlightingConsumer(myDaemon, myDaemon.SettingsStore, myDaemon.CurrentCSharpFile); }