public BackgroundCompilation(CompilationTaggerProvider provider, ITextBuffer textBuffer) { this.provider = provider; this.textBuffer = new WeakReference <ITextBuffer>(textBuffer); this.cancellationTokenSource = new CancellationTokenSource(); this.compilationSnapshot = MetaDslx.VisualStudio.Classification.CompilationSnapshot.Default; this.backgroundCompilationSnapshot = MetaDslx.VisualStudio.Classification.CompilationSnapshot.Default; }
private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { CompilationSnapshot oldCompilation = this.backgroundCompilationSnapshot; if (this.compilationSnapshot != oldCompilation) { Interlocked.Exchange(ref this.compilationSnapshot, this.backgroundCompilationSnapshot); this.CompilationChanged?.Invoke(this, new CompilationChangedEventArgs(oldCompilation, this.compilationSnapshot)); } }
public CompilationErrorsSnapshot Update(string filePath, CompilationSnapshot compilationSnapshot) { Debug.Assert(this.NextSnapshot == null); Interlocked.CompareExchange(ref this.NextSnapshot, new CompilationErrorsSnapshot(filePath, this.versionNumber + 1, compilationSnapshot), null); return(this.NextSnapshot); }
internal CompilationErrorsSnapshot(string filePath, int versionNumber, CompilationSnapshot compilationSnapshot) { this.filePath = filePath; this.versionNumber = versionNumber; this.compilationSnapshot = compilationSnapshot; }
public CompilationChangedEventArgs(CompilationSnapshot oldCompilation, CompilationSnapshot newCompilation) { this.OldCompilation = oldCompilation; this.NewCompilation = newCompilation; }
internal void UpdateErrors(string filePath, CompilationSnapshot compilationSnapshot) { Interlocked.Exchange(ref this.currentSnapshot, this.currentSnapshot.Update(filePath, compilationSnapshot)); }