internal static IEnumerable <AP.FileUpdate> GetUpdatesForSnapshot(PythonTextBufferInfo buffer, ITextSnapshot snapshot) { if (buffer.DoNotParse || snapshot.IsReplBufferWithCommand()) { yield break; } var lastSent = buffer.AddSentSnapshot(snapshot); // Update last sent snapshot and the analysis cookie to our // current snapshot. var entry = buffer.AnalysisEntry; if (entry != null) { entry.AnalysisCookie = new SnapshotCookie(snapshot); } if (lastSent == null || lastSent == snapshot || lastSent.TextBuffer != buffer.Buffer) { // First time parsing from a live buffer, send the entire // file and set our initial snapshot. We'll roll forward // to new snapshots when we receive the errors event. This // just makes sure that the content is in sync. yield return(new AP.FileUpdate { content = snapshot.GetText(), version = snapshot.Version.VersionNumber, kind = AP.FileUpdateKind.reset }); yield break; } foreach (var v in GetVersions(lastSent.Version, snapshot.Version)) { yield return(new AP.FileUpdate { version = v.VersionNumber + 1, changes = GetChanges(buffer, v).Reverse().ToArray(), kind = AP.FileUpdateKind.changes }); } }