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

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Osenkov <github@osenkov.com>2019-03-02 02:37:16 +0300
committerKirill Osenkov <github@osenkov.com>2019-03-02 02:37:16 +0300
commit4189c5bd0558ab4e130d39744db788c6f26b264d (patch)
tree2eacdf96e8999b727b7ffb57c3ab341321791693 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
parentfa8e2ecad143ebbba2c9c475f1a3ff4d499231aa (diff)
Allow setting UseAsyncCompletion per view.
Use the new completion in the new editor and old completion in the old editor. We have to hack into Roslyn's IAsyncCompletionService to set the private field accordingly because they don't support setting it per view. See related https://github.com/dotnet/roslyn/issues/33807
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
index ea63d55f6e..20d0e8cbfc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -945,6 +945,20 @@ namespace MonoDevelop.Ide.Editor
}
public event EventHandler Changed;
+
+ /// <summary>
+ /// This is to allow setting UseAsyncCompletion to true for the Cocoa editor and to false for the Gtk editor.
+ /// Currently Roslyn doesn't allow setting this option per view, so we have to work around.
+ /// See here for details: https://github.com/dotnet/roslyn/issues/33807
+ /// </summary>
+ internal static void SetUseAsyncCompletion(bool useAsyncCompletion)
+ {
+ var asyncCompletionService = Composition.CompositionManager.GetExportedValue<Microsoft.CodeAnalysis.Editor.IAsyncCompletionService> ();
+ var field = asyncCompletionService.GetType ().GetField (
+ "_newCompletionAPIEnabled",
+ System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
+ field.SetValue (asyncCompletionService, useAsyncCompletion);
+ }
}
}