private static void ValidateBufferContents(IEnumerable <ITextSnapshot> snapshots, AP.FileUpdateResponse response) { #if DEBUG if (response?.newCode == null) { return; } var total = snapshots.Aggregate(string.Empty, (t, s) => t + s.GetText()); if (response.newCode.TrimEnd() != total.TrimEnd()) { Console.Error.WriteLine($"New Code: {response.version} [{response.newCode}]"); Console.Error.WriteLine($"Snapshot: {string.Join(", ", snapshots.Select(s => s.Version.VersionNumber))} [{total}]"); Debug.Fail("Buffer content mismatch"); } #endif }
private static void ValidateBufferContents(IEnumerable <ITextSnapshot> snapshots, AP.FileUpdateResponse response) { #if DEBUG if (response.newCode == null) { return; } foreach (var snapshot in snapshots) { var bi = PythonTextBufferInfo.TryGetForBuffer(snapshot.TextBuffer); if (bi == null) { continue; } string newCode; if (!response.newCode.TryGetValue(bi.AnalysisBufferId, out newCode)) { continue; } if (newCode.TrimEnd() != snapshot.GetText().TrimEnd()) { Console.Error.WriteLine($"New Code: [{newCode}]"); Console.Error.WriteLine($"Snapshot: [{snapshot.GetText()}]"); Debug.Fail("Buffer content mismatch"); } } #endif }
private static void ValidateBufferContents(IEnumerable <ITextSnapshot> snapshots, AP.FileUpdateResponse response) { #if DEBUG if (response.newCode == null) { return; } foreach (var snapshot in snapshots) { var bi = PythonTextBufferInfo.TryGetForBuffer(snapshot.TextBuffer); if (bi == null) { continue; } string newCode; if (!response.newCode.TryGetValue(bi.AnalysisBufferId, out newCode)) { continue; } Debug.Assert(newCode.TrimEnd() == snapshot.GetText().TrimEnd(), "Buffer content mismatch"); } #endif }