Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vs-editor-api.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Bockover <abock@microsoft.com>2019-10-09 19:20:50 +0300
committerAaron Bockover <abock@microsoft.com>2019-10-09 19:21:25 +0300
commitb9b507b8c9df9b55582caa660841821eb3d821ec (patch)
tree4272d33658a30cd7d1d77da0ec272489e34dbb06
parent18269c7aa4e83191e96c1291927db5d33a53696d (diff)
Sync with vs-editor-core@d2d414ba
-rw-r--r--src/Editor/Text/Def/Internal/TextUI/AdornmentPositioningBehavior2.cs38
-rw-r--r--src/Editor/Text/Def/Internal/TextUI/IPreviewTextViewModel.cs20
-rw-r--r--src/Editor/Text/Def/TextLogic/AssemblyInfo.cs21
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/BaseLeftBufferChangedEventArgs.cs24
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/DifferenceBufferProperties.cs20
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer2.cs39
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer3.cs16
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService.cs2
-rw-r--r--src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService2.cs59
-rw-r--r--src/Editor/Text/Def/TextUI/AssemblyInfo.cs2
-rw-r--r--src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerOptions.cs7
-rw-r--r--src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerRoles.cs28
-rw-r--r--src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer2.cs23
-rw-r--r--src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer3.cs20
-rw-r--r--src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewerTextViewModel.cs49
-rw-r--r--src/Editor/Text/Def/TextUI/Editor/ITextView3.cs2
-rw-r--r--src/Editor/Text/Def/TextUI/Editor/IViewSynchronizationManager.cs (renamed from src/Editor/Text/Def/Internal/TextUIWpf/IViewSynchronizationManager.cs)0
-rw-r--r--src/Editor/Text/Def/TextUI/EditorOptions/InternalOptions.cs30
-rw-r--r--src/Editor/Text/Def/TextUICocoa/DifferenceViewer/CreateTextViewHostCallback.cs30
-rw-r--r--src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewer.cs84
-rw-r--r--src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewerFactoryService.cs60
-rw-r--r--src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModel.cs25
-rw-r--r--src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModelProvider.cs30
-rw-r--r--src/Editor/Text/Impl/Outlining/OutliningManagerService.cs10
-rw-r--r--src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs8
25 files changed, 622 insertions, 25 deletions
diff --git a/src/Editor/Text/Def/Internal/TextUI/AdornmentPositioningBehavior2.cs b/src/Editor/Text/Def/Internal/TextUI/AdornmentPositioningBehavior2.cs
new file mode 100644
index 0000000..8991855
--- /dev/null
+++ b/src/Editor/Text/Def/Internal/TextUI/AdornmentPositioningBehavior2.cs
@@ -0,0 +1,38 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+// This file contain internal APIs that are subject to change without notice.
+// Use at your own risk.
+//
+namespace Microsoft.VisualStudio.Text.Editor
+{
+ /// <summary>
+ /// Defines the positioning of adornments.
+ /// </summary>
+ /// <remarks>
+ /// This enum adds a mode to the AdornmentPositioningBehavior needed for diff but we don't want to expose.
+ /// </remarks>
+ public enum AdornmentPositioningBehavior2
+ {
+ /// <summary>
+ /// The adornment is not moved automatically.
+ /// </summary>
+ OwnerControlled = XPlatAdornmentPositioningBehavior.OwnerControlled,
+
+ /// <summary>
+ /// The adornment is positioned relative to the top left corner of the view.
+ /// </summary>
+ ViewportRelative = XPlatAdornmentPositioningBehavior.ViewportRelative,
+
+ /// <summary>
+ /// The adornment is positioned relative to the text in the view.
+ /// </summary>
+ TextRelative = XPlatAdornmentPositioningBehavior.TextRelative,
+
+ /// <summary>
+ /// Behaves like a AdornmentPositioningBehavior.TextRelative adornment but only scrolls vertically.
+ /// </summary>
+ TextRelativeVerticalOnly
+ }
+} \ No newline at end of file
diff --git a/src/Editor/Text/Def/Internal/TextUI/IPreviewTextViewModel.cs b/src/Editor/Text/Def/Internal/TextUI/IPreviewTextViewModel.cs
new file mode 100644
index 0000000..e562367
--- /dev/null
+++ b/src/Editor/Text/Def/Internal/TextUI/IPreviewTextViewModel.cs
@@ -0,0 +1,20 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+// This file contain internal APIs that are subject to change without notice.
+// Use at your own risk.
+//
+namespace Microsoft.VisualStudio.Text.Editor
+{
+ /// <summary>
+ /// <see cref="ITextViewModel"/> used by the view shown when hovering over the scroll bar (which will have the <see cref="PredefinedTextViewRoles.PreviewTextView"/> role).
+ /// </summary>
+ public interface IPreviewTextViewModel : ITextViewModel
+ {
+ /// <summary>
+ /// Pointer to the view for which this is a preview.
+ /// </summary>
+ ITextView SourceView { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextLogic/AssemblyInfo.cs b/src/Editor/Text/Def/TextLogic/AssemblyInfo.cs
index 9f96b01..5c9cc55 100644
--- a/src/Editor/Text/Def/TextLogic/AssemblyInfo.cs
+++ b/src/Editor/Text/Def/TextLogic/AssemblyInfo.cs
@@ -26,7 +26,28 @@ using System.Security.Permissions;
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.Commanding.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Platform.VSEditor, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.UI.Utilities, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Language.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.TextViewUnitTestHelper, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Logic.Text.BufferUndoManager.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.EditorOptions.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.DifferenceViewer.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.Wpf.View.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.Cocoa.View.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Logic.Text.Tagging.Aggregator.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.UI.WPF.Utilities, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Language.Intellisense.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.DeferCreation.Implementation.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Logic.Text.Find.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Logic.Text.Find.Implementation.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Outlining.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.Wpf.OutliningMargin.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Implementation.StandaloneUndo, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Logic.Text.BufferUndoManager.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Internal.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.IndentationManager.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.EditorOperations.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Find.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/BaseLeftBufferChangedEventArgs.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/BaseLeftBufferChangedEventArgs.cs
new file mode 100644
index 0000000..2a4ddc8
--- /dev/null
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/BaseLeftBufferChangedEventArgs.cs
@@ -0,0 +1,24 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ using System;
+
+ /// <summary>
+ /// Raised whenever the left buffer of an <see cref="IDifferenceBuffer2"/> changes. This can only
+ /// happen if <see cref="IDifferenceBuffer2.HasFixedBaseLeftBuffer"/> is false.
+ /// </summary>
+ public class BaseLeftBufferChangedEventArgs : EventArgs
+ {
+ public BaseLeftBufferChangedEventArgs(ITextBuffer oldBuffer, ITextBuffer newBuffer)
+ {
+ this.OldBuffer = oldBuffer;
+ this.NewBuffer = newBuffer;
+ }
+
+ public ITextBuffer OldBuffer { get; }
+ public ITextBuffer NewBuffer { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/DifferenceBufferProperties.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/DifferenceBufferProperties.cs
new file mode 100644
index 0000000..abd4b7d
--- /dev/null
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/DifferenceBufferProperties.cs
@@ -0,0 +1,20 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ public static class DifferenceBufferProperties
+ {
+ /// <summary>
+ /// Add this property to an <see cref="ITextBuffer.Properties"/> to prevent a difference buffer from computing differences when the buffer
+ /// is used as the left buffer.
+ /// </summary>
+ /// <remarks>
+ /// This is intended for situations where you want to open a difference buffer but have not, yet, loaded the baseline. You can set the
+ /// <see cref="IDifferenceBuffer.BaseLeftBuffer"/> to this and then change it to the correct buffer once it is available.
+ /// </remarks>
+ public const string PlaceholderBuffer = "PlaceholderBuffer";
+ }
+}
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer2.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer2.cs
index ebfecb6..6370508 100644
--- a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer2.cs
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer2.cs
@@ -9,22 +9,35 @@ namespace Microsoft.VisualStudio.Text.Differencing
public interface IDifferenceBuffer2 : IDifferenceBuffer
{
/// <summary>
- /// The source of the left buffer in the difference. Can be set to null.
+ /// True if the BaseLeftBuffer can never change. If false, the BaseLeftBuffer can change (via setting the InnerLeftDataModel) and
+ /// can be null.
/// </summary>
- new ITextBuffer BaseLeftBuffer { get; set; }
+ bool HasFixedBaseLeftBuffer { get; }
- event EventHandler<BufferChangedEventArgs> BaseLeftBufferChanged;
- }
+ /// <summary>
+ /// Raised whenever the <see cref="IDifferenceBuffer.BaseLeftBuffer"/> is changed to a different buffer.
+ /// </summary>
+ event EventHandler<BaseLeftBufferChangedEventArgs> BaseLeftBufferChanged;
- public class BufferChangedEventArgs : EventArgs
- {
- public BufferChangedEventArgs(ITextBuffer oldBuffer, ITextBuffer newBuffer)
- {
- this.OldBuffer = oldBuffer;
- this.NewBuffer = newBuffer;
- }
+ /// <summary>
+ /// The <see cref="ITextDataModel"/> for the BaseLeftBuffer. This can be created even if <see cref="IDifferenceBuffer.BaseLeftBuffer"/> is null.
+ /// </summary>
+ ITextDataModel LeftDataModel { get; }
+
+ /// <summary>
+ /// The <see cref="ITextDataModel"/> actual ITextDataModel for the BaseLeftBuffer. This value is only meaningful if <see cref="HasFixedBaseLeftBuffer"/> is
+ /// false. Set InnerLeftDataModel to null to set the difference buffer's BaseLeftBuffer to null.
+ /// </summary>
+ ITextDataModel InnerLeftDataModel { get; set; }
- public ITextBuffer OldBuffer { get; }
- public ITextBuffer NewBuffer { get; }
+ /// <summary>
+ /// The <see cref="ITextDataModel"/> for the right buffer.
+ /// </summary>
+ ITextDataModel RightDataModel { get; }
+
+ /// <summary>
+ /// The <see cref="ITextDataModel"/> for the inline buffer. This can be created even if <see cref="IDifferenceBuffer.BaseLeftBuffer"/> is null.
+ /// </summary>
+ ITextDataModel InlineDataModel { get; }
}
}
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer3.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer3.cs
new file mode 100644
index 0000000..ce3ef4b
--- /dev/null
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBuffer3.cs
@@ -0,0 +1,16 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ using System;
+
+ public interface IDifferenceBuffer3 : IDifferenceBuffer2
+ {
+ /// <summary>
+ /// Raised whenever the <see cref="IDifferenceBuffer.BaseLeftBuffer"/> is about to change to a different buffer.
+ /// </summary>
+ event EventHandler<BaseLeftBufferChangedEventArgs> BaseLeftBufferChanging;
+ }
+}
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService.cs
index 5e5d61c..aaaeb26 100644
--- a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService.cs
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService.cs
@@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.Text.Differencing
/// </summary>
/// <param name="leftBaseBuffer">The left (old, before) buffer.</param>
/// <param name="rightBaseBuffer">The right (new, after) buffer.</param>
- /// <remarks>This is equivalent to calling <code>CreateDifferenceBuffer(left, right, new StringDifferenceOptions());</code>.</remarks>
+ /// <remarks>This is equivalent to calling <c>CreateDifferenceBuffer(left, right, new StringDifferenceOptions());</c>.</remarks>
IDifferenceBuffer CreateDifferenceBuffer(ITextBuffer leftBaseBuffer, ITextBuffer rightBaseBuffer);
/// <summary>
diff --git a/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService2.cs b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService2.cs
new file mode 100644
index 0000000..10cf48c
--- /dev/null
+++ b/src/Editor/Text/Def/TextLogic/DifferenceBuffer/IDifferenceBufferFactoryService2.cs
@@ -0,0 +1,59 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+using Microsoft.VisualStudio.Text.Projection;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// A factory for creating <see cref="IDifferenceBuffer"/> instances.
+ /// </summary>
+ /// <remarks>
+ /// This is a MEF service and can be imported.
+ /// </remarks>
+ public interface IDifferenceBufferFactoryService2 : IDifferenceBufferFactoryService
+ {
+ /// <summary>
+ /// Create an <see cref="IDifferenceBuffer"/> for the given left and right buffers and with the given difference options.
+ /// </summary>
+ /// <param name="leftBaseBuffer">The left (old, before) buffer.</param>
+ /// <param name="rightBaseBuffer">The right (new, after) buffer.</param>
+ /// <param name="options">The options to use in computing differences between the buffers.</param>
+ /// <param name="disableEditing">If true, disable editing in the right and inlines views.</param>
+ /// <param name="wrapLeftBuffer">If true, create a read-only projection of <paramref name="leftBaseBuffer"/> (which will prevent
+ /// that buffer from being modified through the difference buffers).</param>
+ /// <param name="wrapRightBuffer">If true and editing is disabled, create a read-only projection of <paramref name="rightBaseBuffer"/> (which will prevent
+ /// that buffer from being modified through the difference buffers).</param>
+ /// <param name="fixedBaseLeftBuffer">Allows, if false, the <see cref="IDifferenceBuffer.BaseLeftBuffer"/> can be changed.</param>
+ /// <remarks>
+ /// <para>If <paramref name="disableEditing"/> is false, then <paramref name="wrapRightBuffer"/> is ignored (and the right buffer will not be wrapped).</para>
+ /// <para>If <paramref name="wrapLeftBuffer"/> is false, then the caller of this method is responsible for making sure <paramref name="leftBaseBuffer"/> is read-only.</para>
+ /// <para>If <paramref name="disableEditing"/> is true and <paramref name="wrapRightBuffer"/> is false, then the caller of this method is responsible for making sure <paramref name="rightBaseBuffer"/> is read-only.</para>
+ /// <para>If <paramref name="fixedBaseLeftBuffer"/> is false, then <paramref name="wrapLeftBuffer"/> is ignored and <paramref name="leftBaseBuffer"/> can be null.</para>
+ /// </remarks>
+ IDifferenceBuffer2 CreateDifferenceBuffer(ITextBuffer leftBaseBuffer, ITextBuffer rightBaseBuffer, StringDifferenceOptions options,
+ bool disableEditing, bool wrapLeftBuffer, bool wrapRightBuffer, bool fixedBaseLeftBuffer);
+
+ /// <summary>
+ /// Create an <see cref="IDifferenceBuffer"/> for the given left and right buffers and with the given difference options.
+ /// </summary>
+ /// <param name="innerLeftDataModel">The data model for the left buffer. This can be null.</param>
+ /// <param name="rightDataModel">The right (new, after) buffer.</param>
+ /// <param name="options">The options to use in computing differences between the buffers.</param>
+ /// <param name="disableEditing">If true, disable editing in the right and inlines views.</param>
+ /// <param name="wrapLeftBuffer">If true, create a read-only projection of <paramref name="leftBaseBuffer"/> (which will prevent
+ /// that buffer from being modified through the difference buffers).</param>
+ /// <param name="wrapRightBuffer">If true and editing is disabled, create a read-only projection of <paramref name="rightBaseBuffer"/> (which will prevent
+ /// that buffer from being modified through the difference buffers).</param>
+ /// <param name="fixedBaseLeftBuffer">Allows, if false, the <see cref="IDifferenceBuffer.BaseLeftBuffer"/> can be changed.</param>
+ /// <remarks>
+ /// <para>If <paramref name="disableEditing"/> is false, then <paramref name="wrapRightBuffer"/> is ignored (and the right buffer will not be wrapped).</para>
+ /// <para>If <paramref name="wrapLeftBuffer"/> is false, then the caller of this method is responsible for making sure <paramref name="leftBaseBuffer"/> is read-only.</para>
+ /// <para>If <paramref name="disableEditing"/> is true and <paramref name="wrapRightBuffer"/> is false, then the caller of this method is responsible for making sure <paramref name="rightBaseBuffer"/> is read-only.</para>
+ /// <para>If <paramref name="fixedBaseLeftBuffer"/> is false, then <paramref name="wrapLeftBuffer"/> is ignored and <paramref name="innerLeftDataModel"/> can be null.</para>
+ /// </remarks>
+ IDifferenceBuffer2 CreateDifferenceBuffer(ITextDataModel innerLeftDataModel, ITextDataModel rightDataModel, StringDifferenceOptions options,
+ bool disableEditing, bool wrapLeftBuffer, bool wrapRightBuffer, bool fixedBaseLeftBuffer);
+ }
+}
diff --git a/src/Editor/Text/Def/TextUI/AssemblyInfo.cs b/src/Editor/Text/Def/TextUI/AssemblyInfo.cs
index e404e66..b904d55 100644
--- a/src/Editor/Text/Def/TextUI/AssemblyInfo.cs
+++ b/src/Editor/Text/Def/TextUI/AssemblyInfo.cs
@@ -16,6 +16,8 @@ using System.Security.Permissions;
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.UI.Text.Commanding.Implementation.UnitTests, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.UI.Utilities, PublicKey=" + ThisAssembly.PublicKey)]
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Platform.VSEditor, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.DifferenceViewer.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
+[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Outlining.Implementation, PublicKey=" + ThisAssembly.PublicKey)]
// InternalsVisibleTo for VS for Mac implementation assembly:
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Text.Implementation, PublicKey=0024000004800000940000000602000000240000525341310004000001000100e57febc1f220077550a65e338d3d15d7cbd189cf4f62f7c3829dcb2f8441a6c40631d172e3deb4dc0bb7237b44ec9daeb9bd7d72c3d64c4f52b968795443cb58bc341583c29440345b8c35f72f6a31aecb2903376136f8fc35779bb422eb643f8668fa6605c697bff927e3bb10745328ff878bd1b7e42bbcb839f04baa8460bd")]
diff --git a/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerOptions.cs b/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerOptions.cs
index d4b0ba3..21ae0f9 100644
--- a/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerOptions.cs
+++ b/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerOptions.cs
@@ -35,12 +35,17 @@ namespace Microsoft.VisualStudio.Text.Differencing
public static readonly EditorOptionKey<bool> SynchronizeSideBySideViewsId = new EditorOptionKey<bool>(DifferenceViewerOptions.SynchronizeSideBySideViewsName);
public const string SynchronizeSideBySideViewsName = "Diff/View/SynchronizeSideBySideViews";
-
/// <summary>
/// If <c>true</c>, show the difference overview margin.
/// </summary>
public static readonly EditorOptionKey<bool> ShowDiffOverviewMarginId = new EditorOptionKey<bool>(DifferenceViewerOptions.ShowDiffOverviewMarginName);
public const string ShowDiffOverviewMarginName = "Diff/View/ShowDiffOverviewMargin";
+
+ /// <summary>
+ /// If this is <c>false</c>, then the difference viewer will, even if a baseline has been specified, not show any differences.
+ /// </summary>
+ public static readonly EditorOptionKey<bool> ShowDifferencesId = new EditorOptionKey<bool>(DifferenceViewerOptions.ShowDifferencesName);
+ public const string ShowDifferencesName = "ShowDifferences";
}
/// <summary>
diff --git a/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerRoles.cs b/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerRoles.cs
index 77b7fa8..44e19c3 100644
--- a/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerRoles.cs
+++ b/src/Editor/Text/Def/TextUI/DifferenceViewer/DifferenceViewerRoles.cs
@@ -10,23 +10,43 @@ namespace Microsoft.VisualStudio.Text.Differencing
public static class DifferenceViewerRoles
{
/// <summary>
- /// The text view role for any view owned by an <see cref="IDifferenceViewer"/>.
+ /// The text view role for any view owned by an <see cref="IDifferenceViewer"/> when the underlying difference buffer will never have a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
/// </summary>
public const string DiffTextViewRole = "DIFF";
/// <summary>
- /// The text view role for the <see cref="IDifferenceViewer.LeftView"/>.
+ /// The text view role for the <see cref="IDifferenceViewer.LeftView"/> when the underlying difference buffer will never have a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
/// </summary>
public const string LeftViewTextViewRole = "LEFTDIFF";
/// <summary>
- /// The text view role for the <see cref="IDifferenceViewer.RightView"/>.
+ /// The text view role for the <see cref="IDifferenceViewer.RightView"/> when the underlying difference buffer will never have a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
/// </summary>
public const string RightViewTextViewRole = "RIGHTDIFF";
/// <summary>
- /// The text view role for the <see cref="IDifferenceViewer.InlineView"/>.
+ /// The text view role for the <see cref="IDifferenceViewer.InlineView"/> when the underlying difference buffer will never have a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
/// </summary>
public const string InlineViewTextViewRole = "INLINEDIFF";
+
+ /// <summary>
+ /// The text view role for any view owned by an <see cref="IDifferenceViewer"/> when the underlying difference buffer supports a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
+ /// </summary>
+ public const string UbiquitousDiffTextViewRole = "UBIDIFF";
+
+ /// <summary>
+ /// The text view role for the <see cref="IDifferenceViewer.LeftView"/> when the underlying difference buffer supports a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
+ /// </summary>
+ public const string UbiquitousLeftViewTextViewRole = "UBILEFTDIFF";
+
+ /// <summary>
+ /// The text view role for the <see cref="IDifferenceViewer.RightView"/> when the underlying difference buffer supports a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
+ /// </summary>
+ public const string UbiquitousRightViewTextViewRole = "UBIRIGHTDIFF";
+
+ /// <summary>
+ /// The text view role for the <see cref="IDifferenceViewer.InlineView"/> when the underlying difference buffer supports a null <see cref="IDifferenceBuffer.BaseLeftBuffer"/>.
+ /// </summary>
+ public const string UbiquitousInlineViewTextViewRole = "UBIINLINEDIFF";
}
}
diff --git a/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer2.cs b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer2.cs
index 3b9a4a8..e1e1055 100644
--- a/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer2.cs
+++ b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer2.cs
@@ -9,8 +9,27 @@ namespace Microsoft.VisualStudio.Text.Differencing
public interface IDifferenceViewer2 : IDifferenceViewer
{
/// <summary>
- /// Raised when the difference viewer is fully initialized.
+ /// Does the right view exist?
/// </summary>
- event EventHandler Initialized;
+ /// <remarks>
+ /// Differences views are created lazily <see cref="IDifferenceViewer.RightView"/> will create the view if it does not already exist.
+ /// </remarks>
+ bool RightViewExists { get; }
+
+ /// <summary>
+ /// Does the left view exist?
+ /// </summary>
+ /// <remarks>
+ /// Differences views are created lazily <see cref="IDifferenceViewer.LeftView"/> will create the view if it does not already exist.
+ /// </remarks>
+ bool LeftViewExists { get; }
+
+ /// <summary>
+ /// Does the Inline view exist?
+ /// </summary>
+ /// <remarks>
+ /// Differences views are created lazily <see cref="IDifferenceViewer.InlineView"/> will create the view if it does not already exist.
+ /// </remarks>
+ bool InlineViewExists { get; }
}
}
diff --git a/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer3.cs b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer3.cs
new file mode 100644
index 0000000..517a5b0
--- /dev/null
+++ b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewer3.cs
@@ -0,0 +1,20 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ using System;
+
+ public interface IDifferenceViewer3 : IDifferenceViewer2
+ {
+ /// <summary>
+ /// Should the differences be displayed?
+ /// </summary>
+ /// <remarks>
+ /// <para>This will be true if and only if there is a baseline and if the <see cref="DifferenceViewerOptions.ShowDifferencesId"/> option is true.</para>
+ /// <para><see cref="IDifferenceViewer.ViewModeChanged"/> will be raised whenever this value changes.</para>
+ /// </remarks>
+ bool DisplayDifferences { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewerTextViewModel.cs b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewerTextViewModel.cs
new file mode 100644
index 0000000..fa5a33a
--- /dev/null
+++ b/src/Editor/Text/Def/TextUI/DifferenceViewer/IDifferenceViewerTextViewModel.cs
@@ -0,0 +1,49 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// A <see cref="ITextViewModel"/> used by <see cref="IDifferenceViewer"/>.
+ /// </summary>
+ internal interface IDifferenceViewerTextViewModel
+ {
+ /// <summary>
+ /// The view type for a view created by an <see cref="IDifferenceViewer"/>.
+ /// </summary>
+ DifferenceViewType ViewType { get; }
+
+ /// <summary>
+ /// The currently-used snapshot difference that matches up with the current snapshot
+ /// of the inline buffer.
+ /// </summary>
+ /// <remarks>Will be <c>null</c> before the first snapshot difference is computed.</remarks>
+ ISnapshotDifference CurrentSnapshotDifference { get; }
+
+ /// <summary>
+ /// Are the left and right views are synchronized in the side by side view.
+ /// </summary>
+ /// <remarks>
+ /// <para>In the side by side view, the left and right views are, normally, synchronized so that so that matching text always shown in each view.
+ /// If this synchronization is turned off, then each view will scroll independently.</para>
+ /// </remarks>
+ bool AreViewsSynchronized { get; }
+
+ /// <summary>
+ /// The view for displaying the left buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when view mode
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ ITextView LeftView { get; }
+
+ /// <summary>
+ /// The view for displaying the right buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when view mode
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ ITextView RightView { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextUI/Editor/ITextView3.cs b/src/Editor/Text/Def/TextUI/Editor/ITextView3.cs
index b4a6a0f..f7b5b64 100644
--- a/src/Editor/Text/Def/TextUI/Editor/ITextView3.cs
+++ b/src/Editor/Text/Def/TextUI/Editor/ITextView3.cs
@@ -24,5 +24,7 @@ namespace Microsoft.VisualStudio.Text.Editor
bool IsKeyboardFocused { get; }
event EventHandler IsKeyboardFocusedChanged;
+
+ IViewSynchronizationManager SynchronizationManager { get; set; }
}
} \ No newline at end of file
diff --git a/src/Editor/Text/Def/Internal/TextUIWpf/IViewSynchronizationManager.cs b/src/Editor/Text/Def/TextUI/Editor/IViewSynchronizationManager.cs
index 70eddaa..70eddaa 100644
--- a/src/Editor/Text/Def/Internal/TextUIWpf/IViewSynchronizationManager.cs
+++ b/src/Editor/Text/Def/TextUI/Editor/IViewSynchronizationManager.cs
diff --git a/src/Editor/Text/Def/TextUI/EditorOptions/InternalOptions.cs b/src/Editor/Text/Def/TextUI/EditorOptions/InternalOptions.cs
new file mode 100644
index 0000000..3c23800
--- /dev/null
+++ b/src/Editor/Text/Def/TextUI/EditorOptions/InternalOptions.cs
@@ -0,0 +1,30 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+// This file contain internal APIs that are subject to change without notice.
+// Use at your own risk.
+//
+namespace Microsoft.VisualStudio.Text.Editor
+{
+ /// <summary>
+ /// Various editor options that we shouldn't be made public.
+ /// </remarks>
+ internal static class InternalOptions
+ {
+ public const string SuppressOutliningOptionName = "SuppressOutlining";
+ public readonly static EditorOptionKey<bool> SuppressOutliningOptionId = new EditorOptionKey<bool>(SuppressOutliningOptionName);
+
+ /// <summary>
+ /// The option definition that determines the vertical scroll sensitivity in Editor.
+ /// </summary>
+ internal static readonly EditorOptionKey<int> EditorVerticalScrollSensitivityId = new EditorOptionKey<int>(EditorVerticalScrollSensitivityName);
+ internal const string EditorVerticalScrollSensitivityName = "EditorVerticalScrollSensitivity";
+
+ /// <summary>
+ /// The option definition that determines the horizontal scroll sensitivity in Editor.
+ /// </summary>
+ internal static readonly EditorOptionKey<int> EditorHorizontalScrollSensitivityId = new EditorOptionKey<int>(EditorHorizontalScrollSensitivityName);
+ internal const string EditorHorizontalScrollSensitivityName = "EditorHorizontalScrollSensitivity";
+ }
+}
diff --git a/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/CreateTextViewHostCallback.cs b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/CreateTextViewHostCallback.cs
new file mode 100644
index 0000000..8afd865
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/CreateTextViewHostCallback.cs
@@ -0,0 +1,30 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+using System.Windows;
+using AppKit;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// Callback used with <see cref="ICocoaDifferenceViewerFactoryService"/> to create a text view host.
+ /// </summary>
+ /// <param name="textViewModel">The text view model to use in creating the text view.</param>
+ /// <param name="roles">The roles specific to this view.</param>
+ /// <param name="options">The options to use in creating the text view.</param>
+ /// <param name="visualElement">The top-level visual element for this host.</param>
+ /// <param name="textViewHost">The created text view host.</param>
+ /// <remarks>
+ /// <para>
+ /// To get standard text view roles, the implementation of this method should concatenate the given <paramref name="roles"/> with
+ /// <see cref="ITextEditorFactoryService.DefaultRoles"/>.
+ /// </para>
+ /// <para>
+ /// In most cases, the visual element can just be the <paramref name="textViewHost"/>'s <see cref="ICocoaTextViewHost.HostControl"/>.
+ /// </para>
+ /// </remarks>
+ public delegate void CreateTextViewHostCallback(IDifferenceTextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions options,
+ out NSView visualElement, out ICocoaTextViewHost textViewHost);
+}
diff --git a/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewer.cs b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewer.cs
new file mode 100644
index 0000000..cb5dd97
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewer.cs
@@ -0,0 +1,84 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+using System.Windows;
+using AppKit;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// A Cocoa-specific version of an <see cref="IDifferenceViewer"/>, which provides access to the
+ /// <see cref="VisualElement" /> used to host the viewer and the various text view hosts as <see cref="ICocoaTextViewHost" />.
+ /// </summary>
+ public interface ICocoaDifferenceViewer : IDifferenceViewer
+ {
+ /// <summary>
+ /// Initialize the DifferenceViewer, hooking it to the specified buffer and using the callback to create the text view hosts.
+ /// </summary>
+ /// <param name="differenceBuffer"></param>
+ /// <param name="createTextViewHost"></param>
+ /// <param name="parentOptions"></param>
+ /// <remarks>
+ /// <para>This method should only be called if the CreateUninitializedDifferenceView method on the <see cref="ICocoaDifferenceViewerFactoryService"/> is used. Otherwise, it is
+ /// called by the factory.</para>
+ /// <para>The viewer does not have to be initialized immediately. You can wait until the Loaded event on the VisualElement.</para>
+ /// </remarks>
+ void Initialize(IDifferenceBuffer differenceBuffer,
+ CreateTextViewHostCallback createTextViewHost,
+ IEditorOptions parentOptions = null);
+
+ /// <summary>
+ /// Has this viewer been initialized?
+ /// </summary>
+ bool IsInitialized { get; }
+
+ /// <summary>
+ /// The view for displaying <see cref="DifferenceViewMode.Inline"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.Inline"/>.</remarks>
+ new ICocoaTextView InlineView { get; }
+
+ /// <summary>
+ /// The view for displaying the left buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ new ICocoaTextView LeftView { get; }
+
+ /// <summary>
+ /// The view for displaying the right buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ new ICocoaTextView RightView { get; }
+
+ /// <summary>
+ /// The host for displaying <see cref="DifferenceViewMode.Inline"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.Inline"/>.</remarks>
+ ICocoaTextViewHost InlineHost { get; }
+
+ /// <summary>
+ /// The host for displaying the left buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ ICocoaTextViewHost LeftHost { get; }
+
+ /// <summary>
+ /// The host for displaying the right buffer for <see cref="DifferenceViewMode.SideBySide"/> differences.
+ /// </summary>
+ /// <remarks>Will never be <c>null</c>, but will only be visible when <see cref="IDifferenceViewer.ViewMode"/>
+ /// is set to <see cref="DifferenceViewMode.SideBySide"/>.</remarks>
+ ICocoaTextViewHost RightHost { get; }
+
+ /// <summary>
+ /// The visual element of this viewer.
+ /// </summary>
+ NSView VisualElement { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewerFactoryService.cs b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewerFactoryService.cs
new file mode 100644
index 0000000..2fda646
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/ICocoaDifferenceViewerFactoryService.cs
@@ -0,0 +1,60 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// A service for creating <see cref="ICocoaDifferenceViewer"/>s.
+ /// </summary>
+ /// <remarks>
+ /// This is a MEF service to be imported.
+ /// </remarks>
+ public interface ICocoaDifferenceViewerFactoryService
+ {
+ /// <summary>
+ /// Create an <see cref="IDifferenceViewer"/> over the given <see cref="IDifferenceBuffer"/>.
+ /// </summary>
+ /// <param name="buffer">The difference buffer to display.</param>
+ /// <param name="parentOptions">The parent of the editor options for the difference viewer (if null, the global options are the parent).</param>
+ /// <returns>A difference viewer.</returns>
+ ICocoaDifferenceViewer CreateDifferenceView(IDifferenceBuffer buffer, IEditorOptions parentOptions = null);
+
+ /// <summary>
+ /// Create an <see cref="IDifferenceViewer"/> over the given <see cref="IDifferenceBuffer"/> with the given set of roles.
+ /// </summary>
+ /// <param name="buffer">The difference buffer to display.</param>
+ /// <param name="roles">The text view roles to use for the created views.</param>
+ /// <param name="parentOptions">The parent of the editor options for the difference viewer (if null, the global options are the parent).</param>
+ /// <returns>A difference viewer.</returns>
+ ICocoaDifferenceViewer CreateDifferenceView(IDifferenceBuffer buffer, ITextViewRoleSet roles, IEditorOptions parentOptions = null);
+
+ /// <summary>
+ /// Create an <see cref="IDifferenceViewer"/> over the given <see cref="IDifferenceBuffer"/>, using the given
+ /// callback to create the individual views (inline, left, and right).
+ /// </summary>
+ /// <param name="buffer">The difference buffer to display.</param>
+ /// <param name="callback">The callback to use to create individual views.</param>
+ /// <param name="parentOptions">The parent of the editor options for the difference viewer (if null, the global options are the parent).</param>
+ /// <returns>A difference viewer.</returns>
+ ICocoaDifferenceViewer CreateDifferenceView(IDifferenceBuffer buffer, CreateTextViewHostCallback callback, IEditorOptions parentOptions = null);
+
+ /// <summary>
+ /// Create an <see cref="IDifferenceViewer"/> over the given <see cref="IDifferenceBuffer"/>, without initializing it.
+ /// </summary>
+ /// <returns>A difference viewer.</returns>
+ /// <remarks>
+ /// The only legitimate property call on an uninitialized viwer is the VisualElement property.
+ /// </remarks>
+ ICocoaDifferenceViewer CreateUninitializedDifferenceView();
+
+ /// <summary>
+ /// If the given text view is owned by a difference viewer, retrieve that difference viewer.
+ /// </summary>
+ /// <param name="textView">The view to find the difference viewer for.</param>
+ /// <returns>A difference viewer, if one exists. Otherwise, <c>null</c>.</returns>
+ ICocoaDifferenceViewer TryGetViewerForTextView(ITextView textView);
+ }
+}
diff --git a/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModel.cs b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModel.cs
new file mode 100644
index 0000000..e8a788f
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModel.cs
@@ -0,0 +1,25 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ using Microsoft.VisualStudio.Text.Editor;
+
+ /// <summary>
+ /// Represents a set of zero or more <see cref="ITextBuffer"/> objects that are unique to the presentation of text
+ /// in a particular <see cref="ITextView"/>.
+ /// </summary>
+ public interface IDifferenceTextViewModel : ITextViewModel
+ {
+ /// <summary>
+ /// A pointer to the difference viewer that created the view that uses this IDifferenceTextViewModel.
+ /// </summary>
+ ICocoaDifferenceViewer Viewer { get; }
+
+ /// <summary>
+ /// The type of the view that uses this IDifferenceTextViewModel.
+ /// </summary>
+ DifferenceViewType ViewType { get; }
+ }
+}
diff --git a/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModelProvider.cs b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModelProvider.cs
new file mode 100644
index 0000000..cce4075
--- /dev/null
+++ b/src/Editor/Text/Def/TextUICocoa/DifferenceViewer/IDifferenceTextViewModelProvider.cs
@@ -0,0 +1,30 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+//
+
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace Microsoft.VisualStudio.Text.Differencing
+{
+ /// <summary>
+ /// Provides <see cref="ITextViewModel"/> objects.
+ /// </summary>
+ /// <remarks>This is a MEF component part, and should be exported with the following attribute:
+ /// [Export(NameSource=typeof(ITextViewModelProvider))]
+ /// Component exporters must specify at least one ContentTypeAttribute characterizing the data
+ /// models to which they apply.
+ /// </remarks>
+ public interface IDifferenceTextViewModelProvider
+ {
+ /// <summary>
+ /// Creates an <see cref="ITextViewModel"/> for the given <see cref="ITextDataModel"/>.
+ /// </summary>
+ /// <param name="viewer">The <see cref="ICocoaDifferenceViewer"/> in which the views are being created.</param>
+ /// <param name="viewType">The <see cref="DifferenceViewType"/> of the view being created.</param>
+ /// <param name="dataModel">The <see cref="ITextDataModel"/> for which to create the <see cref="ITextViewModel"/>.</param>
+ /// <returns>The <see cref="ITextViewModel"/> created for <paramref name="dataModel"/>,
+ /// or <c>null</c> if the text view model cannot be created.</returns>
+ IDifferenceTextViewModel CreateTextViewModel(ICocoaDifferenceViewer viewer, DifferenceViewType viewType, ITextDataModel dataModel);
+ }
+}
diff --git a/src/Editor/Text/Impl/Outlining/OutliningManagerService.cs b/src/Editor/Text/Impl/Outlining/OutliningManagerService.cs
index 081672e..57e5dd5 100644
--- a/src/Editor/Text/Impl/Outlining/OutliningManagerService.cs
+++ b/src/Editor/Text/Impl/Outlining/OutliningManagerService.cs
@@ -12,6 +12,7 @@ namespace Microsoft.VisualStudio.Text.Outlining
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Threading;
+ using Microsoft.VisualStudio.Utilities;
using Microsoft.Win32;
[Export(typeof(IOutliningManagerService))]
@@ -41,5 +42,14 @@ namespace Microsoft.VisualStudio.Text.Outlining
return manager;
});
}
+
+ [Export(typeof(EditorOptionDefinition))]
+ [Name(InternalOptions.SuppressOutliningOptionName)]
+ internal sealed class SuppressOutliningOption : EditorOptionDefinition<bool>
+ {
+ public override bool Default => false;
+
+ public override EditorOptionKey<bool> Key => InternalOptions.SuppressOutliningOptionId;
+ }
}
}
diff --git a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs
index 4fd9847..256ccb8 100644
--- a/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs
+++ b/src/FPF/WindowsBase/System.Windows.Threading/DispatcherOperation.cs
@@ -7,6 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using CoreFoundation;
+using Foundation;
namespace System.Windows.Threading
{
@@ -56,7 +57,7 @@ namespace System.Windows.Threading
internal DispatcherOperation BeginInvoke()
{
- DispatchQueue.MainQueue.DispatchAsync(() =>
+ NSRunLoop.Main.BeginInvokeOnMainThread(() =>
{
CoreInvoke(beginInvokeBehavior: true);
if (exception != null)
@@ -71,7 +72,7 @@ namespace System.Windows.Threading
if (taskSource == null)
throw new InvalidOperationException();
- DispatchQueue.MainQueue.DispatchAsync(() =>
+ NSRunLoop.Main.BeginInvokeOnMainThread(() =>
{
try
{
@@ -102,8 +103,7 @@ namespace System.Windows.Threading
var mainQueue = DispatchQueue.MainQueue;
if (DispatchQueue.CurrentQueue != mainQueue)
- mainQueue.DispatchSync(
- () => CoreInvoke(beginInvokeBehavior: false));
+ NSRunLoop.Main.InvokeOnMainThread(() => CoreInvoke(beginInvokeBehavior: false));
else
CoreInvoke(beginInvokeBehavior: false);