diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-09-19 21:07:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-19 21:07:22 +0300 |
commit | ee932b5ee232589a2486bc52bd3104183c6c1629 (patch) | |
tree | d484aba75e90637b7ea5ec2e64b76c02e8fa7ff8 /main | |
parent | 63dae6edb9737aa02e0e95a2283fd20ec783e665 (diff) | |
parent | 25d205c6cb92ee440c9b6eba4506ae36c64861c6 (diff) |
Merge pull request #8679 from mono/pr-sandy-blacklist
Prefer new editor by default for all file types
Diffstat (limited to 'main')
22 files changed, 227 insertions, 257 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml index cebdeb4c66..8182be3490 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/FSharpBinding.addin.xml @@ -70,6 +70,10 @@ <FileFilter id="F#" insertbefore="AllFiles" _label="F# Source Files" extensions="*.fs;*.fsi;*.fsx;*.fsscript"/> </Extension> + <Extension path="/MonoDevelop/TextEditor/LegacyEditorSupport"> + <LegacyEditorSupport id="fsharp" extensions=".fs,.fsi,.fsx,.fsscript" /> + </Extension> + <Extension path="/MonoDevelop/Ide/FileTemplates"> <FileTemplate id="EmptyFSharpSource" file="Templates/EmptyFSharpSource.xft.xml"/> <FileTemplate id="EmptyFSharpScript" file="Templates/EmptyFSharpScript.xft.xml"/> diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Properties/AddinInfo.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Properties/AddinInfo.fs index 7a70449da1..34a88151af 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Properties/AddinInfo.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Properties/AddinInfo.fs @@ -16,4 +16,5 @@ open Mono.Addins [<AddinDependency ("SourceEditor2", MonoDevelop.BuildInfo.Version)>] [<AddinDependency ("Refactoring", MonoDevelop.BuildInfo.Version)>] [<AddinDependency ("UnitTesting", MonoDevelop.BuildInfo.Version)>] +[<AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)>] ()
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/Gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs index 4934ac1188..8eb2ae3fb8 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/Gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/Gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs @@ -26,9 +26,6 @@ vbox1 vbox6 wordWrapCheckbutton antiAliasingCheckbutton - GtkLabel16 "Experimental" - alignment5 - experimentalSection */ private global::Gtk.VBox vbox1; @@ -69,12 +66,6 @@ vbox1 private global::Gtk.CheckButton antiAliasingCheckbutton; - private global::Gtk.Label GtkLabel16; - - private global::Gtk.Alignment alignment5; - - private global::Gtk.VBox experimentalSection; - protected virtual void Build() { MonoDevelop.Components.Gui.Initialize(this); @@ -254,35 +245,6 @@ vbox1 w19.Expand = false; w19.Fill = false; - // Container child vbox1.Gtk.Box+BoxChild - this.GtkLabel16 = new global::Gtk.Label (); - this.GtkLabel16.Name = "GtkLabel16"; - this.GtkLabel16.Xalign = 0F; - this.GtkLabel16.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>New Editor</b>"); - this.GtkLabel16.UseMarkup = true; - this.vbox1.Add (this.GtkLabel16); - global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.GtkLabel16])); - w20.Position = 6; - w20.Expand = false; - w20.Fill = false; - - // Container child vbox1.Gtk.Box+BoxChild - this.alignment5 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F); - this.alignment5.Name = "alignment5"; - this.alignment5.LeftPadding = ((uint)(12)); - - // Container child alignment3.Gtk.Container+ContainerChild - this.experimentalSection = new global::Gtk.VBox (); - this.experimentalSection.Name = "experimentalSection"; - this.experimentalSection.Spacing = 6; - - this.alignment5.Add (this.experimentalSection); - this.vbox1.Add (this.alignment5); - global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.alignment5])); - w22.Position = 7; - w22.Expand = false; - w22.Fill = false; - this.Add(this.vbox1); if ((this.Child != null)) { diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs index 00ffe30273..f3ebab4579 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs @@ -39,7 +39,6 @@ namespace MonoDevelop.SourceEditor.OptionPanels { partial class GeneralOptionsPanel : Gtk.Bin, IOptionsPanel { - readonly Xwt.CheckBox newEditorCheckBox; readonly Xwt.CheckBox wordWrapCheckBox; readonly Xwt.CheckBox wordWrapVisualGlyphsCheckBox; @@ -54,33 +53,19 @@ namespace MonoDevelop.SourceEditor.OptionPanels var newEditorOptionsBox = new Xwt.VBox (); - var newEditorLearnMoreLink = new Xwt.LinkLabel { - MarginBottom = 6, - MarginTop = 6, - Text = GettextCatalog.GetString ("Learn more about the New Editor"), - Uri = new Uri ("https://aka.ms/vs/mac/editor/learn-more") - }; - newEditorOptionsBox.PackStart (newEditorLearnMoreLink); - - newEditorCheckBox = new Xwt.CheckBox (GettextCatalog.GetString ("Open C# files in the New Editor")); - newEditorCheckBox.Active = DefaultSourceEditorOptions.Instance.EnableNewEditor; - newEditorCheckBox.Toggled += HandleNewEditorOptionToggled; - newEditorOptionsBox.PackStart (newEditorCheckBox); - wordWrapCheckBox = new Xwt.CheckBox (GettextCatalog.GetString ("_Word wrap")); - wordWrapCheckBox.MarginLeft = 18; wordWrapCheckBox.Active = DefaultSourceEditorOptions.Instance.WordWrapStyle.HasFlag (WordWrapStyles.WordWrap); wordWrapCheckBox.Toggled += HandleNewEditorOptionToggled; newEditorOptionsBox.PackStart (wordWrapCheckBox); wordWrapVisualGlyphsCheckBox = new Xwt.CheckBox (GettextCatalog.GetString ("Show visible glyphs for word wrap")); - wordWrapVisualGlyphsCheckBox.MarginLeft = 36; + wordWrapVisualGlyphsCheckBox.MarginLeft = 18; wordWrapVisualGlyphsCheckBox.Active = DefaultSourceEditorOptions.Instance.WordWrapStyle.HasFlag (WordWrapStyles.VisibleGlyphs); wordWrapVisualGlyphsCheckBox.Toggled += HandleNewEditorOptionToggled; newEditorOptionsBox.PackStart (wordWrapVisualGlyphsCheckBox); if (Xwt.Toolkit.CurrentEngine.Type == Xwt.ToolkitType.Gtk) - experimentalSection.PackStart ((Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (newEditorOptionsBox), false, false, 0); + vbox4.PackStart ((Gtk.Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget (newEditorOptionsBox), false, false, 0); else LoggingService.LogError ("GeneralOptionsPanel: Xwt.Toolkit.CurrentEngine.Type != Xwt.ToolkitType.Gtk - currently unsupported"); @@ -99,12 +84,10 @@ namespace MonoDevelop.SourceEditor.OptionPanels GettextCatalog.GetString ("Check to fold regions by default")); foldCommentsCheckbutton.SetCommonAccessibilityAttributes ("SourceEditorGeneral.commens", "", GettextCatalog.GetString ("Check to fold comments by default")); - newEditorCheckBox.SetCommonAccessibilityAttributes ("SourceEditorGeneral.newEditor", "", - GettextCatalog.GetString ("Check to enable experimental new editor")); wordWrapCheckBox.SetCommonAccessibilityAttributes ("SourceEditorGeneral.newEditor.wordWrap", "", - GettextCatalog.GetString ("Check to enable word wrap in the experimental new editor")); + GettextCatalog.GetString ("Check to enable word wrap in the modern editor")); wordWrapVisualGlyphsCheckBox.SetCommonAccessibilityAttributes ("SourceEditorGeneral.newEditor.wordWrap.enableVisualGlyphs", "", - GettextCatalog.GetString ("Check to enable visual word wrap glyphs in the experimental new editor")); + GettextCatalog.GetString ("Check to enable visual word wrap glyphs in the modern editor")); } public virtual Control CreatePanelWidget () @@ -129,14 +112,11 @@ namespace MonoDevelop.SourceEditor.OptionPanels DefaultSourceEditorOptions.Instance.ShowFoldMargin = this.foldingCheckbutton.Active; HighlightingPanel.UpdateActiveDocument (); } - - DefaultSourceEditorOptions.Instance.EnableNewEditor = this.newEditorCheckBox.Active; } void HandleNewEditorOptionToggled (object sender, EventArgs e) { - wordWrapCheckBox.Sensitive = newEditorCheckBox.Active; - wordWrapVisualGlyphsCheckBox.Sensitive = newEditorCheckBox.Active && wordWrapCheckBox.Active; + wordWrapVisualGlyphsCheckBox.Sensitive = wordWrapCheckBox.Active; var wrap = DefaultSourceEditorOptions.Instance.WordWrapStyle; diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs index e1a6298a58..d410381f1b 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs @@ -76,12 +76,6 @@ namespace MonoDevelop.TextEditor.Cocoa ICommandHandler<WordDeleteToEndCommandArgs>, ICommandHandler<WordDeleteToStartCommandArgs>, ICommandHandler<FindReferencesCommandArgs> -#if !WINDOWS - , - ICommandHandler<ProvideEditorFeedbackCommandArgs>, - ICommandHandler<DisableEditorPreviewCommandArgs>, - ICommandHandler<LearnAboutTheEditorCommandArgs> -#endif { [Import] private IEditorOperationsFactoryService OperationsService { get; set; } @@ -475,40 +469,5 @@ namespace MonoDevelop.TextEditor.Cocoa GetOperations(args.TextView).DeleteToBeginningOfLine(); return true; } - - #region Preview Editor Commands - -#if !WINDOWS - - CommandState ICommandHandler<ProvideEditorFeedbackCommandArgs>.GetCommandState (ProvideEditorFeedbackCommandArgs args) - => CommandState.Available; - - bool ICommandHandler<ProvideEditorFeedbackCommandArgs>.ExecuteCommand (ProvideEditorFeedbackCommandArgs args, CommandExecutionContext executionContext) - { - IdeServices.DesktopService.ShowUrl ("https://aka.ms/vs/mac/editor/report-problem"); - return true; - } - - CommandState ICommandHandler<LearnAboutTheEditorCommandArgs>.GetCommandState (LearnAboutTheEditorCommandArgs args) - => CommandState.Available; - - bool ICommandHandler<LearnAboutTheEditorCommandArgs>.ExecuteCommand (LearnAboutTheEditorCommandArgs args, CommandExecutionContext executionContext) - { - IdeServices.DesktopService.ShowUrl ("https://aka.ms/vs/mac/editor/learn-more"); - return true; - } - - CommandState ICommandHandler<DisableEditorPreviewCommandArgs>.GetCommandState (DisableEditorPreviewCommandArgs args) - => CommandState.Available; - - bool ICommandHandler<DisableEditorPreviewCommandArgs>.ExecuteCommand (DisableEditorPreviewCommandArgs args, CommandExecutionContext executionContext) - { - DefaultSourceEditorOptions.Instance.EnableNewEditor = false; - return true; - } - -#endif - -#endregion } } diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CSharpEnableNewEditorSwitchController.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/LegacyEditorSupportExtensionNode.cs index 8d5fbd8090..214a1c5082 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CSharpEnableNewEditorSwitchController.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/LegacyEditorSupportExtensionNode.cs @@ -1,10 +1,5 @@ // -// CSharpEnableNewEditorSwitchController.cs -// -// Author: -// Jérémie Laval <jelaval@microsoft.com> -// -// Copyright (c) 2019 Microsoft, Inc. +// Copyright (c) Microsoft Corp. (https://www.microsoft.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,21 +19,18 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -using System; -using MonoDevelop.Core.FeatureConfiguration; -using MonoDevelop.Ide.Editor; +using Mono.Addins; namespace MonoDevelop.TextEditor { - sealed class CSharpEnableNewEditorSwitchController : IFeatureSwitchController + sealed class LegacyEditorSupportExtensionNode : MatchingFileTypeExtensionNode { - const string FeatureName = "CSharpEnableNewEditor"; + [NodeAttribute("providerType", "Set this to the type name for a MonoDevelop.TextEditor.ILegacyEditorSupportProvider implementation, if more dynamic checking is required")] + public string ProviderType { get; private set; } + } - public bool? IsFeatureEnabled (string featureName) - { - if (!string.Equals (featureName, FeatureName, StringComparison.Ordinal)) - return null; - return DefaultSourceEditorOptions.Instance.EnableNewEditor; - } + public interface ILegacyEditorSupportProvider + { + bool PreferLegacyEditor (Ide.Gui.Documents.FileDescriptor modelDescriptor); } } diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml index 43d7daf4bc..184055099d 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml @@ -18,6 +18,10 @@ <ExtensionNode name="SupportedFileType" type="MonoDevelop.TextEditor.SupportedFileTypeExtensionNode" /> </ExtensionPoint> + <ExtensionPoint path="/MonoDevelop/TextEditor/LegacyEditorSupport" name="Opts in file types to be opened in the legacy editor"> + <ExtensionNode name="LegacyEditorSupport" type="MonoDevelop.TextEditor.LegacyEditorSupportExtensionNode" /> + </ExtensionPoint> + <!-- <ExtensionPoint path = "/MonoDevelop/TextEditor/ContextMenu/NavigationBar" name = "Navigation bar context menu"> <Description>Context menu for the navigation bar.</Description> @@ -59,15 +63,6 @@ <Assembly file="MonoDevelop.TextEditor.dll"/> </Extension> - <Extension path="/MonoDevelop/TextEditor/SupportedFileTypes"> - <SupportedFileType id="csharp" extensions=".cs,.csx" featureFlag="CSharpEnableNewEditor" /> - <SupportedFileType id="textmate" extensions=".py,.md,.txt,.c,.cpp,.cxx,.h,.php" featureFlag="CSharpEnableNewEditor" /> - </Extension> - - <Extension path="/MonoDevelop/Core/FeatureConfiguration/FeatureSwitchChecks"> - <Type id="CSharpEnableNewEditor" class="MonoDevelop.TextEditor.CSharpEnableNewEditorSwitchController" /> - </Extension> - <Extension path="/MonoDevelop/Ide/Commands"> <Category _name="Text Editor" id="TextEditor"> <Command id="MonoDevelop.Ide.Commands.TextEditorCommands.InsertNextMatchingCaret" diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/SupportedFileTypeExtensionNode.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/SupportedFileTypeExtensionNode.cs index d24dde35d0..44b5f22ffe 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/SupportedFileTypeExtensionNode.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/SupportedFileTypeExtensionNode.cs @@ -1,43 +1,46 @@ -//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using Mono.Addins;
-
+// +// Copyright (c) Microsoft Corp. (https://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using Mono.Addins; + namespace MonoDevelop.TextEditor { - sealed class SupportedFileTypeExtensionNode : ExtensionNode
- {
+ class MatchingFileTypeExtensionNode : ExtensionNode + { [NodeAttribute ("extensions", "Comma separated list of file extensions. The file must match one of these or one of the mime types.")] - public string [] Extensions { get; private set; }
-
+ public string [] Extensions { get; private set; } + [NodeAttribute ("mimeTypes", "Comma separated list of mime types. The file must match one of these or one of the extensions.")] - public string [] MimeTypes { get; private set; }
-
- [NodeAttribute ("buildAction", Description = "If specified, the file must have this build action")]
- public string BuildAction { get; private set; }
-
- [NodeAttribute ("featureFlag", Description = "ID of a feature flag that can be used to enable/disable editing of this file type in the new editor")]
- public string FeatureFlag { get; private set; }
-
- [NodeAttribute ("featureFlagDefault", Description = "Default value of the feature flag")]
- public bool FeatureFlagDefault { get; private set; }
+ public string [] MimeTypes { get; private set; } + } + + sealed class SupportedFileTypeExtensionNode : MatchingFileTypeExtensionNode + { + [NodeAttribute ("buildAction", Description = "If specified, the file must have this build action")] + public string BuildAction { get; private set; } + + [NodeAttribute ("featureFlag", Description = "ID of a feature flag that can be used to enable/disable editing of this file type in the modern editor")] + public string FeatureFlag { get; private set; } + + [NodeAttribute ("featureFlagDefault", Description = "Default value of the feature flag")] + public bool FeatureFlagDefault { get; private set; } } }
\ No newline at end of file diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs index 1637ad2bd4..93811e16d4 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs @@ -21,14 +21,14 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; + using MonoDevelop.Core; using MonoDevelop.Ide; -using MonoDevelop.Ide.Editor; using MonoDevelop.Ide.Gui.Documents; using MonoDevelop.Projects; using MonoDevelop.Core.FeatureConfiguration; -using System.Linq; namespace MonoDevelop.TextEditor { @@ -36,38 +36,84 @@ namespace MonoDevelop.TextEditor where TImports : TextViewImports { ThemeToClassification themeToClassification; + readonly Dictionary<(string addinId, string providerType), ILegacyEditorSupportProvider> legacyEditorSupportProviders = + new Dictionary<(string addinId, string providerType), ILegacyEditorSupportProvider> (); + + readonly Lazy<bool> alwaysUseLegacyEditor = new Lazy<bool> ( + () => FeatureSwitchService.IsFeatureEnabled ("AlwaysUseLegacyEditor").GetValueOrDefault ()); public override string Id => "MonoDevelop.TextEditor.TextViewControllerFactory"; protected override IEnumerable<DocumentControllerDescription> GetSupportedControllers (FileDescriptor modelDescriptor) { - var nodes = Mono.Addins.AddinManager.GetExtensionNodes<SupportedFileTypeExtensionNode> ("/MonoDevelop/TextEditor/SupportedFileTypes"); - - bool supported = - ( - modelDescriptor.FilePath.IsNotNull - && IdeServices.DesktopService.GetFileIsText (modelDescriptor.FilePath, modelDescriptor.MimeType) - && nodes.Any (n => ExtensionMatch (n) && BuildActionAndFeatureFlagMatch (n)) - ) || ( - !string.IsNullOrEmpty (modelDescriptor.MimeType) - && IdeServices.DesktopService.GetMimeTypeIsText (modelDescriptor.MimeType) - && nodes.Any (n => MimeMatch (n) && BuildActionAndFeatureFlagMatch (n)) - ); + var isTextByFilePath = modelDescriptor.FilePath.IsNotNull && IdeServices.DesktopService.GetFileIsText (modelDescriptor.FilePath, modelDescriptor.MimeType); + var isTextByMimeType = !string.IsNullOrEmpty (modelDescriptor.MimeType) && IdeServices.DesktopService.GetMimeTypeIsText (modelDescriptor.MimeType); + + if (!isTextByFilePath && !isTextByMimeType) + yield break; + + // If feature switch is enabled, don't even bother checking for modern editor support. + // This should only be used by automatic testing tooling that hasn't updated to support modern editor yet. + var preferLegacy = alwaysUseLegacyEditor.Value; + if (!preferLegacy) { + // First, check if legacy editor even has support for the file. If not, always use modern editor. + var legacySupportNodes = Mono.Addins.AddinManager.GetExtensionNodes<LegacyEditorSupportExtensionNode> ("/MonoDevelop/TextEditor/LegacyEditorSupport"); + foreach (var node in legacySupportNodes.OrderByDescending (n => string.IsNullOrEmpty (n.ProviderType))) { + if ((isTextByFilePath && ExtensionMatch (node)) || (isTextByMimeType && MimeMatch (node))) { + preferLegacy = true; + break; + } + + // Only attempt a provider check if extension/mimetype checks already failed, as it's more expensive. + if (PrefersLegacyEditor (node)) { + preferLegacy = true; + break; + } + } - if (supported) { - yield return new DocumentControllerDescription (GettextCatalog.GetString ("New Source Code Editor"), true, DocumentControllerRole.Source); + // Next, check if there is an explicit directive to prefer the modern editor even if legacy is supported. + if (preferLegacy) { + var explicitModernSupportNodes = Mono.Addins.AddinManager.GetExtensionNodes<SupportedFileTypeExtensionNode> ("/MonoDevelop/TextEditor/SupportedFileTypes"); + foreach (var node in explicitModernSupportNodes) { + if (((isTextByFilePath && ExtensionMatch (node)) || (isTextByMimeType && MimeMatch (node))) && BuildActionAndFeatureFlagMatch (node)) { + preferLegacy = false; + break; + } + } + } } - bool ExtensionMatch (SupportedFileTypeExtensionNode node) => + yield return new EditorDocumentControllerDescription (GettextCatalog.GetString ("Source Code Editor"), true, DocumentControllerRole.Source, preferLegacy); + + bool ExtensionMatch (MatchingFileTypeExtensionNode node) => node.Extensions != null && node.Extensions.Any (ext => modelDescriptor.FilePath.HasExtension (ext)); - bool MimeMatch (SupportedFileTypeExtensionNode node) => + bool MimeMatch (MatchingFileTypeExtensionNode node) => node.MimeTypes != null && node.MimeTypes.Any ( mime => string.Equals (modelDescriptor.MimeType, mime, StringComparison.OrdinalIgnoreCase) ); + bool PrefersLegacyEditor (LegacyEditorSupportExtensionNode node) + { + if (string.IsNullOrEmpty (node.ProviderType)) + return false; + + try { + var key = (node.Addin.Id, node.ProviderType); + if (!legacyEditorSupportProviders.TryGetValue (key, out var provider)) { + provider = (ILegacyEditorSupportProvider)Activator.CreateInstance (node.Addin.GetType (node.ProviderType)); + legacyEditorSupportProviders [key] = provider; + } + return provider.PreferLegacyEditor (modelDescriptor); + } catch (Exception e) { + LoggingService.LogError ("Error loading legacy editor support provider", e); + } + + return false; + } + bool BuildActionAndFeatureFlagMatch (SupportedFileTypeExtensionNode node) { if (!string.IsNullOrEmpty (node.FeatureFlag)) { @@ -87,6 +133,9 @@ namespace MonoDevelop.TextEditor public override Task<DocumentController> CreateController (FileDescriptor modelDescriptor, DocumentControllerDescription controllerDescription) { + if (controllerDescription is EditorDocumentControllerDescription editorControllerDescription && editorControllerDescription.IsLegacy) + return Task.FromResult<DocumentController> (new Ide.Editor.TextEditorViewContent ()); + var imports = Ide.Composition.CompositionManager.Instance.GetExportedValue<TImports> ();
if (themeToClassification == null)
themeToClassification = CreateThemeToClassification (imports.EditorFormatMapService);
@@ -103,5 +152,16 @@ namespace MonoDevelop.TextEditor themeToClassification?.Dispose ();
themeToClassification = null;
}
+
+ class EditorDocumentControllerDescription : DocumentControllerDescription + { + public bool IsLegacy { get; } + + public EditorDocumentControllerDescription (string name, bool canUseAsDefault = true, DocumentControllerRole role = DocumentControllerRole.Source, bool isLegacy = false) + : base (name, canUseAsDefault, role) + { + IsLegacy = isLegacy; + } + }
} } diff --git a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs index 666275f071..c0b0a3a1fe 100644 --- a/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs +++ b/main/src/addins/Xml/Editor/BaseXmlEditorExtension.cs @@ -540,7 +540,7 @@ namespace MonoDevelop.Xml.Editor } } - protected virtual ICompletionDataList ClosingTagCompletion (TextEditor buf, DocumentLocation currentLocation) + protected virtual ICompletionDataList ClosingTagCompletion (MonoDevelop.Ide.Editor.TextEditor buf, DocumentLocation currentLocation) { // This is handled sooner in UI thread before it's offloaded to background thread by code completion if (XmlEditorOptions.AutoCompleteElements) diff --git a/main/src/addins/Xml/Editor/LegacyEditorSupportProvider.cs b/main/src/addins/Xml/Editor/LegacyEditorSupportProvider.cs new file mode 100644 index 0000000000..cbaad06799 --- /dev/null +++ b/main/src/addins/Xml/Editor/LegacyEditorSupportProvider.cs @@ -0,0 +1,45 @@ +// +// Copyright (c) Microsoft Corp. (https://www.microsoft.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using MonoDevelop.Ide; +using MonoDevelop.Ide.Gui.Documents; +using MonoDevelop.TextEditor; + +namespace MonoDevelop.Xml.Editor +{ + public class LegacyEditorSupportProvider : ILegacyEditorSupportProvider + { + public bool PreferLegacyEditor (FileDescriptor modelDescriptor) + { + var mimeType = modelDescriptor.MimeType; + if (string.IsNullOrEmpty (mimeType)) + mimeType = MimeTypeCatalog.Instance.FindMimeTypeForFile (modelDescriptor.FilePath)?.Id; + + if (!string.IsNullOrEmpty (mimeType) && MimeTypeCatalog.Instance.GetMimeTypeIsSubtype ( + mimeType, + MimeTypeCatalog.ApplicationXml)) + return true; + + + return XmlFileAssociationManager.GetAssociationForFileName (modelDescriptor.FilePath) != null; + } + } +} diff --git a/main/src/addins/Xml/Editor/XmlEditorService.cs b/main/src/addins/Xml/Editor/XmlEditorService.cs index fbdc9007d2..b2f4c61206 100644 --- a/main/src/addins/Xml/Editor/XmlEditorService.cs +++ b/main/src/addins/Xml/Editor/XmlEditorService.cs @@ -51,7 +51,7 @@ namespace MonoDevelop.Xml.Editor /// Creates a XmlTextWriter using the current text editor /// properties for indentation. /// </summary> - public static XmlTextWriter CreateXmlTextWriter (TextEditor doc, TextWriter textWriter) + public static XmlTextWriter CreateXmlTextWriter (MonoDevelop.Ide.Editor.TextEditor doc, TextWriter textWriter) { var xmlWriter = new XmlTextWriter (textWriter) { Formatting = System.Xml.Formatting.Indented @@ -66,7 +66,7 @@ namespace MonoDevelop.Xml.Editor return xmlWriter; } - public static string CreateSchema (TextEditor doc, string xml) + public static string CreateSchema (MonoDevelop.Ide.Editor.TextEditor doc, string xml) { using (var dataSet = new System.Data.DataSet()) { dataSet.ReadXml(new StringReader (xml), System.Data.XmlReadMode.InferSchema); diff --git a/main/src/addins/Xml/Editor/XmlExpandSelectionHandler.cs b/main/src/addins/Xml/Editor/XmlExpandSelectionHandler.cs index be459245bc..54b8238608 100644 --- a/main/src/addins/Xml/Editor/XmlExpandSelectionHandler.cs +++ b/main/src/addins/Xml/Editor/XmlExpandSelectionHandler.cs @@ -31,7 +31,7 @@ namespace MonoDevelop.Xml.Editor { class XmlExpandSelectionHandler { - public static bool CanExpandSelection (TextEditor editor) + public static bool CanExpandSelection (MonoDevelop.Ide.Editor.TextEditor editor) { if (!editor.IsSomethingSelected) { return true; @@ -42,7 +42,7 @@ namespace MonoDevelop.Xml.Editor return false; } - internal static void ExpandSelection (TextEditor editor, Func<XmlParser> getTreeParser) + internal static void ExpandSelection (MonoDevelop.Ide.Editor.TextEditor editor, Func<XmlParser> getTreeParser) { var selectionAnnotation = GetAnnotation (editor, getTreeParser); if (selectionAnnotation.NodePath.Count == 0) @@ -54,12 +54,12 @@ namespace MonoDevelop.Xml.Editor } } - public static bool CanShrinkSelection (TextEditor editor) + public static bool CanShrinkSelection (MonoDevelop.Ide.Editor.TextEditor editor) { return editor.IsSomethingSelected && editor.Selections.Count () == 1; } - internal static void ShrinkSelection (TextEditor editor, Func<XmlParser> getTreeParser) + internal static void ShrinkSelection (MonoDevelop.Ide.Editor.TextEditor editor, Func<XmlParser> getTreeParser) { var selectionAnnotation = GetAnnotation (editor, getTreeParser); if (selectionAnnotation.NodePath.Count == 0) @@ -73,7 +73,7 @@ namespace MonoDevelop.Xml.Editor } } - static XmlExpandSelectionAnnotation GetAnnotation (TextEditor editor, Func<XmlParser> getTreeParser) + static XmlExpandSelectionAnnotation GetAnnotation (MonoDevelop.Ide.Editor.TextEditor editor, Func<XmlParser> getTreeParser) { var result = editor.Annotation<XmlExpandSelectionAnnotation> (); if (result == null) { @@ -98,13 +98,13 @@ namespace MonoDevelop.Xml.Editor ImmutableStack<(int, SelectionLevel)> expansions = ImmutableStack<(int, SelectionLevel)>.Empty; readonly IReadonlyTextDocument document; - readonly TextEditor editor; + readonly MonoDevelop.Ide.Editor.TextEditor editor; readonly XmlParser parser; public List<XObject> NodePath { get; } public int Index { get; set; } = -1; public SelectionLevel Level { get; set; } - public XmlExpandSelectionAnnotation (TextEditor editor, XmlParser parser) + public XmlExpandSelectionAnnotation (MonoDevelop.Ide.Editor.TextEditor editor, XmlParser parser) { this.parser = parser; this.editor = editor; diff --git a/main/src/addins/Xml/MonoDevelop.Xml.csproj b/main/src/addins/Xml/MonoDevelop.Xml.csproj index 270568d443..22aaf7430f 100644 --- a/main/src/addins/Xml/MonoDevelop.Xml.csproj +++ b/main/src/addins/Xml/MonoDevelop.Xml.csproj @@ -58,6 +58,10 @@ <Name>Xwt</Name> <Private>False</Private> </ProjectReference> + <ProjectReference Include="..\MonoDevelop.TextEditor\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj"> + <Project>{3F5B5BDA-69D5-441A-8142-AA25C998A997}</Project> + <Name>MonoDevelop.TextEditor</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <EmbeddedResource Include="icons\prefs-xml-16.png" /> @@ -143,6 +147,7 @@ <Compile Include="Editor\XmlCommands.cs" /> <Compile Include="Editor\EncodedStringWriter.cs" /> <Compile Include="Editor\XmlExpandSelectionHandler.cs" /> + <Compile Include="Editor\LegacyEditorSupportProvider.cs" /> </ItemGroup> <ItemGroup> <Content Include="schemas\appconfig.xsd"> diff --git a/main/src/addins/Xml/Properties/AddinInfo.cs b/main/src/addins/Xml/Properties/AddinInfo.cs index 1878cdf5ab..c259fb73e2 100644 --- a/main/src/addins/Xml/Properties/AddinInfo.cs +++ b/main/src/addins/Xml/Properties/AddinInfo.cs @@ -12,3 +12,4 @@ using Mono.Addins; [assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)] [assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)] [assembly:AddinDependency ("SourceEditor2", MonoDevelop.BuildInfo.Version)] +[assembly:AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)] diff --git a/main/src/addins/Xml/Properties/MonoDevelop.XmlEditor.addin.xml b/main/src/addins/Xml/Properties/MonoDevelop.XmlEditor.addin.xml index 56ff59a34e..b1994e7bb1 100644 --- a/main/src/addins/Xml/Properties/MonoDevelop.XmlEditor.addin.xml +++ b/main/src/addins/Xml/Properties/MonoDevelop.XmlEditor.addin.xml @@ -27,6 +27,10 @@ <Association extension = ".xslt" namespaceUri="http://www.w3.org/1999/XSL/Transform" namespacePrefix="xsl" />
<Association extension = ".stetic" />
</Extension>
+
+ <Extension path="/MonoDevelop/TextEditor/LegacyEditorSupport">
+ <LegacyEditorSupport id="xml" providerType="MonoDevelop.Xml.Editor.LegacyEditorSupportProvider" />
+ </Extension>
<Extension path = "/MonoDevelop/Xml/Editor/XmlSchemas">
<Schema file="schemas/xml.xsd" />
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs index e5df97fb31..96ccc81050 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs @@ -10,6 +10,6 @@ namespace MonoDevelop.Ide.Composition internal class EditorExperimentationServiceInternal : IExperimentationServiceInternal
{
public bool IsCachedFlightEnabled (string flightName)
- => flightName == "CompletionAPI" && DefaultSourceEditorOptions.Instance.EnableNewEditor;
+ => flightName == "CompletionAPI";
}
}
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 9a47f7e362..cc9805e70f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs @@ -402,55 +402,6 @@ namespace MonoDevelop.Ide.Editor } } - ConfigurationProperty<bool> preferLegacyEditor = ConfigurationProperty.Create ("PreferLegacyEditor", false); - public bool EnableNewEditor { - // NOTE: as we're making this editor the default, we've switched to a new configuration property, - // and we'll simply flip the value that we're getting from that. The code below might be a bit convoluted, - // but it means we don't have additional changes - get { - return !preferLegacyEditor; - } - set { - value = !value; //see notes above - if (!preferLegacyEditor.Set (value)) - return; - - string messageText; - - if (!value) { - messageText = GettextCatalog.GetString ( - "The New Editor Preview has been enabled, but already opened files " + - "will need to be closed and re-opened for the change to take effect."); - Counters.NewEditorEnabled.Inc (); - } else { - messageText = GettextCatalog.GetString ( - "The New Editor Preview has been disabled, but already opened files " + - "will need to be closed and re-opened for the change to take effect."); - Counters.NewEditorDisabled.Inc (); - } - - if (IdeApp.Workbench?.Documents?.Count > 0) { - Gtk.Application.Invoke ((o, e) => { - var closeAllFilesButton = new AlertButton (GettextCatalog.GetString ("Close All Files")); - - var message = new MessageDescription { - Text = messageText - }; - - message.Buttons.Add (closeAllFilesButton); - message.Buttons.Add (AlertButton.Ok); - message.DefaultButton = 1; - - if (new AlertDialog (message).Run () == closeAllFilesButton) - IdeApp.Workbench.CloseAllDocuments (false); - }); - } - - OnChanged (EventArgs.Empty); - } - } - - // TODO: Windows equivalent? ConfigurationProperty<bool> enableSemanticHighlighting = ConfigurationProperty.Create ("EnableSemanticHighlighting", true); public bool EnableSemanticHighlighting { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs index 105b17f991..9e46365e8a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorDisplayBinding.cs @@ -23,6 +23,9 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. + +#if !MAC + using System; using MonoDevelop.Core; using MonoDevelop.Ide.Gui; @@ -69,4 +72,6 @@ namespace MonoDevelop.Ide.Editor public override string Id => "MonoDevelop.Ide.Editor.TextEditorDisplayBinding"; } -}
\ No newline at end of file +} + +#endif
\ No newline at end of file diff --git a/main/tests/StressTest/MonoDevelop.StressTest/StressTestApp.cs b/main/tests/StressTest/MonoDevelop.StressTest/StressTestApp.cs index 43e39c98d2..36bd12a8b6 100644 --- a/main/tests/StressTest/MonoDevelop.StressTest/StressTestApp.cs +++ b/main/tests/StressTest/MonoDevelop.StressTest/StressTestApp.cs @@ -73,7 +73,7 @@ namespace MonoDevelop.StressTest scenario = provider.GetTestScenario (); if (!StartWithProfiler (profilePath, logFile)) - TestService.StartSession (MonoDevelopBinPath, profilePath, logFile); + TestService.StartSession (MonoDevelopBinPath, profilePath, logFile, useNewEditor: Properties.UseNewEditor); TestService.Session.DebugObject = new UITestDebug (); @@ -147,7 +147,7 @@ namespace MonoDevelop.StressTest .Select (p => Path.Combine (p, "mono")) .FirstOrDefault (s => File.Exists (s)); - TestService.StartSession (monoPath, profilePath, logFile, $"{profilerProcessor.GetMonoArguments ()} \"{MonoDevelopBinPath}\""); + TestService.StartSession (monoPath, profilePath, logFile, $"{profilerProcessor.GetMonoArguments ()} \"{MonoDevelopBinPath}\"", useNewEditor: Properties.UseNewEditor); Console.WriteLine ($"Profler is logging into {ProfilerOptions.MlpdOutputPath}"); return true; } diff --git a/main/tests/StressTest/UserInterfaceTests/Properties.cs b/main/tests/StressTest/UserInterfaceTests/Properties.cs index 62eea0c8c2..580a61f1b8 100644 --- a/main/tests/StressTest/UserInterfaceTests/Properties.cs +++ b/main/tests/StressTest/UserInterfaceTests/Properties.cs @@ -5,11 +5,6 @@ namespace MonoDevelop.StressTest { public static class Properties { - const string useNewEditorProperty = "MonoDevelop.Ide.Editor.DefaultSourceEditorOptions.Instance.EnableNewEditor"; - - public static bool UseNewEditor { - get => TestService.Session.GetGlobalValue<bool> (useNewEditorProperty); - set => TestService.Session.SetGlobalValue (useNewEditorProperty, value); - } + public static bool UseNewEditor { get; set; } = false; } } diff --git a/main/tests/UserInterfaceTests/TestService.cs b/main/tests/UserInterfaceTests/TestService.cs index 863100afd0..fa9ebd6f70 100644 --- a/main/tests/UserInterfaceTests/TestService.cs +++ b/main/tests/UserInterfaceTests/TestService.cs @@ -34,17 +34,25 @@ namespace UserInterfaceTests { public static AutoTestClientSession Session { get; private set; } - public static void StartSession (string file = null, string profilePath = null, string logFile = null, string args = null) + public static void StartSession (string file = null, string profilePath = null, string logFile = null, string args = null, bool useNewEditor = true) { Session = new AutoTestClientSession (); profilePath = profilePath ?? Util.CreateTmpDir ("profile"); - Session.StartApplication (file: file, args: args, environment: new Dictionary<string, string> { + + var env = new Dictionary<string, string> { { "MONODEVELOP_PROFILE", profilePath }, { "VISUALSTUDIO_PROFILE", profilePath }, { "MONODEVELOP_LOG_FILE", logFile }, { "MONODEVELOP_FILE_LOG_LEVEL", "UpToInfo" }, - }); + }; + + if (!useNewEditor) { + Console.WriteLine ("Using legacy editor"); + env.Add ("MD_FEATURES_ENABLED", "AlwaysUseLegacyEditor"); + } + + Session.StartApplication (file: file, args: args, environment: env); Session.SetGlobalValue ("MonoDevelop.Core.Instrumentation.InstrumentationService.Enabled", true); Session.GlobalInvoke ("MonoDevelop.Ide.IdeApp.Workbench.GrabDesktopFocus"); |