diff options
author | Aaron Bockover <abock@microsoft.com> | 2019-07-30 17:22:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-30 17:22:19 +0300 |
commit | d6ba14dc61930fb243ace098e226658670c73208 (patch) | |
tree | b2f1bdd3bf8ca3aa4134535426188e5e22522d8a /main | |
parent | 2dc2bf4670b07d01e0a7c2b6f86fa93ed5bd348b (diff) | |
parent | f97bd18c65d715c0bbd58a6ac40bfa9b92429152 (diff) |
Merge pull request #8261 from mono/pr-anvod-foldingmenu
Fixes VSTS 950315: Code Folding menu toggle does not work in new editor
Diffstat (limited to 'main')
3 files changed, 12 insertions, 1 deletions
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs index 558ec7c203..0e5aa25a14 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs @@ -369,6 +369,9 @@ namespace MonoDevelop.TextEditor { UpdateLineNumberMarginOption (); + var foldMargin = PropertyService.Get<bool> ("ShowFoldMargin"); + Imports.OutliningManagerService.GetOutliningManager (TextView).Enabled = foldMargin; + var newPolicyContainer = (Owner as IPolicyProvider)?.Policies; if (newPolicyContainer != policyContainer) { if (policyContainer != null) diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs index 1861089e23..e9cb83dd19 100644 --- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs +++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs @@ -32,6 +32,7 @@ using Microsoft.VisualStudio.Text.Classification; using Microsoft.VisualStudio.Text.Operations; using Microsoft.VisualStudio.Text.Find; using Microsoft.VisualStudio.Text.Projection; +using Microsoft.VisualStudio.Text.Outlining; namespace MonoDevelop.TextEditor { @@ -78,5 +79,8 @@ namespace MonoDevelop.TextEditor [Import(AllowDefault = true)] internal IInfoBarPresenterFactory InfoBarPresenterFactory { get; set; } + + [Import] + internal IOutliningManagerService OutliningManagerService { get; set; } } }
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs index 85b1da0ebf..35d13428c6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs @@ -522,7 +522,11 @@ namespace MonoDevelop.Ide.Gui protected void UpdateEnableDisableFolding (CommandInfo info) { info.Text = IsFoldMarkerMarginEnabled ? GettextCatalog.GetString ("Disable _Folding") : GettextCatalog.GetString ("Enable _Folding"); - info.Enabled = GetContent<IFoldable> () != null; + info.Enabled = GetContent<IFoldable> () != null || + GetContent<Microsoft.VisualStudio.Text.Editor.ITextView3> () != null; + // As we need to support both the new and the legacy editor, we need to check if perhaps + // we are running in the new one. The legacy editor already implements <see cref="ITextView"/> + // so we can't simply look for that and we do not want to import anything related to Cocoa. } [CommandUpdateHandler (EditCommands.ToggleAllFoldings)] |