From 86a7366187625da65e28087e5bb3d69ac25206f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Kr=C3=BCger?= Date: Fri, 12 Jul 2019 15:07:08 +0200 Subject: Fixes VSTS FeedbackTicket 943824: Diff Incorrect https://devdiv.visualstudio.com/DevDiv/_workitems/edit/943824 Diff View could be loaded before the text view had the text - that caused that the "local" text was empty. The blame view had the same issue (but crashed) - fixed that as well. --- .../MonoDevelop.VersionControl/BlameCommand.cs | 7 ++++++- .../MonoDevelop.VersionControl/DiffCommand.cs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs index d3757a0e81..ca73d7011c 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/BlameCommand.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Threading.Tasks; +using Microsoft.VisualStudio.Text.Editor; using Mono.Addins; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; @@ -52,7 +53,11 @@ namespace MonoDevelop.VersionControl foreach (var item in items) { var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer); - document?.GetContent ()?.ShowBlameView (); + if (document == null) + continue; + document.RunWhenContentAdded (tv => { + document.GetContent ()?.ShowBlameView (); + }); } return true; diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs index 408ad6a88f..33aeba3529 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/DiffCommand.cs @@ -26,6 +26,7 @@ using System.Linq; using System.Threading.Tasks; +using Microsoft.VisualStudio.Text.Editor; using Mono.Addins; using MonoDevelop.Ide; using MonoDevelop.Ide.Gui; @@ -51,7 +52,11 @@ namespace MonoDevelop.VersionControl foreach (var item in items) { var document = await IdeApp.Workbench.OpenDocument (item.Path, item.ContainerProject, OpenDocumentOptions.Default | OpenDocumentOptions.OnlyInternalViewer); - document?.GetContent ()?.ShowDiffView (); + if (document == null) + continue; + document.RunWhenContentAdded (tv => { + document.GetContent ()?.ShowDiffView (); + }); } return true; -- cgit v1.2.3