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
path: root/main/src
diff options
context:
space:
mode:
authorLluis Sanchez <llsan@microsoft.com>2019-03-21 03:02:26 +0300
committerLluis Sanchez <llsan@microsoft.com>2019-03-21 12:08:48 +0300
commite466141ef7b2c39585e29f94c28f6deb82e8be97 (patch)
treea8e8661e23ea0eac955ea0fe106f14453f8997cf /main/src
parentea8b962d5ed27ad8dd52594124d35eb0bea4b714 (diff)
parent228695e2dc646fb2ad812c06bebfe33ca9f69601 (diff)
Merge branch 'new-service-model' into new-doc-model
Diffstat (limited to 'main/src')
-rw-r--r--main/src/Makefile.am1
-rw-r--r--main/src/addins/AspNet/Makefile.am11
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.csproj289
-rw-r--r--main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs1
-rw-r--r--main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj14
-rw-r--r--main/src/addins/AspNet/Tests/WebForms/WebFormsSyntaxModeTests.cs3
-rw-r--r--main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs3
-rw-r--r--main/src/addins/AspNet/packages.config8
-rw-r--r--main/src/addins/CSharpBinding/AddinInfo.cs1
-rw-r--r--main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj4
-rw-r--r--main/src/addins/CSharpBinding/AspNet/Makefile.am1
-rw-r--r--main/src/addins/CSharpBinding/Autotools/Makefile.am1
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.addin.xml15
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj54
-rw-r--r--main/src/addins/CSharpBinding/Makefile.am59
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/CastCompletionProvider.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/DelegateCompletionProvider.cs30
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/EventSenderCompletionProvider.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/RoslynDebugInfoProvider.cs36
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs91
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentationTracker.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormattingPanel.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSelectionSurroundingProvider.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.OptionProvider/StyleViewModel.cs148
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs45
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs35
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs13
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpLanguageVersionHelper.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs37
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs9
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/RenameHandler.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs6
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.DataProvider.cs262
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.cs614
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtensionProvider.cs45
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MonoDevelopContainedDocument.cs3
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyCSharpCompletionData.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyRoslynCompletionData.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenter.cs5
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenterSession.View.cs12
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynExperimentationService.cs45
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentationTracker.cs4
-rw-r--r--main/src/addins/CSharpBinding/packages.config4
-rw-r--r--main/src/addins/ChangeLogAddIn/Makefile.am1
-rw-r--r--main/src/addins/Deployment/Makefile.am1
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment.Linux/Makefile.am1
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am1
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.csproj8
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs23
-rw-r--r--main/src/addins/Deployment/MonoDevelop.Deployment/packages.config4
-rw-r--r--main/src/addins/GnomePlatform/GnomePlatform.cs10
-rw-r--r--main/src/addins/GnomePlatform/Makefile.am5
-rw-r--r--main/src/addins/ILAsmBinding/Makefile.am1
-rw-r--r--main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs13
-rw-r--r--main/src/addins/MacPlatform/MacIntegrationCommands.cs7
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.addin.xml11
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.csproj11
-rw-r--r--main/src/addins/MacPlatform/Makefile.am5
-rw-r--r--main/src/addins/MacPlatform/packages.config4
-rw-r--r--main/src/addins/Makefile.am41
-rw-r--r--main/src/addins/MonoDevelop.AspNetCore/Makefile.am4
-rw-r--r--main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Tests/MonoDevelop.AspNetCore.Tests.csproj18
-rw-r--r--main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.csproj26
-rw-r--r--main/src/addins/MonoDevelop.AspNetCore/packages.config6
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj48
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.SearchIdleRunner.cs41
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs88
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyLoader.cs69
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyReferenceFolder.cs27
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyResourceFolder.cs12
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/BaseTypeFolder.cs5
-rwxr-xr-xmain/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/ColoredCSharpFormatter.cs88
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/MetadataExtensions.cs62
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyBrowserTypeNodeBuilder.cs7
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceFolderNodeBuilder.cs5
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceNodeBuilder.cs14
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/BaseTypeFolderNodeBuilder.cs8
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/AssemblyNodeBuilder.cs32
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/EventDefinitionNodeBuilder.cs42
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/FieldDefinitionNodeBuilder.cs52
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/MethodDefinitionNodeBuilder.cs74
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/PropertyDefinitionNodeBuilder.cs60
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/TypeDefinitionNodeBuilder.cs86
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ErrorNodeBuilder.cs2
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ModuleReferenceNodeBuilder.cs13
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/NamespaceData.cs1
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ResourceNodeBuilder.cs10
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Roslyn/ProjectNodeBuilder.cs4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/Util/CSharpLanguage.cs786
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/XmlDocIdLib/XmlDocIdGenerator.cs1288
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.Autotools/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj4
-rw-r--r--main/src/addins/MonoDevelop.ConnectedServices/CodeExtensions.cs66
-rw-r--r--main/src/addins/MonoDevelop.ConnectedServices/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.ConnectedServices/MonoDevelop.ConnectedServices.csproj41
-rw-r--r--main/src/addins/MonoDevelop.ConnectedServices/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.csproj21
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol.csproj13
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs49
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs10
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs4
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/packages.config6
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj3
-rw-r--r--main/src/addins/MonoDevelop.Debugger/AddinInfo.cs1
-rw-r--r--main/src/addins/MonoDevelop.Debugger/Makefile.am10
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManager.cs117
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManagerService.cs18
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs287
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtProvider.cs28
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphFactoryProvider.cs104
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessor.cs605
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessorProvider.cs33
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTag.cs88
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTagger.cs63
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTaggerProvider.cs27
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphFactoryProvider.cs25
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTag.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTagger.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTaggerProvider.cs19
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/GlyphCommandType.cs8
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IActiveGlyphDropHandler.cs8
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IInteractiveGlyph.cs11
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ImageSourceGlyphFactory.cs39
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphFactoryProvider.cs25
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTag.cs9
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTagger.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTaggerProvider.cs19
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSource.cs175
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSourceProvider.cs31
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/IDebugInfoProvider.cs30
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractBreakpointTagger.cs61
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs98
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTagger.cs18
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTaggerProvider.cs32
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointMarkerDefinition.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTag.cs40
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTagger.cs13
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTaggerProvider.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ClassificationTypes.cs118
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTagger.cs16
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTaggerProvider.cs31
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementMarkerDefinition.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTag.cs16
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTagger.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTaggerProvider.cs19
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementForegroundTaggerProvider.cs31
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementMarkerDefinition.cs21
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTag.cs16
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTagger.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTaggerProvider.cs19
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml18
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj100
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs72
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugValueWindow.cs (renamed from main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs)61
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs71
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs6
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/TextViewExtensions.cs50
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16.pngbin0 -> 338 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16@2x.pngbin0 -> 532 bytes
-rw-r--r--main/src/addins/MonoDevelop.Debugger/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs6
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CodeTemplateToolboxProvider.cs10
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs7
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxExtensions.cs65
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj38
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs2
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.DocFood/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj28
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/Makefile.am5
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj9
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectSupportedTargetFrameworksTests.cs14
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateWizardTests.cs4
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreVersionTests.cs4
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj34
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreNotInstalledDialog.cs12
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectExtension.cs3
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectSupportedTargetFrameworks.cs11
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSdkPaths.cs4
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreVersion.cs2
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/packages.config8
-rw-r--r--main/src/addins/MonoDevelop.Gettext/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj16
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj41
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libsteticui/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libsteticui/libsteticui.csproj22
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libsteticui/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.HexEditor/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs30
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj67
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/packages.config6
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml4
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj86
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs30
-rw-r--r--main/src/addins/MonoDevelop.PackageManagement/packages.config21
-rw-r--r--main/src/addins/MonoDevelop.Packaging/Makefile.am7
-rw-r--r--main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/Makefile.am2
-rw-r--r--main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/MonoDevelop.Packaging.Tests.csproj6
-rw-r--r--main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.csproj44
-rw-r--r--main/src/addins/MonoDevelop.Packaging/PostBuild.proj12
-rw-r--r--main/src/addins/MonoDevelop.Packaging/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs1
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.FloatingQuickFixIconWidget.cs9
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs13
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs8
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs7
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeFixMenuService.cs15
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/FixAllPreviewDialog.cs4
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticRunner.cs1
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeRulePanel.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceDialog.cs53
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceOptionService.cs65
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/AbstractOptionPreviewViewModel.cs10
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/CheckBoxWithComboOptionViewModel.cs4
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/AbstractCodeStyleOptionViewModel.cs3
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/BooleanCodeStyleOptionViewModel.cs11
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/EnumCodeStyleOptionViewModel.cs6
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs6
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.SignatureChange/SignatureChangeDialog.cs4
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml40
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj41
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs6
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs36
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs28
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs12
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewTooltipWindow.cs14
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs57
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/StreamingFindUsagesPresenter.cs138
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj24
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Gui/MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel.cs77
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MdTextViewLineCollection.MdTextViewLine.cs38
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs417
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs7
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs50
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionAggregatorFactory.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManager.cs7
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManagerFactory.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionStack.cs5
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs82
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs1
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj43
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarginMarker.cs1
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/ConnectionManager.cs34
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Geometry.cs61
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Mouse.cs19
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs24
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Helpers.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/BaseIntellisenseSession.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/CurrentLineSpaceReservationAgent.cs18
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseManager.cs194
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStack.cs33
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStackMapService.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSpaceReservationManagers.cs13
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenter.cs5
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenterProvider.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/SignatureHelpBroker.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/SmartIndentationService.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Adornments/ToolTipPresenterStyle.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationAgent.cs8
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationManager.cs28
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationAgentChangedEventArgs.cs22
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationManagerDefinition.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/GuardedToolTipPresenter.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ToolTipService.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ViewElementFactoryService.cs7
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/BaseWpfToolTipPresenter.cs13
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/DefaultToolTipPresenterStyle.cs4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProvider.cs13
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProviderFactory.cs12
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/MouseTrackingWpfToolTipPresenter.cs24
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/SpanTrackingWpfToolTipPresenter.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ToolTipStyleFactory.cs18
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfClassifiedTextElementViewElementFactory.cs6
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfContainerElementViewElementFactory.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfImageElementViewElementFactory.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfObjectViewElementFactory.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/WpfToolTipPresenterProvider.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/PopupAgent.cs114
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationManager.cs54
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationStack.cs8
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorInitializationService.cs (renamed from main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorFactoryService.cs)43
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VacuousTextDataModel.cs54
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VisualStudio/Impl/ViewAdapter/TipManager.cs21
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewContent.cs283
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs70
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewImports.cs33
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/GtkNSViewHost.cs380
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/ImageService.cs103
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MdMouseProcessorProvider.cs106
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MonoDevelop.TextEditor.Cocoa.csproj94
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/AddinInfo.cs40
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/MonoDevelop.TextEditor.Cocoa.addin.xml63
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16.pngbin0 -> 162 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16@2x.pngbin0 -> 264 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16.pngbin0 -> 266 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16@2x.pngbin0 -> 565 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled.pngbin0 -> 271 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled@2x.pngbin0 -> 594 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16.pngbin0 -> 231 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16@2x.pngbin0 -> 429 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled.pngbin0 -> 223 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled@2x.pngbin0 -> 434 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16.pngbin0 -> 237 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16@2x.pngbin0 -> 513 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled.pngbin0 -> 244 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled@2x.pngbin0 -> 523 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16.pngbin0 -> 258 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16@2x.pngbin0 -> 468 bytes
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs224
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs62
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml460
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs363
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs172
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs55
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs422
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs65
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj47
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs241
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs40
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml22
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs39
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs267
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs100
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoTransaction.cs179
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfImageElementViewElementFactory.cs55
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfMouseProcessor.cs74
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfObscuringTipManager.cs83
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewContent.cs110
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewDisplayBinding.cs70
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewImports.cs33
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTipManagerCommandHandler.cs69
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandArgsFactories.cs33
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappingExtensionNode.cs110
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappings.cs72
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs514
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/EditorContentProviderService.cs55
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/IEditorContentProvider.cs98
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/MonoDevelop.TextEditor.csproj28
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/AddinInfo.cs37
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml272
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs265
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.TextViewNavigationPoint.cs141
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs759
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs110
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewExtensions.cs50
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs78
-rw-r--r--main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/ThemeToClassification.cs376
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/Makefile.am3
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/MonoDevelop.UnitTesting.NUnit.csproj4
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnit3Runner.csproj28
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/packages.config5
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/NUnitRunner.csproj28
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/packages.config6
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/MonoDevelop.UnitTesting.Tests.csproj24
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/packages.config7
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs2
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestUnitTest.cs4
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj78
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs6
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/Services/AbstractUnitTestEditorExtension.cs1
-rw-r--r--main/src/addins/MonoDevelop.UnitTesting/packages.config10
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/Makefile.am1
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj4
-rw-r--r--main/src/addins/MonoDeveloperExtensions/Makefile.am7
-rw-r--r--main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am5
-rw-r--r--main/src/addins/PerformanceDiagnostics/Makefile.am4
-rw-r--r--main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/Makefile.am1
-rw-r--r--main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/PerformanceDiagnosticsAddIn.csproj11
-rw-r--r--main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/packages.config4
-rw-r--r--main/src/addins/PerformanceDiagnostics/UIThreadMonitorDaemon/Makefile.am1
-rw-r--r--main/src/addins/TextTemplating/Makefile.am2
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am1
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj29
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config4
-rw-r--r--main/src/addins/VBNetBinding/Makefile.am1
-rw-r--r--main/src/addins/VBNetBinding/VBNetBinding.csproj20
-rw-r--r--main/src/addins/VersionControl/Makefile.am10
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs191
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/Makefile.am5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs254
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs11
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/IGitCredentialsProvider.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/Makefile.am5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/Makefile.am5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/Makefile.am5
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs12
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs135
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs44
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Revision.cs1
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UrlBasedRepositoryEditor.cs39
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs149
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs191
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config4
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32.Tests/Makefile.am1
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/Makefile.am1
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj18
-rw-r--r--main/src/addins/VersionControl/Subversion.Win32/packages.config4
-rw-r--r--main/src/addins/Web/Makefile.am2
-rw-r--r--main/src/addins/WindowsPlatform/Makefile.am4
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj1
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am4
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs2
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj2
-rw-r--r--main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs4
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am5
-rw-r--r--main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj4
-rw-r--r--main/src/addins/Xml/Makefile.am1
-rw-r--r--main/src/addins/Xml/MonoDevelop.Xml.csproj19
-rw-r--r--main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj23
-rw-r--r--main/src/addins/Xml/Tests/packages.config4
-rw-r--r--main/src/addins/Xml/packages.config4
-rw-r--r--main/src/core/Makefile.am9
-rw-r--r--main/src/core/Mono.TextEditor.Platform/Makefile.am1
-rw-r--r--main/src/core/Mono.TextEditor.Shared/Makefile.am1
-rw-r--r--main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Actions/MiscActions.cs21
-rw-r--r--main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/CaretImpl.cs15
-rw-r--r--main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs421
-rw-r--r--main/src/core/Mono.Texteditor/Makefile.am1
-rw-r--r--main/src/core/MonoDevelop.Core/Makefile.am7
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/ExecutionModeNode.cs62
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs28
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSource.cs6
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSourceVersion.cs56
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/StringTextSource.cs3
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextChangeEventArgs.cs4
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs7
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextSourceVersionProvider.cs5
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj241
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs1
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SdkResolution.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/packages.config121
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml1
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml106
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/StockIcons.addin.xml52
-rw-r--r--main/src/core/MonoDevelop.Ide/Makefile.am11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCategoryCodon.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs77
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandItemCodon.cs74
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/ItemSetCodon.cs98
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/LinkItemCodon.cs80
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SchemeExtensionNode.cs106
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SeparatorItemCodon.cs76
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandInfo.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs112
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/ICustomCommandTarget.cs49
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs88
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.ShimNavigateToSearchService.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/HslColor.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/Util.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Windows/GtkWPFWidget.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CodeCompletionContextEventArgs.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionCharacterCodon.cs18
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionController.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionDataList.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindowGtk.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionKeyHandler.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionView.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionViewEventSink.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/IListDataProvider.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MruCache.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MutableCompletionDataList.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingResult.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindow.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/RoslynCompletionData.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/SignatureHelpParameterHintingData.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs28
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs59
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs49
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CategoryNode.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs66
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ImageCodon.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ItemTemplateExtensionNode.cs33
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs170
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs85
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs99
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateCategoryCodon.cs15
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateExtensionNode.cs136
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs115
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorWaitIndicator.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ExtensionSelector.cs71
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/InlineRenameService.cs24
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ObscuringTipManager.cs20
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PeekResultFactory.cs52
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformCatalog.cs155
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformExtensions.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PreviewFactoryService.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/StreamingFindUsagesPresenter.cs29
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/SuggestedActionCategoryRegistryService.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/UIExtensionSelector.cs83
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/VisualStudioMefHostServices.cs97
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs187
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AutoInsertBracketTextEditorExtension.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BlockStructureFoldingTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/DefaultCommandTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/EditorFormattingServiceTextEditorExtension.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/FoldingTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/HighlightUrlExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IQuickTaskProvider.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IndentationTracker.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/KeyDescriptor.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/LineSeparatorTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ModifierKeys.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/QuickTask.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SelectionSurroundingProvider.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SpecialKey.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TagCommentsTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextPasteHandler.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/Usage.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/OldFormat.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/Sublime3Format.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/TextMateFormat.cs51
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlighting.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlightingDefinitionProvider.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/LanguageBundle.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Makefile.am6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/Regex.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexBoyerMoore.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCapture.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCaptureCollection.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCharClass.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCode.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompilationInfo.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompiler.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexFCD.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroup.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroupCollection.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexInterpreter.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatch.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchCollection.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchTimeoutException.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexNode.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexOptions.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexParser.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexReplacement.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunner.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunnerFactory.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexTree.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexWriter.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunner.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunnerfactory.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ScopeStack.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SemanticHighlighting.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/StackMatchExpression.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlighting.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingDefinition.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateCodon.cs67
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSetting.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSnippet.cs53
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/IIndentEngine.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/ShowTextMateScopesHandler.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateBundleOptionsPanelWidget.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateCompletionTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateDocumentIndentEngine.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateFoldingTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTracker.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateLanguage.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/Diff.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleReadonlyDocument.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Commands/DynamicAbbrevHandler.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs291
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs34
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentRegion.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditSession.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorConfigService.cs22
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorPreferences.cs321
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/FoldSegmentFactory.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IFoldSegment.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IReadonlyTextDocument.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextDocument.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorFactoryService.cs57
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorInitializationService.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextLineMarker.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IUnitTestMarker.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionCursorEventArgs.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionModeOptions.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionPoint.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorFactory.cs54
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/LineEventArgs.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/OSXEditor.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/IProjectionExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedDocumentContext.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/SegmentTree.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs17
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipExtensionNode.cs71
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/CustomToolExtensionNode.cs58
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/MimeTypeNode.cs131
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsDialogSection.cs74
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/StockIconCodon.cs141
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Commands.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs71
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Scope.cs21
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs35
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs77
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RoslynDocumentExtension.cs84
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs17
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs175
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs27
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentNavigationService.cs265
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentTrackingService.cs12
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopInfoBarService.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopProjectCacheHostServiceFactory.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopSymbolNavigationService.cs53
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopTaskSchedulerFactory.cs54
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/RoslynService.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Error.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/FoldingRegion.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/IFoldingParser.cs57
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MiscellaneousFilesWorkspace.cs282
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopMetadataReferenceManager.FileKey.cs69
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceText.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.OpenDocumentsData.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs58
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectionData.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs75
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs20
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs9
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs63
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs112
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomeWindowProvider.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageCommands.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFeedItem.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFirstRun.cs16
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageService.cs34
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj141
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs43
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs62
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs43
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MimeTypeCatalog.cs207
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/packages.config17
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/Makefile.am1
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj7
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildResolver/MonoDevelop.MSBuildResolver.csproj5
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild/Main.cs4
-rw-r--r--main/src/core/MonoDevelop.Projects.Formats.MSBuild/packages.config4
-rw-r--r--main/src/core/MonoDevelop.Startup/Makefile.am4
-rw-r--r--main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj1
-rw-r--r--main/src/core/MonoDevelop.Startup/app.config322
-rw-r--r--main/src/core/MonoDevelop.Startup/packages.config4
-rw-r--r--main/src/core/MonoDevelop.TextEditor.Tests/Makefile.am1
-rw-r--r--main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/MiscActionsTest.cs14
-rw-r--r--main/src/tools/Makefile.am1
-rw-r--r--main/src/tools/mdhost/Makefile.am1
-rw-r--r--main/src/tools/mdmonitor/Makefile.am1
-rw-r--r--main/src/tools/mdmonitor/TimeLineView.cs1
-rw-r--r--main/src/tools/mdtool/Makefile.am1
773 files changed, 20250 insertions, 8332 deletions
diff --git a/main/src/Makefile.am b/main/src/Makefile.am
deleted file mode 100644
index 5991896f3d..0000000000
--- a/main/src/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = core addins tools
diff --git a/main/src/addins/AspNet/Makefile.am b/main/src/addins/AspNet/Makefile.am
deleted file mode 100644
index 9039c5e753..0000000000
--- a/main/src/addins/AspNet/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-include $(top_srcdir)/xbuild.include
-EXTRA_DIST += \
- $(wildcard lib/*) \
- $(wildcard Templates/MvcCommon/*.cshtml)\
- $(wildcard Templates/*.cshtml)\
- $(wildcard Templates/*.ts)\
- $(wildcard Templates/*.css)\
- $(wildcard Templates/*.scss)\
- $(wildcard Templates/*.less)\
- $(wildcard Templates/*.json)\
- $(wildcard Templates/Projects/Files/*.aspx)
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
index ff0c562d0b..b9cb30001a 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
@@ -1,7 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesGtk)" />
- <Import Project="$(ReferencesRoslyn)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,6 +9,10 @@
<OutputPath>..\..\..\build\AddIns\AspNet</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RARResolveFromCandidateAssemblyFiles>true</RARResolveFromCandidateAssemblyFiles>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many, many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -69,51 +72,11 @@
<Name>MonoDevelop.Xml</Name>
<Private>False</Private>
</ProjectReference>
- <Reference Include="Microsoft.Web.Infrastructure">
- <HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
- </Reference>
- <Reference Include="System.Web.Razor">
- <HintPath>..\..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.Helpers">
- <HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.WebPages.Deployment">
- <HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.WebPages">
- <HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.WebPages.Razor">
- <HintPath>..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.Mvc">
- <HintPath>..\..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Web.Mvc" Condition="!Exists('$(SolutionDir)\..\.git')" />
<ProjectReference Include="..\..\..\external\nrefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
<Name>ICSharpCode.NRefactory</Name>
<Private>False</Private>
</ProjectReference>
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.TextTemplating">
- <HintPath>..\..\..\packages\Mono.TextTemplating.1.3.1\lib\net45\Mono.TextTemplating.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
@@ -127,6 +90,14 @@
<Reference Include="System.Xml.Linq" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Runtime.Serialization" />
+ <PackageReference Include="Microsoft.AspNet.Mvc" version="5.2.7" PrivateAssets="runtime" />
+ <IncludeCopyLocal Include="System.Web.Mvc.dll" />
+ <IncludeCopyLocal Include="System.Web.Razor.dll" />
+ <IncludeCopyLocal Include="System.Web.Helpers.dll" />
+ <IncludeCopyLocal Include="System.Web.WebPages.Deployment.dll" />
+ <IncludeCopyLocal Include="System.Web.WebPages.Razor.dll" />
+ <IncludeCopyLocal Include="System.Web.WebPages.dll" />
+ <IncludeCopyLocal Include="Microsoft.Web.Infrastructure.dll" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\MonoDevelop.AspNet.addin.xml" />
@@ -275,238 +246,10 @@
<Compile Include="Gui\MonoDevelop.AspNet.Projects.GtkAspNetProjectTemplateWizardPageWidget.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="Razor\Razor-templates.xml">
- <SubType>Designer</SubType>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="CodeTemplates\CSharp\AddController\ControllerWithEmptyReadAndWriteActions.tt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="CodeTemplates\CSharp\AddController\Empty.tt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="CodeTemplates\CSharp\AddView\Aspx\Empty.tt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="CodeTemplates\CSharp\AddView\Razor\Empty.tt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\Controller.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\LayoutPage.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\PartialViewPageRazor.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\UserControl.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\ViewContentPage.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\ViewMasterPage.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\ViewPage.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\ViewPageRazor.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Mvc\WebConfigViews.xft.xml">
- <SubType>Designer</SubType>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebConfig-Application.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebConfig-SubDir.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\MasterPage-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\MasterPage-Empty.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\NestedMasterPage.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebContentForm.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebControl-Empty.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebForm-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\NestedMasterPage-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebControl-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebForm-Empty.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebHandler-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebService-Empty.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebService-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebHandler-Empty.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebForms\WebContentForm-CodeBehind.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\PreprocessedRazorTemplate.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\_Layout.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\_ViewStart.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\Error.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\HomeController.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\HomeControllerTest.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\Index.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\MvcCommon\ViewPageRazor.cshtml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll">
- <Link>System.Web.Mvc.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll">
- <Link>System.Web.Razor.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll">
- <Link>System.Web.Helpers.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll">
- <Link>System.Web.WebPages.Deployment.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll">
- <Link>System.Web.WebPages.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll">
- <Link>System.Web.WebPages.Razor.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll">
- <Link>Microsoft.Web.Infrastructure.dll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="packages.config" />
- <None Include="Templates\Projects\MvcProject.xpt.xml">
- <SubType>Designer</SubType>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\EmptyProject.xpt.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\WebFormsProject.xpt.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\Files\Default.aspx">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\Files\Default.aspx.designer.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\Files\Default.aspx.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\GlobalAsax.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Global.tt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\RouteConfig.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\WebApiConfig.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\Projects\Files\Test.cs">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\EmptyCssFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\EmptyLessFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\EmptyScssFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\EmptyJsonFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\EmptyTypeScriptFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\StylesheetTemplate.css">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\StylesheetTemplate.less">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\StylesheetTemplate.scss">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\JsonFileTemplate.json">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\TypeScriptFileTemplate.ts">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\npmConfigurationFile.json">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\npmConfigurationFile.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- </ItemGroup>
- <ItemGroup>
- <Content Include="Html\Schemas\readme.txt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="Html\Schemas\W3C-License.html">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="Html\Schemas\xhtml1-frameset.xsd">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="Html\Schemas\xhtml1-strict.xsd">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="Html\Schemas\xhtml1-transitional.xsd">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
+ <ExtensionContent Include="Razor\Razor-templates.xml" />
+ <ExtensionContent Include="CodeTemplates\**\*.*" />
+ <ExtensionContent Include="Templates\**\*.*" />
+ <ExtensionContent Include="Html\Schemas\**\*.*" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="MonoDevelop.AspNet.Tests" />
diff --git a/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs b/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs
index 4a018b416d..75035713ca 100644
--- a/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs
+++ b/main/src/addins/AspNet/Projects/GtkAspNetProjectTemplateWizardPageWidget.cs
@@ -28,7 +28,6 @@
using System;
using Gdk;
using Gtk;
-using Mono.TextEditor;
using MonoDevelop.Components;
using MonoDevelop.Core;
diff --git a/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj b/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
index 5e60931e25..caa9916dab 100644
--- a/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
+++ b/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
@@ -1,7 +1,6 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesGtk)" />
- <Import Project="$(ReferencesRoslyn)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -10,19 +9,15 @@
<TestRunnerCommand>..\..\..\..\build\bin\mdtool.exe</TestRunnerCommand>
<TestRunnerArgs>run-md-tests</TestRunnerArgs>
<OutputPath>..\..\..\..\build\tests</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many, many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Razor\Dom\RazorCodeBlockParsingTests.cs" />
@@ -86,6 +81,7 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor.csproj">
<Project>{F8F92AA4-A376-4679-A9D4-60E7B7FBF477}</Project>
diff --git a/main/src/addins/AspNet/Tests/WebForms/WebFormsSyntaxModeTests.cs b/main/src/addins/AspNet/Tests/WebForms/WebFormsSyntaxModeTests.cs
index c1cfaf73b9..5bc6374f44 100644
--- a/main/src/addins/AspNet/Tests/WebForms/WebFormsSyntaxModeTests.cs
+++ b/main/src/addins/AspNet/Tests/WebForms/WebFormsSyntaxModeTests.cs
@@ -26,9 +26,6 @@
using System.Linq;
using NUnit.Framework;
-using Mono.TextEditor;
-using Mono.TextEditor.Highlighting;
-using MonoDevelop.AspNet.WebForms;
namespace MonoDevelop.AspNet.Tests.WebForms
{
diff --git a/main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs b/main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs
index abe4f016af..dbb4704dc7 100644
--- a/main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs
+++ b/main/src/addins/AspNet/WebForms/ILanguageCompletionBuilder.cs
@@ -26,9 +26,6 @@
using System;
using System.Collections.Generic;
-using Mono.TextEditor;
-using MonoDevelop.Ide.CodeCompletion;
-using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Xml.Dom;
using MonoDevelop.AspNet.Projects;
diff --git a/main/src/addins/AspNet/packages.config b/main/src/addins/AspNet/packages.config
deleted file mode 100644
index a3f69291e3..0000000000
--- a/main/src/addins/AspNet/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
- <package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
- <package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net45" />
- <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
- <package id="Mono.TextTemplating" version="1.3.1" targetFramework="net45" />
-</packages>
diff --git a/main/src/addins/CSharpBinding/AddinInfo.cs b/main/src/addins/CSharpBinding/AddinInfo.cs
index 0a0160f9fc..fc38fc0ead 100644
--- a/main/src/addins/CSharpBinding/AddinInfo.cs
+++ b/main/src/addins/CSharpBinding/AddinInfo.cs
@@ -16,6 +16,7 @@ using Mono.Addins.Description;
[assembly:AddinDependency ("Refactoring", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("SourceEditor2", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("UnitTesting", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
// Submodules
[assembly:AddinModule ("MonoDevelop.CSharpBinding.Autotools.dll")]
diff --git a/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj b/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj
index 1e0e141265..ddeea9f747 100644
--- a/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj
+++ b/main/src/addins/CSharpBinding/AspNet/CSharpBinding.AspNet.csproj
@@ -9,6 +9,10 @@
<AssemblyName>MonoDevelop.CSharpBinding.AspNet</AssemblyName>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\..\build\AddIns\CSharpBinding</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
diff --git a/main/src/addins/CSharpBinding/AspNet/Makefile.am b/main/src/addins/CSharpBinding/AspNet/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/CSharpBinding/AspNet/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/CSharpBinding/Autotools/Makefile.am b/main/src/addins/CSharpBinding/Autotools/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/CSharpBinding/Autotools/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
index be59585792..940db43069 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
+++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
@@ -66,14 +66,6 @@
/>
</Extension>
- <Extension path = "/MonoDevelop/Ide/Commands/CodeNavigation">
- <Command id = "MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration"
- _label = "_Go to Declaration"
- shortcut = "F12"
- macShortcut = "Meta|D F12"/>
- </Extension>
-
-
<Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes">
<DotNetProjectType
id="MonoDevelop.CSharp.Project.CSharpProject"
@@ -174,7 +166,7 @@
</Extension>
<Extension path = "/MonoDevelop/Core/MimeTypes">
- <MimeType id="text/x-csharp" _description="C# source code" icon="md-csharp-file" isText="true" roslynName="C#">
+ <MimeType id="text/x-csharp" _description="C# source code" icon="md-csharp-file" isText="true" roslynName="C#" contentType="csharp">
<File pattern="*.cs" />
</MimeType>
<MimeType id="application/x-csproject" _description="C# project file" baseType="application/x-msbuild">
@@ -344,5 +336,8 @@
<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor/Analysis/C#">
<Panel id="CodeStylePanel" _label="Code Style" fill="true" class="MonoDevelop.CSharp.OptionProvider.CodeStylePage" grouping="Tab" icon="md-prefs-code-rules" insertbefore="CodeActions" />
</Extension>
-
+
+ <Extension path = "/MonoDevelop/TextEditor/CommandMapping">
+ <Map id="MonoDevelop.CSharp.Refactoring.Commands.SortAndRemoveImports" argsType="@MonoDevelop.CSharp.Refactoring.CommandArgsFactories.CreateSortAndRemoveUnnecessaryImportsCommandArgs" />
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index 5013b87b4d..94ef68c84d 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -1,7 +1,6 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesVSEditor)" />
- <Import Project="$(ReferencesRoslyn)" />
<Import Project="$(ReferencesGtk)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -11,6 +10,10 @@
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\CSharpBinding</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <!--
+ This contains the C# language service for the old editor, which makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -65,6 +68,11 @@
<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>
+ <Private>False</Private>
+ </ProjectReference>
<ProjectReference Include="..\MonoDevelop.UnitTesting\MonoDevelop.UnitTesting.csproj">
<Project>{A7A4246D-CEC4-42DF-A3C1-C31B9F51C4EC}</Project>
<Name>MonoDevelop.UnitTesting</Name>
@@ -82,39 +90,15 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
+ <Reference Include="PresentationCore" Condition=" '$(OS)' == 'Windows_NT' " />
+ <Reference Include="PresentationFramework" Condition=" '$(OS)' == 'Windows_NT' " />
+ <Reference Include="WindowsBase" Condition=" '$(OS)' == 'Windows_NT' " />
<Reference Include="System" />
+ <Reference Include="Microsoft.CSharp" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
- <Reference Include="ICSharpCode.Decompiler">
- <HintPath>..\..\..\packages\ICSharpCode.Decompiler.3.1.0.3652\lib\net46\ICSharpCode.Decompiler.dll</HintPath>
- <Private>false</Private>
- </Reference>
<Reference Include="System.Core" />
- <Reference Include="System.Composition.AttributedModel">
- <HintPath>..\..\..\build\bin\System.Composition.AttributedModel.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.CodingConventions">
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.CodingConventions.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Composition">
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.Composition.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="templates\ConsoleProject.xpt.xml" />
@@ -152,6 +136,8 @@
<Compile Include="MonoDevelop.CSharp.Formatting\NewFormattingProfileDialog.cs" />
<Compile Include="MonoDevelop.CSharp.Formatting\CSharpFormattingProfileDialog.cs" />
<Compile Include="MonoDevelop.CSharp.Resolver\HelperMethods.cs" />
+ <Compile Include="MonoDevelop.CSharp\CSharpPathedDocumentExtension.DataProvider.cs" />
+ <Compile Include="MonoDevelop.CSharp\CSharpPathedDocumentExtensionProvider.cs" />
<Compile Include="MonoDevelop.CSharp\ExpandSelectionHandler.cs" />
<Compile Include="MonoDevelop.CSharp.Parser\TypeSystemProvider.cs" />
<Compile Include="MonoDevelop.CSharp\CSharpAmbience.cs" />
@@ -300,10 +286,13 @@
<Compile Include="MonoDevelop.CSharp.Formatting\CSharpTextPasteHandler.TextPasteUtils.cs" />
<Compile Include="MonoDevelop.CSharp.Formatting\OnTheFlyFormattingPanel.cs" />
<Compile Include="MonoDevelop.CSharp.OptionProvider\StyleViewModel.cs" />
+ <Compile Include="MonoDevelop.CSharp\CSharpPathedDocumentExtension.cs" />
+ <Compile Include="MonoDevelop.Ide.Completion.Presentation\RoslynExperimentationService.cs" />
+ <Compile Include="MonoDevelop.CSharp.Debugger\RoslynDebugInfoProvider.cs" />
+ <Compile Include="MonoDevelop.CSharp.Refactoring\CommandArgsFactories.cs" />
</ItemGroup>
<ItemGroup>
<None Include="MonoDevelop.CSharp.CodeRefactorings\ConvertToEnum\ConvertToEnumCodeRefactoringProvider.cs" />
- <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="MonoDevelop.Ide.Tests" />
@@ -320,6 +309,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="MonoDevelop.CSharp.CodeRefactorings\UsingRefactorings\" />
+ <Folder Include="MonoDevelop.CSharp.Debugger\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- </Project>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/Makefile.am b/main/src/addins/CSharpBinding/Makefile.am
deleted file mode 100644
index 15a0af0bde..0000000000
--- a/main/src/addins/CSharpBinding/Makefile.am
+++ /dev/null
@@ -1,59 +0,0 @@
-SUBDIRS = . Autotools AspNet
-
-include $(top_srcdir)/xbuild.include
-
-PARSE = parse.exe
-
-TESTFILES = \
- CSharpAmbience.cs \
- CSharpBindingCompilerManager.cs \
- CSharpEnhancedCodeProvider.cs \
- CSharpLanguageBinding.cs \
- FormattingStrategy/CSharpFormattingProperties.cs \
- FormattingStrategy/CSharpFormattingStrategy.cs \
- FormattingStrategy/CSharpIndentEngine.cs \
- FormattingStrategy/CSharpIndentEngineStack.cs \
- gtk-gui/CSharpBinding.CodeGenerationPanelWidget.cs \
- gtk-gui/CSharpBinding.FormattingPanelWidget.cs \
- gtk-gui/generated.cs \
- Gui/ChooseRuntimePanel.cs \
- Gui/CodeGenerationPanel.cs \
- Gui/CSharpParameterDataProvider.cs \
- Gui/CSharpTextEditorExtension.cs \
- Gui/FormattingPanel.cs \
- Gui/OverrideCompletionData.cs \
- Parser/CodeGenerator.cs \
- Parser/CSharpVisitor.cs \
- Parser/ExpressionFinder.cs \
- Parser/LanguageItemVisitor.cs \
- Parser/Parser.cs \
- Parser/Resolver.cs \
- Parser/SharpDevelopTree/AttributeSection.cs \
- Parser/SharpDevelopTree/Class.cs \
- Parser/SharpDevelopTree/Constructor.cs \
- Parser/SharpDevelopTree/Destructor.cs \
- Parser/SharpDevelopTree/GenericParameter.cs \
- Parser/SharpDevelopTree/Method.cs \
- Parser/SharpDevelopTree/ReturnType.cs \
- Parser/TypeVisitor.cs \
- Project/CSharpCompilerParameters.cs \
- MonoDevelop.CSharp.Inspection/Inspectors/RedundantThisInspector.cs
-
-TESTDLLS = \
- $(NUNIT_LIBS)
-
-TESTASSEMBLY = $(top_builddir)/build/bin/CSharpBinding.Test.dll
-
-$(TESTASSEMBLY) : $(build_test_sources) $(build_resources)
- $(CSC) $(CSC_FLAGS) -debug "-define:GMCS_SOURCE;NET_2_0;MS_COMPATIBLE;FULL_AST;BOOTSTRAP_BASIC" -unsafe -codepage:utf8 -out:$@ -target:library $(DLLS) $(TESTDLLS) $(REFS) /r:$(ASSEMBLY) \
- $(monodoc_libflags) $(build_resources:%=/resource:%) $(build_test_sources)
-
-parse: $(PARSE)
-
-$(PARSE): parse.cs all
- $(CSC) -out:$@ parse.cs $(REFS) -r:$(ASSEMBLY)
-
-run-parse-test: $(PARSE)
- MONO_PATH=$(top_builddir)/build/AddIns/BackendBindings/:$(top_builddir)/build/bin/ mono $(PARSE) .
-
-CLEANFILES = $(PARSE) $(PARSE).mdb
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs
index 15394c220b..29a8b78b35 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/CodeGenerationOptions.cs
@@ -48,7 +48,7 @@ namespace MonoDevelop.CodeGeneration
{
readonly int offset;
- public TextEditor Editor
+ public Ide.Editor.TextEditor Editor
{
get;
private set;
@@ -98,7 +98,7 @@ namespace MonoDevelop.CodeGeneration
private set;
}
- internal CodeGenerationOptions (TextEditor editor, DocumentContext ctx)
+ internal CodeGenerationOptions (Ide.Editor.TextEditor editor, DocumentContext ctx)
{
Editor = editor;
DocumentContext = ctx;
@@ -127,7 +127,7 @@ namespace MonoDevelop.CodeGeneration
return CSharp.CSharpAmbience.SafeMinimalDisplayString (fullType, CurrentState, offset);
}
- public static CodeGenerationOptions CreateCodeGenerationOptions (TextEditor document, DocumentContext ctx)
+ public static CodeGenerationOptions CreateCodeGenerationOptions (Ide.Editor.TextEditor document, DocumentContext ctx)
{
return new CodeGenerationOptions (document, ctx);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
index eff78dbfda..21bfd6ec2c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.CodeGeneration/GenerateCodeWindow.cs
@@ -178,7 +178,7 @@ namespace MonoDevelop.CodeGeneration
}
}
- public static void ShowIfValid (TextEditor editor, DocumentContext context, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext)
+ public static void ShowIfValid (Ide.Editor.TextEditor editor, DocumentContext context, MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext)
{
var options = CodeGenerationOptions.CreateCodeGenerationOptions (editor, context);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index 1835f10242..38f3104f8c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -280,7 +280,10 @@ namespace MonoDevelop.CSharp.Completion
syntaxTree.IsPreProcessorDirectiveContext (position, cancellationToken))
return;
- var extensionMethodImport = syntaxTree.IsRightOfDotOrArrowOrColonColon (position, cancellationToken);
+ var extensionMethodImport = syntaxTree.IsRightOfDotOrArrowOrColonColon (
+ position,
+ syntaxTree.FindTokenOnLeftOfPosition (position, cancellationToken).GetPreviousTokenIfTouchingWord (position),
+ cancellationToken);
ITypeSymbol extensionMethodReceiverType = null;
if (extensionMethodImport) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/CastCompletionProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/CastCompletionProvider.cs
index 0fe45a7e3a..06b3c93b54 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/CastCompletionProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/CastCompletionProvider.cs
@@ -63,7 +63,10 @@ namespace MonoDevelop.CSharp.Completion.Provider
if (syntaxTree.IsInNonUserCode (position, cancellationToken) ||
syntaxTree.IsPreProcessorDirectiveContext (position, cancellationToken))
return;
- if (!syntaxTree.IsRightOfDotOrArrowOrColonColon (position, cancellationToken))
+ if (!syntaxTree.IsRightOfDotOrArrowOrColonColon (
+ position,
+ syntaxTree.FindTokenOnLeftOfPosition (position, cancellationToken).GetPreviousTokenIfTouchingWord (position),
+ cancellationToken))
return;
var ma = ctx.LeftToken.Parent as MemberAccessExpressionSyntax;
if (ma == null)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/DelegateCompletionProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/DelegateCompletionProvider.cs
index 9ff63bcbe9..4911dd14e7 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/DelegateCompletionProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/DelegateCompletionProvider.cs
@@ -378,9 +378,12 @@ namespace MonoDevelop.CSharp.Completion.Provider
var semanticModel = await doc.GetSemanticModelAsync (cancellationToken);
if (!doc.IsOpen () || await doc.IsForkedDocumentWithSyntaxChangesAsync (cancellationToken))
return CompletionChange.Create (change);
- await Runtime.RunInMainThread (delegate {
- var document = IdeApp.Workbench.ActiveDocument;
- var editor = document.Editor;
+
+ var document = IdeApp.Workbench.ActiveDocument;
+ var editor = document.Editor;
+
+ void StartInsertionMode ()
+ {
if (editor.EditMode != EditMode.Edit)
return;
var parsedDocument = document.DocumentContext.ParsedDocument;
@@ -401,7 +404,13 @@ namespace MonoDevelop.CSharp.Completion.Provider
}
);
editor.StartInsertionMode (options);
- });
+ }
+
+ if (editor.TextView is Microsoft.VisualStudio.Text.Editor.IMdTextView)
+ await Runtime.RunInMainThread (StartInsertionMode);
+ else
+ StartInsertionMode ();
+
return CompletionChange.Create (change);
}
change = new TextChange (new TextSpan (item.Span.Start, item.Span.Length), beforeText + afterText);
@@ -421,8 +430,10 @@ namespace MonoDevelop.CSharp.Completion.Provider
string oneIndent = null;
string eol = null;
- await Runtime.RunInMainThread (delegate {
- var editor = IdeApp.Workbench?.ActiveDocument?.Editor;
+ var editor = IdeApp.Workbench?.ActiveDocument?.Editor;
+
+ void GetText ()
+ {
var indentationTracker = editor?.IndentationTracker;
if (indentationTracker != null) {
if (!properties.TryGetValue (PositionKey, out var positionString)) {
@@ -438,7 +449,12 @@ namespace MonoDevelop.CSharp.Completion.Provider
thisLineIndent = oneIndent = "\t";
}
eol = editor?.EolMarker ?? "\n";
- });
+ }
+
+ if (editor?.TextView is Microsoft.VisualStudio.Text.Editor.IMdTextView)
+ await Runtime.RunInMainThread (GetText);
+ else
+ GetText ();
properties.TryGetValue (InsertBeforeKey, out string beforeText);
properties.TryGetValue (InsertAfterKey, out string afterText);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/EventSenderCompletionProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/EventSenderCompletionProvider.cs
index 31a03fd06f..26cd852c70 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/EventSenderCompletionProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CompletionProvider/EventSenderCompletionProvider.cs
@@ -61,7 +61,10 @@ namespace MonoDevelop.CSharp.Completion.Provider
if (syntaxTree.IsInNonUserCode (position, cancellationToken) ||
syntaxTree.IsPreProcessorDirectiveContext (position, cancellationToken))
return;
- if (!syntaxTree.IsRightOfDotOrArrowOrColonColon (position, cancellationToken))
+ if (!syntaxTree.IsRightOfDotOrArrowOrColonColon (
+ position,
+ syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken).GetPreviousTokenIfTouchingWord(position),
+ cancellationToken))
return;
var ma = ctx.LeftToken.Parent as MemberAccessExpressionSyntax;
if (ma == null)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/RoslynDebugInfoProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/RoslynDebugInfoProvider.cs
new file mode 100644
index 0000000000..5dbf392e5b
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Debugger/RoslynDebugInfoProvider.cs
@@ -0,0 +1,36 @@
+using System;
+using System.ComponentModel.Composition;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Editor.Implementation.Debugging;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Text;
+using MonoDevelop.Debugger.VSTextView.QuickInfo;
+
+namespace MonoDevelop.CSharp.Debugger
+{
+ [Export]
+ [Export (typeof (IDebugInfoProvider))]
+ public class RoslynDebugInfoProvider : IDebugInfoProvider
+ {
+ public async Task<DataTipInfo> GetDebugInfoAsync (SnapshotPoint snapshotPoint, CancellationToken cancellationToken)
+ {
+ var document = snapshotPoint.Snapshot.AsText ().GetOpenDocumentInCurrentContextWithChanges ();
+ if (document != null) {
+ var debugInfoService = document.Project.LanguageServices.GetService<ILanguageDebugInfoService> ();
+ if (debugInfoService != null) {
+ var debugInfo = await debugInfoService.GetDataTipInfoAsync (document, snapshotPoint.Position, cancellationToken).ConfigureAwait (false);
+ if (!debugInfo.IsDefault) {
+ var span = debugInfo.Span;
+ return new DataTipInfo (
+ snapshotPoint.Snapshot.CreateTrackingSpan (span.Start, span.Length, SpanTrackingMode.EdgeExclusive),
+ snapshotPoint.Snapshot.GetText (span.Start, span.Length));
+ }
+ }
+ }
+
+ return default(DataTipInfo);
+ }
+ }
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
index 94ff5f0b12..41ce9a98f3 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
@@ -1,49 +1,52 @@
-//
-// CSharpFormatter.cs
-//
-// Author:
-// Mike Krüger <mkrueger@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.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.
+//
+// CSharpFormatter.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2009 Novell, Inc (http://www.novell.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 System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Formatting;
+using Microsoft.CodeAnalysis.Formatting.Rules;
+using Microsoft.CodeAnalysis.Options;
+using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using MonoDevelop.Core;
-using Microsoft.CodeAnalysis.Editor;
-using Microsoft.CodeAnalysis.Shared.Extensions;
using MonoDevelop.Ide;
using MonoDevelop.Core.Text;
+using MonoDevelop.CSharp.OptionProvider;
using MonoDevelop.Ide.CodeFormatting;
+using MonoDevelop.Ide.Completion.Presentation;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Projects.Policies;
using Roslyn.Utilities;
-using System.Threading;
using Microsoft.CodeAnalysis.Options;
using MonoDevelop.CSharp.OptionProvider;
-using System.Collections.Generic;
-using Microsoft.CodeAnalysis.Formatting.Rules;
-using MonoDevelop.Ide.Completion.Presentation;
-using System.Threading.Tasks;
using Microsoft.VisualStudio.CodingConventions;
using System.Linq;
@@ -59,15 +62,15 @@ namespace MonoDevelop.CSharp.Formatting
public override bool SupportsPartialDocumentFormatting { get { return true; } }
- protected override void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
+ protected override void CorrectIndentingImplementation (PolicyContainer policyParent, Ide.Editor.TextEditor editor, int line)
{
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null)
return;
- CorrectIndentingImplementationAsync (editor, doc.DocumentContext, line, line, default).Wait ();
+ CorrectIndentingImplementationAsync (editor, doc.DocumentContext, line, line, default).Ignore ();
}
- protected async override Task CorrectIndentingImplementationAsync (TextEditor editor, DocumentContext context, int startLine, int endLine, CancellationToken cancellationToken)
+ protected async override Task CorrectIndentingImplementationAsync (Ide.Editor.TextEditor editor, DocumentContext context, int startLine, int endLine, CancellationToken cancellationToken)
{
if (editor.IndentationTracker == null)
return;
@@ -77,7 +80,7 @@ namespace MonoDevelop.CSharp.Formatting
var endSegment = startLine != endLine ? editor.GetLine (endLine) : startSegment;
if (endSegment == null)
return;
-
+
try {
var document = context.AnalysisDocument;
@@ -89,22 +92,24 @@ namespace MonoDevelop.CSharp.Formatting
formattingRules.Add (ContainedDocumentPreserveFormattingRule.Instance);
formattingRules.AddRange (Formatter.GetDefaultFormattingRules (document));
- var workspace = document.Project.Solution.Workspace;
- var root = await document.GetSyntaxRootAsync (cancellationToken);
- var options = await document.GetOptionsAsync (cancellationToken);
+ var workspace = document.Project.Solution.Workspace;
+ var root = await document.GetSyntaxRootAsync (cancellationToken).ConfigureAwait (false);
+ var options = await document.GetOptionsAsync (cancellationToken).ConfigureAwait (false);
var changes = Formatter.GetFormattedTextChanges (
root, new TextSpan [] { new TextSpan (startSegment.Offset, endSegment.EndOffset - startSegment.Offset) },
workspace, options, formattingRules, cancellationToken);
if (changes == null)
- return;
- editor.ApplyTextChanges (changes);
- editor.FixVirtualIndentation ();
+ return;
+ await Runtime.RunInMainThread (delegate {
+ editor.ApplyTextChanges (changes);
+ editor.FixVirtualIndentation ();
+ });
} catch (Exception e) {
LoggingService.LogError ("Error while indenting", e);
}
}
- protected override async void OnTheFlyFormatImplementation (TextEditor editor, DocumentContext context, int startOffset, int length)
+ protected override async void OnTheFlyFormatImplementation (Ide.Editor.TextEditor editor, DocumentContext context, int startOffset, int length)
{
var doc = context.AnalysisDocument;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
index 85f2549f2d..dec882e22b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
@@ -34,7 +34,7 @@ namespace MonoDevelop.CSharp.Formatting
[System.ComponentModel.ToolboxItem(true)]
partial class CSharpFormattingPolicyPanelWidget : Gtk.Bin
{
- readonly TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
+ readonly Ide.Editor.TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
// Gtk.ListStore model = new Gtk.ListStore (typeof(string));
// List<CSharpFormattingPolicy> policies = new List<CSharpFormattingPolicy> ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
index c8e99eb7d9..86b9f03f23 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
@@ -40,7 +40,7 @@ namespace MonoDevelop.CSharp.Formatting
{
partial class CSharpFormattingProfileDialog : Gtk.Dialog
{
- readonly TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
+ readonly Ide.Editor.TextEditor texteditor = TextEditorFactory.CreateNewEditor ();
readonly CSharpFormattingPolicy profile;
TreeStore indentationOptions, newLineOptions, spacingOptions, wrappingOptions;
static readonly Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions, string> labelPositionOptionsTranslationDictionary = new Dictionary<Microsoft.CodeAnalysis.CSharp.Formatting.LabelPositionOptions, string> ();
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentationTracker.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentationTracker.cs
index eabdbf90c7..45e7b14c22 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentationTracker.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpIndentationTracker.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.CSharp.Formatting
{
class CSharpIndentationTracker : IndentationTracker
{
- readonly TextEditor editor;
+ readonly Ide.Editor.TextEditor editor;
readonly DocumentContext context;
readonly ISmartIndentationService smartIndentationService;
int cacheSpaceCount = -1, oldTabCount = -1;
@@ -51,7 +51,7 @@ namespace MonoDevelop.CSharp.Formatting
public override IndentationTrackerFeatures SupportedFeatures => IndentationTrackerFeatures.SmartBackspace | IndentationTrackerFeatures.CustomIndentationEngine;
- public CSharpIndentationTracker (TextEditor editor, DocumentContext context)
+ public CSharpIndentationTracker (Ide.Editor.TextEditor editor, DocumentContext context)
{
this.editor = editor;
this.context = context;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
index fb767402d0..b05fa25401 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpTextEditorIndentation.cs
@@ -745,7 +745,7 @@ namespace MonoDevelop.CSharp.Formatting
OptionSet optionSet;
bool completionWindowWasVisible;
- public bool FixLineStart (TextEditor textEditorData, ICSharpCode.NRefactory6.CSharp.IStateMachineIndentEngine stateTracker, int lineNumber)
+ public bool FixLineStart (Ide.Editor.TextEditor textEditorData, ICSharpCode.NRefactory6.CSharp.IStateMachineIndentEngine stateTracker, int lineNumber)
{
if (lineNumber > 1) {
var line = textEditorData.GetLine (lineNumber);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormattingPanel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormattingPanel.cs
index 2c7ea7c5af..1b95b95f6b 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormattingPanel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormattingPanel.cs
@@ -25,13 +25,9 @@
// THE SOFTWARE.
using MonoDevelop.Components;
-using MonoDevelop.Components.AtkCocoaHelper;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Dialogs;
-using Mono.TextEditor;
-using MonoDevelop.Ide.Editor;
using Xwt;
-using MonoDevelop.Ide.Composition;
using Microsoft.CodeAnalysis.Options;
using MonoDevelop.Ide.TypeSystem;
using Microsoft.CodeAnalysis.Editor.Shared.Options;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSelectionSurroundingProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSelectionSurroundingProvider.cs
index e1ff7ea26c..ae7a9d1186 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSelectionSurroundingProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSelectionSurroundingProvider.cs
@@ -39,7 +39,7 @@ namespace MonoDevelop.CSharp.Highlighting
class CSharpSelectionSurroundingProvider : SelectionSurroundingProvider
{
readonly DocumentContext context;
- readonly TextEditor editor;
+ readonly Ide.Editor.TextEditor editor;
public CSharpSelectionSurroundingProvider (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.OptionProvider/StyleViewModel.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.OptionProvider/StyleViewModel.cs
index 4ed5de74f6..fb6b549f1e 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.OptionProvider/StyleViewModel.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.OptionProvider/StyleViewModel.cs
@@ -1,38 +1,36 @@
-//
-// StyleViewModel.cs
-//
-// Author:
-// Mike Krüger <mikkrg@microsoft.com>
-//
-// Copyright (c) 2018 Microsoft Corporation. All rights reserved.
-//
-// 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.
-// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
+//
+// StyleViewModel.cs
+//
+// Author:
+// Mike Krüger <mikkrg@microsoft.com>
+//
+// Copyright (c) 2018 Microsoft Corporation. All rights reserved.
+//
+// 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.
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
using System;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.CSharp.CodeStyle;
using Microsoft.CodeAnalysis.Options;
-using MonoDevelop.Refactoring.Options;
using MonoDevelop.Components;
using MonoDevelop.Core;
using MonoDevelop.Refactoring.Options;
@@ -681,7 +679,7 @@ class Customer
}}
";
- private static readonly string s_preferBraces = $@"
+ private static readonly string s_preferBraces = $@"
using System;
class Customer
@@ -708,7 +706,75 @@ class Customer
}}
}}
";
+ private static readonly string s_doNotPreferBraces = $@"
+using System;
+
+class Customer
+{{
+ private int Age;
+
+ void M1()
+ {{
+//[
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test) Console.WriteLine(""Text"");
+
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test)
+ Console.WriteLine(""Text"");
+
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test)
+ Console.WriteLine(
+ ""Text"");
+
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test)
+ {{
+ Console.WriteLine(
+ ""Text"");
+ }}
+//]
+ }}
+}}
+";
+ private static readonly string s_preferBracesWhenMultiline = $@"
+using System;
+
+class Customer
+{{
+ private int Age;
+
+ void M1()
+ {{
+//[
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test) Console.WriteLine(""Text"");
+
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test)
+ Console.WriteLine(""Text"");
+
+ // {GettextCatalog.GetString ("Allow:")}
+ if (test)
+ {{
+ Console.WriteLine(
+ ""Text"");
+ }}
+//]
+ }}
+ void M2()
+ {{
+//[
+ // {GettextCatalog.GetString ("Over:")}
+ if (test)
+ Console.WriteLine(
+ ""Text"");
+//]
+ }}
+}}
+";
private static readonly string s_preferAutoProperties = $@"
using System;
@@ -1168,7 +1234,7 @@ class C
CodeStyleItems.Add (new BooleanCodeStyleOptionViewModel (CSharpCodeStyleOptions.UseImplicitTypeWherePossible, GettextCatalog.GetString("Elsewhere"), s_varWherePossiblePreviewTrue, s_varWherePossiblePreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
// Code block
- CodeStyleItems.Add (new BooleanCodeStyleOptionViewModel (CSharpCodeStyleOptions.PreferBraces, GettextCatalog.GetString("Prefer braces"), s_preferBraces, s_preferBraces, this, optionSet, codeBlockPreferencesGroupTitle));
+ AddBracesOptions (optionSet, codeBlockPreferencesGroupTitle);
CodeStyleItems.Add (new BooleanCodeStyleOptionViewModel (CodeStyleOptions.PreferAutoProperties, GettextCatalog.GetString("Prefer auto properties"), s_preferAutoProperties, s_preferAutoProperties, this, optionSet, codeBlockPreferencesGroupTitle));
AddParenthesesOptions (Options);
@@ -1201,6 +1267,26 @@ class C
// Field preferences.
CodeStyleItems.Add (new BooleanCodeStyleOptionViewModel (CodeStyleOptions.PreferReadonly, GettextCatalog.GetString("Prefer readonly"), s_preferReadonly, s_preferReadonly, this, optionSet, fieldGroupTitle));
+ }
+
+
+ private void AddBracesOptions (OptionSet optionSet, string bracesPreferenceGroupTitle)
+ {
+ var bracesPreferences = new List<CodeStylePreference>
+ {
+ new CodeStylePreference(GettextCatalog.GetString("Yes"), isChecked: false),
+ new CodeStylePreference(GettextCatalog.GetString("No"), isChecked: false),
+ new CodeStylePreference(GettextCatalog.GetString("When on multiple lines"), isChecked: false),
+ };
+
+ var enumValues = new [] { PreferBracesPreference.Always, PreferBracesPreference.None, PreferBracesPreference.WhenMultiline };
+
+ CodeStyleItems.Add (new EnumCodeStyleOptionViewModel<PreferBracesPreference> (
+ CSharpCodeStyleOptions.PreferBraces,
+ GettextCatalog.GetString ("Prefer Braces"),
+ enumValues,
+ new [] { s_preferBraces, s_doNotPreferBraces, s_preferBracesWhenMultiline },
+ this, optionSet, bracesPreferenceGroupTitle, bracesPreferences));
}
private void AddParenthesesOptions (OptionSet optionSet)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
index 37566182b7..d7d841bead 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/CSharpParsedDocument.cs
@@ -42,7 +42,11 @@ namespace MonoDevelop.CSharp.Parser
{
static string[] tagComments;
- internal SyntaxTree Unit {
+ internal DocumentId DocumentId {
+ get;
+ set;
+ }
+ internal SyntaxTree ParsedUnit {
get;
set;
}
@@ -71,27 +75,44 @@ namespace MonoDevelop.CSharp.Parser
#region implemented abstract members of ParsedDocument
IReadOnlyList<Comment> comments;
- object commentLock = new object ();
+ SemaphoreSlim commentLock = new SemaphoreSlim (1, 1);
public override Task<IReadOnlyList<Comment>> GetCommentsAsync (CancellationToken cancellationToken = default(CancellationToken))
{
if (comments == null) {
- return Task.Run (delegate {
- lock (commentLock) {
+ return Task.Run (async delegate {
+ bool locked = await commentLock.WaitAsync (Timeout.Infinite, cancellationToken).ConfigureAwait (false);
+ await commentLock.WaitAsync ();
+ try {
if (comments == null) {
var visitor = new CommentVisitor (cancellationToken);
- if (Unit != null)
- try {
- visitor.Visit (Unit.GetRoot (cancellationToken));
+ var unit = await GetParsedSyntaxTreeAsync (cancellationToken);
+ if (unit != null) {
+ try {
+ var syntaxRoot = await unit.GetRootAsync (cancellationToken);
+ visitor.Visit (syntaxRoot);
} catch (OperationCanceledException) {
}
+ }
comments = visitor.Comments;
}
+ } finally {
+ if (locked)
+ commentLock.Release ();
}
return comments;
});
}
return Task.FromResult (comments);
+
+ async Task<SyntaxTree> GetParsedSyntaxTreeAsync (CancellationToken token)
+ {
+ if (ParsedUnit == null && DocumentId != null) {
+ var document = TypeSystemService.GetCodeAnalysisDocument (DocumentId, token);
+ ParsedUnit = await document.GetSyntaxTreeAsync (token);
+ }
+ return ParsedUnit;
+ }
}
@@ -328,16 +349,12 @@ namespace MonoDevelop.CSharp.Parser
static readonly IReadOnlyList<Error> emptyErrors = Array.Empty<Error> ();
public override async Task<IReadOnlyList<Error>> GetErrorsAsync (CancellationToken cancellationToken = default(CancellationToken))
{
- if (Ide.IdeApp.Preferences.EnableSourceAnalysis)
+ if (Ide.IdeApp.Preferences.EnableSourceAnalysis || DocumentId is null)
return emptyErrors;
// FIXME: remove this fallback, error squiggles should always be handled via the source analysis mechanism
- #pragma warning disable 618
- var model = GetAst<SemanticModel> ();
- #pragma warning disable 618
-
- if (model == null)
- return emptyErrors;
+ var document = TypeSystemService.GetCodeAnalysisDocument (DocumentId, cancellationToken);
+ var model = await document.GetSemanticModelAsync (cancellationToken);
bool locked = await errorLock.WaitAsync (Timeout.Infinite, cancellationToken).ConfigureAwait (false);
IReadOnlyList<Error> errors;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
index 9d0b4728bd..aba09dd832 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Parser/TypeSystemProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// TypeSystemParser.cs
//
// Author:
@@ -39,7 +39,7 @@ namespace MonoDevelop.CSharp.Parser
{
sealed class TypeSystemParser : MonoDevelop.Ide.TypeSystem.TypeSystemParser
{
- public override async System.Threading.Tasks.Task<ParsedDocument> Parse (MonoDevelop.Ide.TypeSystem.ParseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public override System.Threading.Tasks.Task<ParsedDocument> Parse (MonoDevelop.Ide.TypeSystem.ParseOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
var fileName = options.FileName;
var project = options.Project;
@@ -52,40 +52,19 @@ namespace MonoDevelop.CSharp.Parser
result.Flags |= ParsedDocumentFlags.NonSerializable;
}
- SyntaxTree unit = null;
-
if (project != null) {
var curDoc = options.RoslynDocument;
if (curDoc == null) {
var curProject = IdeApp.TypeSystemService.GetCodeAnalysisProject (project);
if (curProject != null) {
var documentId = IdeApp.TypeSystemService.GetDocumentId (project, fileName);
- if (documentId != null)
- curDoc = curProject.GetDocument (documentId);
- }
- }
- if (curDoc != null) {
- try {
- var model = await curDoc.GetSemanticModelAsync (cancellationToken).ConfigureAwait (false);
- unit = model.SyntaxTree;
- result.Ast = model;
- } catch (AggregateException ae) {
- ae.Flatten ().Handle (x => x is OperationCanceledException);
- return result;
- } catch (OperationCanceledException) {
- return result;
- } catch (Exception e) {
- LoggingService.LogError ("Error while getting the semantic model for " + fileName, e);
+ result.DocumentId = documentId;
}
}
- }
-
- if (unit == null) {
+ } else {
var compilerArguments = GetCompilerArguments (project);
- unit = CSharpSyntaxTree.ParseText (SourceText.From (options.Content.Text), compilerArguments, fileName);
- }
-
- result.Unit = unit;
+ result.ParsedUnit = CSharpSyntaxTree.ParseText (SourceText.From (options.Content.Text), compilerArguments, fileName);
+ }
DateTime time;
try {
@@ -94,7 +73,7 @@ namespace MonoDevelop.CSharp.Parser
time = DateTime.UtcNow;
}
result.LastWriteTimeUtc = time;
- return result;
+ return Task.FromResult<ParsedDocument> (result);
}
public static CSharpParseOptions GetCompilerArguments (MonoDevelop.Projects.Project project)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
index 9feb21b991..bf9ae347f7 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
@@ -398,18 +398,7 @@ namespace MonoDevelop.CSharp.Project
#endregion
internal static string LanguageVersionToString (LanguageVersion value)
- {
- switch (value) {
- case LanguageVersion.Default: return "Default";
- case LanguageVersion.Latest: return "Latest";
- case LanguageVersion.CSharp1: return "ISO-1";
- case LanguageVersion.CSharp2: return "ISO-2";
- case LanguageVersion.CSharp7_1: return "7.1";
- case LanguageVersion.CSharp7_2: return "7.2";
- case LanguageVersion.CSharp7_3: return "7.3";
- default: return ((int)value).ToString ();
- }
- }
+ => LanguageVersionFacts.ToDisplayString (value);
void NotifyChange ()
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpLanguageVersionHelper.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpLanguageVersionHelper.cs
index 1a50879a4e..af0471b820 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpLanguageVersionHelper.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpLanguageVersionHelper.cs
@@ -45,6 +45,9 @@ namespace MonoDevelop.CSharp.Project
yield return (GettextCatalog.GetString ("Version 7.1"), LanguageVersion.CSharp7_1);
yield return (GettextCatalog.GetString ("Version 7.2"), LanguageVersion.CSharp7_2);
yield return (GettextCatalog.GetString ("Version 7.3"), LanguageVersion.CSharp7_3);
+ yield return (GettextCatalog.GetString ("Version 8"), LanguageVersion.CSharp8);
+ yield return (GettextCatalog.GetString ("Latest Major"), LanguageVersion.LatestMajor);
+ yield return (GettextCatalog.GetString ("Preview"), LanguageVersion.Preview);
yield return (GettextCatalog.GetString ("Latest"), LanguageVersion.Latest);
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
index c913ccb999..396dc158c6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CompilerOptionsPanelWidget.cs
@@ -28,6 +28,7 @@
//
using System;
+using System.Linq;
using Gtk;
using MonoDevelop.Components;
@@ -49,6 +50,11 @@ namespace MonoDevelop.CSharp.Project
DotNetProject project;
ListStore classListStore;
bool classListFilled;
+ LanguageVersion[] unsupportedLanguageVersions = {
+ LanguageVersion.CSharp8,
+ LanguageVersion.LatestMajor,
+ LanguageVersion.Preview
+ };
public CompilerOptionsPanelWidget (DotNetProject project)
{
@@ -95,7 +101,11 @@ namespace MonoDevelop.CSharp.Project
var langVerStore = new ListStore (typeof (string), typeof(LanguageVersion));
foreach (var (text, version) in CSharpLanguageVersionHelper.GetKnownLanguageVersions ()) {
- langVerStore.AppendValues (text, version);
+ if (unsupportedLanguageVersions.Contains (version) && compilerParameters.LangVersion != version) {
+ // Mono's MSBuild does not currently support C# 8.
+ } else {
+ langVerStore.AppendValues (text, version);
+ }
}
langVerCombo.Model = langVerStore;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
index c989418a56..733744f93a 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CSharpCodeGenerator.cs
@@ -77,7 +77,7 @@ namespace MonoDevelop.CSharp.Refactoring
public ITypeSymbol ImplementingType { get; set; }
public Location Part { get; set; }
- public TextEditor Editor { get; set; }
+ public Ide.Editor.TextEditor Editor { get; set; }
public DocumentContext DocumentContext { get; set; }
public bool CreateProtocolMember { get; set; }
@@ -188,7 +188,7 @@ namespace MonoDevelop.CSharp.Refactoring
// throw new NotSupportedException ("member " + member + " is not supported.");
// }
- public static CodeGeneratorMemberResult CreateOverridenMemberImplementation(DocumentContext document, TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
+ public static CodeGeneratorMemberResult CreateOverridenMemberImplementation(DocumentContext document, Ide.Editor.TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
{
var options = new CodeGenerationOptions {
ExplicitDeclaration = explicitDeclaration,
@@ -210,7 +210,7 @@ namespace MonoDevelop.CSharp.Refactoring
throw new NotSupportedException("member " + member + " is not supported.");
}
- public static CodeGeneratorMemberResult CreateProtocolMemberImplementation(DocumentContext document, TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
+ public static CodeGeneratorMemberResult CreateProtocolMemberImplementation(DocumentContext document, Ide.Editor.TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
{
// SetIndentTo (part);
var options = new CodeGenerationOptions {
@@ -234,7 +234,7 @@ namespace MonoDevelop.CSharp.Refactoring
throw new NotSupportedException("member " + member + " is not supported.");
}
- public static CodeGeneratorMemberResult CreatePartialMemberImplementation(DocumentContext document, TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
+ public static CodeGeneratorMemberResult CreatePartialMemberImplementation(DocumentContext document, Ide.Editor.TextEditor editor, ITypeSymbol implementingType, Location part, ISymbol member, bool explicitDeclaration, SemanticModel model)
{
var options = new CodeGenerationOptions {
ExplicitDeclaration = explicitDeclaration,
@@ -1054,12 +1054,12 @@ namespace MonoDevelop.CSharp.Refactoring
return new CodeGeneratorMemberResult(Core.StringBuilderCache.ReturnAndFree (result), bodyStartOffset, bodyEndOffset);
}
- public override void AddGlobalNamespaceImport (TextEditor editor, DocumentContext context, string nsName)
+ public override void AddGlobalNamespaceImport (Ide.Editor.TextEditor editor, DocumentContext context, string nsName)
{
// not used anymore
}
- public override void AddLocalNamespaceImport (TextEditor editor, DocumentContext context, string nsName, TextLocation caretLocation)
+ public override void AddLocalNamespaceImport (Ide.Editor.TextEditor editor, DocumentContext context, string nsName, TextLocation caretLocation)
{
// not used anymore
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs
new file mode 100644
index 0000000000..e22c7c2ce0
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/CommandArgsFactories.cs
@@ -0,0 +1,37 @@
+//
+// CommandArgsFactories.cs
+//
+//
+// Copyright (c) 2019 Microsoft
+//
+// 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 Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.CodeAnalysis.Editor.Commanding.Commands;
+
+namespace MonoDevelop.CSharp.Refactoring
+{
+ static class CommandArgsFactories
+ {
+ public static SortAndRemoveUnnecessaryImportsCommandArgs CreateSortAndRemoveUnnecessaryImportsCommandArgs (ITextView v, ITextBuffer b)
+ => new SortAndRemoveUnnecessaryImportsCommandArgs (v, b);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
index d187050647..f2695122c7 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
@@ -173,7 +173,14 @@ namespace MonoDevelop.CSharp.Refactoring
streamingProgresses [i] = reportingProgress;
}
for (int i = 0; i < tasks.Length; i++) {
- tasks [i] = SymbolFinder.FindReferencesAsync (symbolAndProjectIds [i], solution, streamingProgresses [i], null, monitor.CancellationToken);
+ tasks [i] = SymbolFinder.FindReferencesAsync (
+ symbolAndProjectIds [i],
+ solution,
+ streamingProgresses [i],
+ null,
+ FindReferencesSearchOptions.GetFeatureOptionsForStartingSymbol (symbolAndProjectIds [i].Symbol),
+ monitor.CancellationToken
+ );
}
await Task.WhenAll (tasks);
} catch (OperationCanceledException) {
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/RenameHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/RenameHandler.cs
index 3923d7a030..5890c2679d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/RenameHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/RenameHandler.cs
@@ -82,7 +82,7 @@ namespace MonoDevelop.CSharp.Refactoring
await Run (doc.Editor, doc.DocumentContext);
}
- internal async Task Run (TextEditor editor, DocumentContext ctx)
+ internal async Task Run (Ide.Editor.TextEditor editor, DocumentContext ctx)
{
var cts = new CancellationTokenSource ();
var getSymbolTask = RenameLocations.ReferenceProcessing.GetRenamableSymbolAsync (ctx.AnalysisDocument, editor.CaretOffset, cts.Token);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
index ff16c68b6a..2930ede1fa 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Tooltips/LanguageItemTooltipProvider.cs
@@ -48,7 +48,7 @@ namespace MonoDevelop.SourceEditor
class LanguageItemTooltipProvider : TooltipProvider, IDisposable
{
#region ITooltipProvider implementation
- public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
+ public override async Task<TooltipItem> GetItem (Ide.Editor.TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
{
if (ctx == null)
return null;
@@ -117,7 +117,7 @@ namespace MonoDevelop.SourceEditor
#endregion
- public override Components.Window CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
+ public override Components.Window CreateTooltipWindow (Ide.Editor.TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var doc = ctx;
if (doc == null)
@@ -156,7 +156,7 @@ namespace MonoDevelop.SourceEditor
}
}
- public override void GetRequiredPosition (TextEditor editor, Components.Window tipWindow, out int requiredWidth, out double xalign)
+ public override void GetRequiredPosition (Ide.Editor.TextEditor editor, Components.Window tipWindow, out int requiredWidth, out double xalign)
{
var win = (TooltipInformationWindow)tipWindow;
requiredWidth = (int)win.Width;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.DataProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.DataProvider.cs
new file mode 100644
index 0000000000..4e63261b1f
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.DataProvider.cs
@@ -0,0 +1,262 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Copyright (c) 2011 Novell, Inc (http://www.novell.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 System;
+using System.Collections.Generic;
+using System.Linq;
+
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Text;
+
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Operations;
+
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.CSharp
+{
+ sealed partial class CSharpPathedDocumentExtension
+ {
+ class DataProvider : DropDownBoxListWindow.IListDataProvider
+ {
+ readonly CSharpPathedDocumentExtension ext;
+ object tag;
+ List<SyntaxNode> memberList = new List<SyntaxNode> ();
+
+ public DataProvider (CSharpPathedDocumentExtension ext, object tag)
+ {
+ this.ext = ext ?? throw new ArgumentNullException (nameof (ext));
+ this.tag = tag;
+ Reset ();
+ }
+
+ void AddTypeToMemberList (BaseTypeDeclarationSyntax btype)
+ {
+ if (btype is EnumDeclarationSyntax e) {
+ foreach (var member in e.Members) {
+ memberList.Add (member);
+ }
+ return;
+ }
+ var type = (TypeDeclarationSyntax)btype;
+ foreach (var member in type.Members) {
+ if (member is FieldDeclarationSyntax) {
+ foreach (var variable in ((FieldDeclarationSyntax)member).Declaration.Variables)
+ memberList.Add (variable);
+ } else if (member is EventFieldDeclarationSyntax) {
+ foreach (var variable in ((EventFieldDeclarationSyntax)member).Declaration.Variables)
+ memberList.Add (variable);
+ } else {
+ memberList.Add (member);
+ }
+ }
+ }
+
+ public void Reset ()
+ {
+ memberList.Clear ();
+ if (tag is SyntaxTree) {
+ var unit = tag as SyntaxTree;
+ memberList.AddRange (unit.GetRoot ().DescendantNodes ().Where (IsType));
+ } else if (tag is AccessorDeclarationSyntax acc) {
+ var parent = (MemberDeclarationSyntax)acc.Parent;
+ memberList.AddRange (parent.ChildNodes ().OfType<AccessorDeclarationSyntax> ());
+ } else if (tag is SyntaxNode entity) {
+ var type = entity.AncestorsAndSelf ().OfType<BaseTypeDeclarationSyntax> ().FirstOrDefault ();
+ if (type != null) {
+ AddTypeToMemberList (type);
+ }
+ }
+
+ memberList.Sort ((x, y) => {
+ var result = string.Compare (GetName (x), GetName (y), StringComparison.OrdinalIgnoreCase);
+ if (result == 0)
+ result = GetTypeParameters (x).CompareTo (GetTypeParameters (y));
+ if (result == 0)
+ result = GetParameters (x).CompareTo (GetParameters (y));
+
+ // partial methods without body should come last
+ if (result == 0 && x is MethodDeclarationSyntax && y is MethodDeclarationSyntax) {
+ var mx = x as MethodDeclarationSyntax;
+ var my = y as MethodDeclarationSyntax;
+ if (mx.Body == null && my.Body != null)
+ return 1;
+ if (mx.Body != null && my.Body == null)
+ return -1;
+ }
+ return result;
+ });
+ }
+
+ static int GetTypeParameters (SyntaxNode x)
+ {
+ return 0; //x.GetChildrenByRole (Roles.TypeParameter).Count ();
+ }
+
+ static int GetParameters (SyntaxNode x)
+ {
+ return 0; // x.GetChildrenByRole (Roles.Parameter).Count ();
+ }
+
+ string GetName (SyntaxNode node)
+ {
+ if (tag is SyntaxTree) {
+ var type = node;
+ if (type != null) {
+ var sb = StringBuilderCache.Allocate ();
+ sb.Append (ext.GetEntityMarkup (type));
+ while (type.Parent is BaseTypeDeclarationSyntax) {
+ sb.Insert (0, ext.GetEntityMarkup (type.Parent) + ".");
+ type = type.Parent;
+ }
+ return StringBuilderCache.ReturnAndFree (sb);
+ }
+ }
+ if (node is AccessorDeclarationSyntax accessor) {
+ if (accessor.Kind () == SyntaxKind.GetAccessorDeclaration)
+ return "get";
+ if (accessor.Kind () == SyntaxKind.SetAccessorDeclaration)
+ return "set";
+ if (accessor.Kind () == SyntaxKind.AddAccessorDeclaration)
+ return "add";
+ if (accessor.Kind () == SyntaxKind.RemoveAccessorDeclaration)
+ return "remove";
+ return node.ToString ();
+ }
+ if (node is OperatorDeclarationSyntax)
+ return "operator";
+ if (node is PropertyDeclarationSyntax)
+ return ((PropertyDeclarationSyntax)node).Identifier.ToString ();
+ if (node is MethodDeclarationSyntax)
+ return ((MethodDeclarationSyntax)node).Identifier.ToString ();
+ if (node is ConstructorDeclarationSyntax)
+ return ((ConstructorDeclarationSyntax)node).Identifier.ToString ();
+ if (node is DestructorDeclarationSyntax)
+ return ((DestructorDeclarationSyntax)node).Identifier.ToString ();
+ if (node is BaseTypeDeclarationSyntax)
+ return ((BaseTypeDeclarationSyntax)node).Identifier.ToString ();
+
+ // if (node is fixeds) {
+ // return ((FixedVariableInitializer)node).Name;
+ // }
+ if (node is VariableDeclaratorSyntax)
+ return ((VariableDeclaratorSyntax)node).Identifier.ToString ();
+ return node.ToString ();
+ }
+
+ public string GetMarkup (int n)
+ {
+ if (tag is DotNetProject) {
+ return GLib.Markup.EscapeText (ext.ownerProjects[n].Name);
+ }
+
+ var node = memberList[n];
+ if (tag is SyntaxTree) {
+ var type = node;
+ if (type != null) {
+ var sb = StringBuilderCache.Allocate ();
+ sb.Append (ext.GetEntityMarkup (type));
+ while (type.Parent is BaseTypeDeclarationSyntax) {
+ sb.Insert (0, ext.GetEntityMarkup (type.Parent) + ".");
+ type = type.Parent;
+ }
+ return StringBuilderCache.ReturnAndFree (sb);
+ }
+ }
+ return ext.GetEntityMarkup (node);
+ }
+
+ public Xwt.Drawing.Image GetIcon (int n)
+ {
+ string icon;
+ if (tag is DotNetProject) {
+ icon = ext.ownerProjects[n].StockIcon;
+ } else {
+ var node = memberList[n];
+ if (node is MemberDeclarationSyntax) {
+ icon = ((MemberDeclarationSyntax)node).GetStockIcon ();
+ } else if (node is VariableDeclaratorSyntax) {
+ icon = node.Parent.Parent.GetStockIcon ();
+ } else {
+ icon = node.Parent.GetStockIcon ();
+ }
+ }
+ return ImageService.GetIcon (icon, Gtk.IconSize.Menu);
+ }
+
+ public object GetTag (int n)
+ {
+ if (tag is DotNetProject) {
+ return ext.ownerProjects[n];
+ }
+ return memberList[n];
+ }
+
+ public void ActivateItem (int n)
+ {
+ if (tag is DotNetProject) {
+ var proj = ext.ownerProjects [n];
+ foreach (var doc in ext.textContainer.GetRelatedDocuments ())
+ if (TypeSystemService.GetMonoProject (doc.Project) is DotNetProject dnp && dnp == proj)
+ ext.registration.Workspace.SetDocumentContext (doc.Id);
+ ext.WorkspaceChanged (null, null);
+ return;
+ }
+
+ var node = memberList[n];
+ var editor = ext.textView;
+ int offset;
+ if (node is OperatorDeclarationSyntax) {
+ offset = Math.Max (1, ((OperatorDeclarationSyntax)node).OperatorToken.SpanStart);
+ } else if (node is MemberDeclarationSyntax && !(node is AccessorDeclarationSyntax)) {
+ offset = Math.Max (1, ((MemberDeclarationSyntax)node).SpanStart);
+ } else {
+ offset = node.SpanStart;
+ }
+
+ //FIXME: use the snapshot that the nodes came from
+ var point = new VirtualSnapshotPoint (editor.TextBuffer.CurrentSnapshot, offset);
+ EditorOperations.SelectAndMoveCaret (point, point, TextSelectionMode.Stream, EnsureSpanVisibleOptions.AlwaysCenter);
+ editor.Properties.GetProperty<ViewContent> (typeof (ViewContent)).GrabFocus ();
+ }
+
+ public int IconCount {
+ get {
+ if (tag is DotNetProject) {
+ return ext.ownerProjects.Count;
+ }
+ return memberList.Count;
+ }
+ }
+
+ public IEditorOperations EditorOperations { get; internal set; }
+ }
+ }
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.cs
new file mode 100644
index 0000000000..7b12018e73
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtension.cs
@@ -0,0 +1,614 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Copyright (c) 2011 Novell, Inc (http://www.novell.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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using Microsoft.CodeAnalysis.Shared.Extensions;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Threading;
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Projects;
+using MonoDevelop.TextEditor;
+
+namespace MonoDevelop.CSharp
+{
+ sealed partial class CSharpPathedDocumentExtension : IPathedDocument, IDisposable
+ {
+ readonly ITextView textView;
+ readonly Microsoft.VisualStudio.Text.Operations.IEditorOperations editorOperations;
+ readonly JoinableTaskContext joinableTaskContext;
+ List<DotNetProject> ownerProjects = new List<DotNetProject> ();
+ List<DotNetProject> lastOwnerProjects = new List<DotNetProject> ();
+ bool disposed;
+ WorkspaceRegistration registration;
+ SourceTextContainer textContainer;
+
+ public CSharpPathedDocumentExtension (ITextView view, JoinableTaskContext joinableTaskContext, Microsoft.VisualStudio.Text.Operations.IEditorOperations editorOperations)
+ {
+ textView = view;
+
+ this.editorOperations = editorOperations;
+
+ this.joinableTaskContext = joinableTaskContext;
+ textContainer = view.TextBuffer.AsTextContainer ();
+ registration = Microsoft.CodeAnalysis.Workspace.GetWorkspaceRegistration (textContainer);
+ registration.WorkspaceChanged += WorkspaceChanged;
+
+ CurrentPath = new PathEntry [] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
+ isPathSet = false;
+ view.Caret.PositionChanged += CaretPositionChanged;
+ view.TextBuffer.PostChanged += TextBufferChanged;
+ }
+
+ private void WorkspaceChanged (object sender, EventArgs e)
+ {
+ ownerProjects.Clear ();
+ var activeDocument = textContainer.GetOpenDocumentInCurrentContext ();
+ if (activeDocument == null)
+ return;
+ var activeProj = (DotNetProject)TypeSystemService.GetMonoProject (activeDocument.Project);
+ ownerProjects.Add (activeProj);
+ foreach (var document in textContainer.GetRelatedDocuments ())
+ if (TypeSystemService.GetMonoProject (document.Project) is DotNetProject dotnetProj && dotnetProj != activeProj)
+ ownerProjects.Add (dotnetProj);
+ Update (activeDocument, textView.Caret.Position.BufferPosition);
+ }
+
+ public void Dispose ()
+ {
+ if (disposed) {
+ return;
+ }
+ disposed = true;
+ registration.WorkspaceChanged -= WorkspaceChanged;
+ textView.Caret.PositionChanged -= CaretPositionChanged;
+ textView.TextBuffer.PostChanged -= TextBufferChanged;
+ }
+
+ void TextBufferChanged (object sender, EventArgs e)
+ {
+ Update (textView.Caret.Position);
+ }
+
+ void CaretPositionChanged (object sender, CaretPositionChangedEventArgs e)
+ {
+ Update (e.NewPosition);
+ }
+
+ ITextSnapshot lastSnapshot;
+ int lastOffset;
+
+ void Update (CaretPosition position)
+ {
+ var snapshot = position.BufferPosition.Snapshot;
+ int offset = position.BufferPosition.Position;
+
+ if (lastSnapshot == snapshot && lastOffset == offset && ownerProjects.SequenceEqual(lastOwnerProjects)) {
+ return;
+ }
+ lastSnapshot = snapshot;
+ lastOffset = offset;
+ lastOwnerProjects = ownerProjects.ToList ();//clone
+
+ var roslynDocument = snapshot.AsText ().GetOpenDocumentInCurrentContextWithChanges ();
+ if (roslynDocument != null) {
+ Update (roslynDocument, position.BufferPosition.Position);
+ }
+ }
+
+ public event EventHandler<DocumentPathChangedEventArgs> PathChanged;
+
+ void OnPathChanged (DocumentPathChangedEventArgs e) => PathChanged?.Invoke (this, e);
+
+ public Control CreatePathWidget (int index)
+ {
+ PathEntry [] path = CurrentPath;
+ if (path == null || index < 0 || index >= path.Length)
+ return null;
+ var tag = path [index].Tag;
+ //FIXME
+ //var window = new DropDownBoxListWindow (tag == null ? (DropDownBoxListWindow.IListDataProvider)new CompilationUnitDataProvider (Editor, DocumentContext) : new DataProvider (this, tag));
+ var window = new DropDownBoxListWindow (new DataProvider (this, tag) {
+ EditorOperations = editorOperations
+ }) {
+ FixedRowHeight = 22,
+ MaxVisibleRows = 14
+ };
+ window.SelectItem (path [index].Tag);
+ return window;
+ }
+
+ PathEntry [] currentPath;
+ bool isPathSet;
+
+ public PathEntry [] CurrentPath {
+ get {
+ return currentPath;
+ }
+ private set {
+ currentPath = value;
+ isPathSet = true;
+ }
+ }
+
+ AstAmbience? amb;
+
+ string GetEntityMarkup (SyntaxNode node)
+ {
+ if (amb == null || node == null)
+ return "";
+ return amb.Value.GetEntityMarkup (node);
+ }
+
+ static bool IsType (SyntaxNode m)
+ {
+ return m is BaseTypeDeclarationSyntax || m is DelegateDeclarationSyntax;
+ }
+
+ /*
+ bool isPathSet;
+ CSharpCompletionTextEditorExtension ext;
+
+ List<DotNetProject> ownerProjects = new List<DotNetProject> ();
+
+ protected override void Initialize ()
+ {
+ // Delay the execution of UpdateOwnerProjects since it may end calling DocumentContext.AttachToProject,
+ // which shouldn't be called while the extension chain is being initialized.
+ Gtk.Application.Invoke ((o, args) => {
+ UpdateOwnerProjects ();
+ Editor_CaretPositionChanged (null, null);
+ });
+
+ Editor.TextChanging += Editor_TextChanging;
+ DocumentContext.DocumentParsed += DocumentContext_DocumentParsed;
+ ext = DocumentContext.GetContent<CSharpCompletionTextEditorExtension> ();
+ ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
+
+ IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
+ IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
+ IdeApp.Workspace.WorkspaceItemUnloaded += HandleWorkspaceItemUnloaded;
+ IdeApp.Workspace.WorkspaceItemLoaded += HandleWorkspaceItemLoaded;
+ IdeApp.Workspace.ItemAddedToSolution += HandleProjectChanged;
+ IdeApp.Workspace.ActiveConfigurationChanged += HandleActiveConfigurationChanged;
+ SubscribeCaretPositionChange ();
+ }
+
+
+
+ CancellationTokenSource documentParsedCancellationTokenSource = new CancellationTokenSource ();
+
+ void DocumentContext_DocumentParsed (object sender, EventArgs e)
+ {
+ SubscribeCaretPositionChange ();
+
+ // Fixes a potential memory leak see: https://bugzilla.xamarin.com/show_bug.cgi?id=38041
+ if (ownerProjects?.Count > 1) {
+ var currentOwners = ownerProjects.Where (p => p != DocumentContext.Project).Select (TypeSystemService.GetCodeAnalysisProject).ToList ();
+ CancelDocumentParsedUpdate ();
+ var token = documentParsedCancellationTokenSource.Token;
+ Task.Run (async delegate {
+ foreach (var otherProject in currentOwners) {
+ if (otherProject == null)
+ continue;
+ await otherProject.GetCompilationAsync (token).ConfigureAwait (false);
+ }
+ });
+ }
+ }
+
+ void HandleActiveConfigurationChanged (object sender, EventArgs e)
+ {
+ // If the current configuration changes and the project to which this document is bound is disabled in the
+ // new configuration, try to find another project
+ if (DocumentContext.Project != null && DocumentContext.Project.ParentSolution == IdeApp.ProjectOperations.CurrentSelectedSolution) {
+ var conf = DocumentContext.Project.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ if (conf != null && !conf.BuildEnabledForItem (DocumentContext.Project))
+ ResetOwnerProject ();
+ }
+ }
+
+ void HandleWorkspaceItemLoaded (object sender, WorkspaceItemEventArgs e)
+ {
+ if (ownerProjects != null)
+ return;
+ UpdateOwnerProjects (e.Item.GetAllItems<DotNetProject> ());
+ }
+
+ void HandleWorkspaceItemUnloaded (object sender, WorkspaceItemEventArgs e)
+ {
+ if (ownerProjects == null)
+ return;
+ foreach (var p in e.Item.GetAllItems<DotNetProject> ()) {
+ RemoveOwnerProject (p);
+ }
+ if (ownerProjects.Count == 0) {
+ ownerProjects = null;
+ DocumentContext.AttachToProject (null);
+ }
+ }
+
+ void HandleProjectChanged (object sender, EventArgs e)
+ {
+ UpdateOwnerProjects ();
+ Editor_CaretPositionChanged (null, null);
+ }
+
+ void UpdateOwnerProjects (IEnumerable<DotNetProject> allProjects)
+ {
+ Editor.RunWhenRealized (() => {
+ if (DocumentContext == null) {
+ return;//This can happen if this object is disposed
+ }
+ var projects = new HashSet<DotNetProject> (allProjects.Where (p => p.IsFileInProject (DocumentContext.Name)));
+ if (ownerProjects == null || !projects.SetEquals (ownerProjects)) {
+ SetOwnerProjects (projects.OrderBy (p => p.Name).ToList ());
+ var dnp = DocumentContext.Project as DotNetProject;
+ if (ownerProjects.Count > 0 && (dnp == null || !ownerProjects.Contains (dnp))) {
+ // If the project for the document is not a DotNetProject but there is a project containing this file
+ // in the current solution, then use that project
+ var pp = DocumentContext.Project != null ? FindBestDefaultProject (DocumentContext.Project.ParentSolution) : null;
+ if (pp != null)
+ DocumentContext.AttachToProject (pp);
+ }
+ }
+ });
+ }
+
+ void UpdateOwnerProjects ()
+ {
+ UpdateOwnerProjects (IdeApp.Workspace.GetAllItems<DotNetProject> ());
+ if (DocumentContext != null && DocumentContext.Project == null)
+ ResetOwnerProject ();
+ }
+
+ void ResetOwnerProject ()
+ {
+ if (ownerProjects == null)
+ return;
+ if (ownerProjects.Count > 0)
+ DocumentContext.AttachToProject (FindBestDefaultProject ());
+ }
+
+ DotNetProject FindBestDefaultProject (Projects.Solution solution = null)
+ {
+ // The best candidate to be selected as default project for this document is the startup project.
+ // If the startup project is not an owner, pick any project that is not disabled in the current configuration.
+ DotNetProject best = null;
+ if (solution == null)
+ solution = IdeApp.ProjectOperations.CurrentSelectedSolution;
+ foreach (var p in ownerProjects) {
+ if (p.ParentSolution != solution)
+ continue;
+ var solConf = p.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ if (solConf == null || !solConf.BuildEnabledForItem (p))
+ continue;
+ if (p == p.ParentSolution.StartupItem)
+ return p;
+ if (best == null)
+ best = p;
+ }
+ return best ?? ownerProjects.FirstOrDefault (pr => pr.ParentSolution == solution) ?? ownerProjects.FirstOrDefault ();
+ }
+
+ void SetOwnerProjects (List<DotNetProject> projects)
+ {
+ UntrackStartupProjectChanges ();
+ ownerProjects = projects;
+ TrackStartupProjectChanges ();
+ }
+
+ void RemoveOwnerProject (DotNetProject project)
+ {
+ UntrackStartupProjectChanges ();
+ ownerProjects.Remove (project);
+ TrackStartupProjectChanges ();
+ }
+
+ void TrackStartupProjectChanges ()
+ {
+ if (ownerProjects != null) {
+ foreach (var sol in ownerProjects.Select (p => p.ParentSolution).Distinct ())
+ sol.StartupItemChanged += HandleStartupProjectChanged;
+ }
+ }
+
+ void UntrackStartupProjectChanges ()
+ {
+ if (ownerProjects != null) {
+ foreach (var sol in ownerProjects.Select (p => p.ParentSolution).Distinct ()) {
+ if (sol != null)
+ sol.StartupItemChanged -= HandleStartupProjectChanged;
+ }
+ }
+ }
+
+ void HandleStartupProjectChanged (object sender, EventArgs e)
+ {
+ // If the startup project changes, and the new startup project is an owner of this document,
+ // then attach the document to that project
+
+ var sol = (Projects.Solution) sender;
+ var p = sol.StartupItem as DotNetProject;
+ if (p != null && ownerProjects.Contains (p))
+ DocumentContext?.AttachToProject (p);
+ }
+
+ #region IPathedDocument implementation
+
+ class CompilationUnitDataProvider : DropDownBoxListWindow.IListDataProvider
+ {
+ TextEditor editor;
+
+ DocumentContext DocumentContext {
+ get;
+ set;
+ }
+
+ public CompilationUnitDataProvider (TextEditor editor, DocumentContext documentContext)
+ {
+ this.editor = editor;
+ this.DocumentContext = documentContext;
+ }
+
+ #region IListDataProvider implementation
+
+ public void Reset ()
+ {
+ }
+
+ public string GetMarkup (int n)
+ {
+ return GLib.Markup.EscapeText (DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n).Name);
+ }
+
+ internal static Xwt.Drawing.Image Pixbuf {
+ get {
+ return ImageService.GetIcon (Ide.Gui.Stock.Region, Gtk.IconSize.Menu);
+ }
+ }
+
+ public Xwt.Drawing.Image GetIcon (int n)
+ {
+ return Pixbuf;
+ }
+
+ public object GetTag (int n)
+ {
+ return DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n);
+ }
+
+ public void ActivateItem (int n)
+ {
+ var reg = DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.ElementAt (n);
+ var extEditor = editor;
+ if (extEditor != null) {
+ extEditor.SetCaretLocation(Math.Max (1, reg.Region.BeginLine), reg.Region.BeginColumn, true);
+ }
+ }
+
+ public int IconCount {
+ get {
+ if (DocumentContext.ParsedDocument == null)
+ return 0;
+ return DocumentContext.ParsedDocument.GetUserRegionsAsync().Result.Count ();
+ }
+ }
+
+ #endregion
+
+ }
+
+ async static Task<PathEntry> GetRegionEntry (ParsedDocument unit, DocumentLocation loc)
+ {
+ PathEntry entry;
+ FoldingRegion reg = null;
+ try {
+ if (unit != null) {
+ var regions = await unit.GetUserRegionsAsync ().ConfigureAwait (false);
+ if (!regions.Any ())
+ return null;
+ reg = regions.LastOrDefault (r => r.Region.Contains (loc));
+ }
+ } catch (AggregateException) {
+ return null;
+ } catch (OperationCanceledException) {
+ return null;
+ }
+ if (reg == null) {
+ entry = new PathEntry (GettextCatalog.GetString ("No region"));
+ } else {
+ var pixbuf = await Runtime.RunInMainThread (() => CompilationUnitDataProvider.Pixbuf).ConfigureAwait (false);
+ entry = new PathEntry (pixbuf, GLib.Markup.EscapeText (reg.Name));
+ }
+ entry.Position = EntryPosition.Right;
+ return entry;
+ }
+
+ bool caretPositionChangedSubscribed;
+ */
+
+ Projects.Project lastProject;
+ SyntaxNode lastType;
+ string lastTypeMarkup;
+ SyntaxNode lastMember;
+ string lastMemberMarkup;
+
+ CancellationTokenSource src = new CancellationTokenSource ();
+
+ void Update (Document document, int caretOffset)
+ {
+ CancelUpdatePath ();
+ var cancellationToken = src.Token;
+ Task.Run (async () => {
+ var root = await document.GetSyntaxRootAsync (cancellationToken);
+ if (root == null || cancellationToken.IsCancellationRequested)
+ return;
+
+ amb = new AstAmbience (TypeSystemService.Workspace.Options);
+
+ SyntaxNode node;
+ try {
+ if (root.FullSpan.Length <= caretOffset) {
+ var prevPath = CurrentPath;
+ CurrentPath = new PathEntry [] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
+ isPathSet = false;
+ Runtime.RunInMainThread (delegate {
+ OnPathChanged (new DocumentPathChangedEventArgs (prevPath));
+ }).Ignore ();
+ return;
+ }
+ node = root.FindNode (TextSpan.FromBounds (caretOffset, caretOffset));
+ if (node.SpanStart != caretOffset)
+ node = root.SyntaxTree.FindTokenOnLeftOfPosition (caretOffset, cancellationToken).Parent;
+ } catch (Exception ex) {
+ LoggingService.LogError ("Error updating C# breadcrumbs", ex);
+ return;
+ }
+
+ var curMember = node?.AncestorsAndSelf ().FirstOrDefault (m => m is VariableDeclaratorSyntax && m.Parent != null && !(m.Parent.Parent is LocalDeclarationStatementSyntax) || (m is MemberDeclarationSyntax && !(m is NamespaceDeclarationSyntax)));
+ var curType = node != null ? node.AncestorsAndSelf ().FirstOrDefault (IsType) : null;
+
+ var curProject = ownerProjects != null && ownerProjects.Count > 1 ? ownerProjects [0] : null;
+ if (curType == curMember || curType is DelegateDeclarationSyntax)
+ curMember = null;
+ if (isPathSet && curType == lastType && curMember == lastMember && curProject == lastProject) {
+ return;
+ }
+ var curTypeMakeup = GetEntityMarkup (curType);
+ var curMemberMarkup = GetEntityMarkup (curMember);
+ if (isPathSet && curType != null && lastType != null && curTypeMakeup == lastTypeMarkup &&
+ curMember != null && lastMember != null && curMemberMarkup == lastMemberMarkup && curProject == lastProject) {
+ return;
+ }
+
+ // var regionEntry = await GetRegionEntry (DocumentContext.ParsedDocument, loc).ConfigureAwait (false);
+
+ await joinableTaskContext.Factory.SwitchToMainThreadAsync ();
+ if (cancellationToken.IsCancellationRequested)
+ return;
+ var result = new List<PathEntry> ();
+
+ if (curProject != null) {
+ // Current project if there is more than one
+ result.Add (new PathEntry (ImageService.GetIcon (curProject.StockIcon, Gtk.IconSize.Menu), GLib.Markup.EscapeText (curProject.Name)) { Tag = curProject });
+ }
+
+ if (curType == null) {
+ var prevPath = CurrentPath;
+ result.Add (new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = root.SyntaxTree });
+ if (cancellationToken.IsCancellationRequested)
+ return;
+
+ CurrentPath = result.ToArray ();
+ lastType = curType;
+ lastTypeMarkup = curTypeMakeup;
+
+ lastMember = curMember;
+ lastMemberMarkup = curMemberMarkup;
+
+ lastProject = curProject;
+ OnPathChanged (new DocumentPathChangedEventArgs (prevPath));
+ return;
+ }
+
+ if (curType != null) {
+ var type = curType;
+ var pos = result.Count;
+ while (type != null) {
+ if (!(type is BaseTypeDeclarationSyntax))
+ break;
+ var tag = (object)type.Ancestors ().FirstOrDefault (IsType) ?? root;
+ result.Insert (pos, new PathEntry (ImageService.GetIcon (type.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (type)) { Tag = tag });
+ type = type.Parent;
+ }
+ }
+ if (curMember != null) {
+ result.Add (new PathEntry (ImageService.GetIcon (curMember.GetStockIcon (), Gtk.IconSize.Menu), curMemberMarkup) { Tag = curMember });
+ if (curMember.Kind () == SyntaxKind.GetAccessorDeclaration ||
+ curMember.Kind () == SyntaxKind.SetAccessorDeclaration ||
+ curMember.Kind () == SyntaxKind.AddAccessorDeclaration ||
+ curMember.Kind () == SyntaxKind.RemoveAccessorDeclaration) {
+ var parent = curMember.Parent;
+ if (parent != null)
+ result.Insert (result.Count - 1, new PathEntry (ImageService.GetIcon (parent.GetStockIcon (), Gtk.IconSize.Menu), GetEntityMarkup (parent)) { Tag = parent });
+ }
+ }
+
+ // if (regionEntry != null)
+ // result.Add(regionEntry);
+
+ PathEntry noSelection = null;
+ if (curType == null) {
+ noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = root };
+ } else if (curMember == null && !(curType is DelegateDeclarationSyntax)) {
+ noSelection = new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = curType };
+ }
+
+ if (noSelection != null)
+ result.Add (noSelection);
+ var prev = CurrentPath;
+ if (prev != null && prev.Length == result.Count) {
+ bool equals = true;
+ for (int i = 0; i < prev.Length; i++) {
+ if (prev [i].Markup != result [i].Markup) {
+ equals = false;
+ break;
+ }
+ }
+ if (equals)
+ return;
+ }
+ if (cancellationToken.IsCancellationRequested)
+ return;
+ CurrentPath = result.ToArray ();
+ lastType = curType;
+ lastTypeMarkup = curTypeMakeup;
+
+ lastMember = curMember;
+ lastMemberMarkup = curMemberMarkup;
+
+ lastProject = curProject;
+
+ OnPathChanged (new DocumentPathChangedEventArgs (prev));
+ }, cancellationToken).Ignore ();
+ }
+
+ void CancelUpdatePath ()
+ {
+ src.Cancel ();
+ src = new CancellationTokenSource ();
+ }
+ }
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtensionProvider.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtensionProvider.cs
new file mode 100644
index 0000000000..37a6d69425
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/CSharpPathedDocumentExtensionProvider.cs
@@ -0,0 +1,45 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+//
+// 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 System.ComponentModel.Composition;
+using Microsoft.CodeAnalysis.Editor;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Threading;
+using Microsoft.VisualStudio.Utilities;
+using MonoDevelop.TextEditor;
+
+namespace MonoDevelop.CSharp
+{
+ [Export (typeof(IEditorContentProvider))]
+ [ContentType(ContentTypeNames.CSharpContentType)]
+ [TextViewRole(PredefinedTextViewRoles.PrimaryDocument)]
+ [Order(Before="Default")]
+ sealed class CSharpPathedDocumentExtensionProvider : EditorContentInstanceProvider<CSharpPathedDocumentExtension>
+ {
+ [Import]
+ private IEditorOperationsFactoryService editorOperationsFactoryService;
+ [Import]
+ internal JoinableTaskContext joinableTaskContext;
+
+ protected override CSharpPathedDocumentExtension CreateInstance (ITextView view) => new CSharpPathedDocumentExtension (view, joinableTaskContext, editorOperationsFactoryService.GetEditorOperations (view));
+ }
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
index 7eb4f9cf0f..fb9d72a96d 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp/PathedDocumentTextEditorExtension.cs
@@ -52,7 +52,7 @@ namespace MonoDevelop.CSharp
{
static PathedDocumentTextEditorExtension ()
{
- MonoDevelopWorkspace.GetInsertionPoints = async delegate (TextEditor editor, int offset) {
+ MonoDevelopWorkspace.GetInsertionPoints = async delegate (Ide.Editor.TextEditor editor, int offset) {
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null || doc.DocumentContext.AnalysisDocument == null)
return new List<InsertionPoint> ();
@@ -67,7 +67,7 @@ namespace MonoDevelop.CSharp
offset
);
};
- MonoDevelopWorkspace.StartRenameSession = async (TextEditor editor, DocumentContext ctx, Core.Text.ITextSourceVersion version, SyntaxToken? token) => {
+ MonoDevelopWorkspace.StartRenameSession = async (Ide.Editor.TextEditor editor, DocumentContext ctx, Core.Text.ITextSourceVersion version, SyntaxToken? token) => {
var latestDocument = ctx.AnalysisDocument;
var cancellationToken = default (CancellationToken);
var latestModel = await latestDocument.GetSemanticModelAsync (cancellationToken).ConfigureAwait (false);
@@ -133,6 +133,8 @@ namespace MonoDevelop.CSharp
// Delay the execution of UpdateOwnerProjects since it may end calling DocumentContext.AttachToProject,
// which shouldn't be called while the extension chain is being initialized.
Gtk.Application.Invoke ((o, args) => {
+ if (Editor == null)
+ return;
UpdateOwnerProjects ();
Editor_CaretPositionChanged (null, null);
});
@@ -550,7 +552,7 @@ namespace MonoDevelop.CSharp
ext.DocumentContext.AttachToProject (ext.ownerProjects [n]);
} else {
var node = memberList [n];
- var extEditor = ext.DocumentContext.GetContent<TextEditor> ();
+ var extEditor = ext.DocumentContext.GetContent<Ide.Editor.TextEditor> ();
if (extEditor != null) {
int offset;
if (node is OperatorDeclarationSyntax) {
@@ -580,14 +582,14 @@ namespace MonoDevelop.CSharp
class CompilationUnitDataProvider : DropDownBoxListWindow.IListDataProvider
{
- TextEditor editor;
+ Ide.Editor.TextEditor editor;
DocumentContext DocumentContext {
get;
set;
}
- public CompilationUnitDataProvider (TextEditor editor, DocumentContext documentContext)
+ public CompilationUnitDataProvider (Ide.Editor.TextEditor editor, DocumentContext documentContext)
{
this.editor = editor;
this.DocumentContext = documentContext;
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MonoDevelopContainedDocument.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MonoDevelopContainedDocument.cs
index 3fdf6de173..49d0e87afd 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MonoDevelopContainedDocument.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MonoDevelopContainedDocument.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis;
@@ -597,7 +598,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
}
var originalText = document.GetTextAsync (CancellationToken.None).WaitAndGetResult (CancellationToken.None);
- Contract.Requires (object.ReferenceEquals (originalText, snapshot.AsText ()));
+ Debug.Assert (object.ReferenceEquals (originalText, snapshot.AsText ()));
var root = document.GetSyntaxRootSynchronously (CancellationToken.None);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyCSharpCompletionData.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyCSharpCompletionData.cs
index 4b8ef4813c..b0d23331bc 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyCSharpCompletionData.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyCSharpCompletionData.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
@@ -19,7 +19,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
protected override string MimeType => "text/csharp";
- protected override void Format (TextEditor editor, Ide.Gui.Document document, SnapshotPoint start, SnapshotPoint end)
+ protected override void Format (Ide.Editor.TextEditor editor, Ide.Gui.Document document, SnapshotPoint start, SnapshotPoint end)
{
return;
//MonoDevelop.CSharp.Formatting.OnTheFlyFormatter.Format (editor, document, start, end);
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyRoslynCompletionData.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyRoslynCompletionData.cs
index 3de86b229c..98f77f7390 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyRoslynCompletionData.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/MyRoslynCompletionData.cs
@@ -1,4 +1,4 @@
-//
+//
// RoslynCompletionData.cs
//
// Author:
@@ -154,7 +154,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
}
}
- protected abstract void Format (TextEditor editor, Ide.Gui.Document document, SnapshotPoint start, SnapshotPoint end);
+ protected abstract void Format (Ide.Editor.TextEditor editor, Ide.Gui.Document document, SnapshotPoint start, SnapshotPoint end);
public override async Task<TooltipInformation> CreateTooltipInformation (bool smartWrap, CancellationToken cancelToken)
{
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenter.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenter.cs
index 5eafe429f7..80dcadd602 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenter.cs
@@ -35,6 +35,9 @@ namespace MonoDevelop.Ide.Completion.Presentation
public ICompletionPresenterSession CreateSession (ITextView textView, ITextBuffer subjectBuffer, ICompletionSession sessionOpt)
{
+ if (!(textView is IMdTextView))
+ return null;
+
foreach (var completionDataProviderHandle in _completionDataProviders) {
foreach (string contentTypeName in completionDataProviderHandle.Metadata.ContentTypes) {
if (string.Compare (subjectBuffer.ContentType.TypeName, contentTypeName, StringComparison.OrdinalIgnoreCase) == 0) {
@@ -42,7 +45,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
if (TryGetLanguageNameFromContentType (subjectBuffer.ContentType, out languageName)) {
if (Workspace.TryGetWorkspace (subjectBuffer.AsTextContainer (), out var workspace)) {
CompletionService completionService = workspace.Services.GetLanguageServices (languageName).GetService<CompletionService> ();
- return new RoslynCompletionPresenterSession ((IMdTextView)textView, subjectBuffer, completionService);
+ return new RoslynCompletionPresenterSession ((ITextView)textView, subjectBuffer, completionService);
}
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenterSession.View.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenterSession.View.cs
index 952ffca7cd..5f570609e9 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenterSession.View.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynCompletionPresenterSession.View.cs
@@ -61,14 +61,14 @@ namespace MonoDevelop.Ide.Completion.Presentation
int rowHeight;
Pango.Layout layout, categoryLayout, noMatchLayout;
- IMdTextView textView;
+ ITextView textView;
private readonly CompletionService completionService;
FontDescription itemFont, noMatchFont;
Adjustment vadj;
XwtPopupWindowTheme Theme;
int selection = 0;
- ISpaceReservationAgent agent;
+ dynamic agent;
bool buttonPressed;
IList<CompletionItem> filteredItems = new List<CompletionItem> (0);
@@ -103,7 +103,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
ScrolledWindow scrollbar;
EventBox box;
ITextBuffer _subjectBuffer;
- public RoslynCompletionPresenterSession (IMdTextView textView, ITextBuffer subjectBuffer, CompletionService completionService)
+ public RoslynCompletionPresenterSession (ITextView textView, ITextBuffer subjectBuffer, CompletionService completionService)
{
var vbox = new VBox ();
this.textView = textView;
@@ -589,10 +589,10 @@ namespace MonoDevelop.Ide.Completion.Presentation
textView.Properties ["RoslynCompletionPresenterSession.IsCompletionActive"] = true;
textView.LostAggregateFocus += CloseOnTextviewLostFocus;
box.ShowAll ();
- var manager = textView.GetSpaceReservationManager ("completion");
+ var manager = ((IMdTextView)textView).GetSpaceReservationManager ("completion");
agent = manager.CreatePopupAgent (triggerSpan, Microsoft.VisualStudio.Text.Adornments.PopupStyles.None, Xwt.Toolkit.CurrentEngine.WrapWidget (box, Xwt.NativeWidgetSizing.DefaultPreferredSize));
//HACK...
- Theme = ((Microsoft.VisualStudio.Text.Editor.Implementation.PopupAgent.PopUpContainer)((Microsoft.VisualStudio.Text.Editor.Implementation.PopupAgent)agent)._popup)._popup.Theme;
+ Theme = ((MonoDevelop.SourceEditor.PopupAgent.PopUpContainer)((MonoDevelop.SourceEditor.PopupAgent)agent)._popup)._popup.Theme;
Theme.CornerRadius = 0;
Theme.Padding = 0;
UpdateStyle ();
@@ -628,7 +628,7 @@ namespace MonoDevelop.Ide.Completion.Presentation
Instance = null;
textView.Properties ["RoslynCompletionPresenterSession.IsCompletionActive"] = false;
HideDescription ();
- var manager = textView.GetSpaceReservationManager ("completion");
+ var manager = ((IMdTextView)textView).GetSpaceReservationManager ("completion");
if (agent != null)
manager.RemoveAgent (agent);
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynExperimentationService.cs b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynExperimentationService.cs
new file mode 100644
index 0000000000..9422a7fab1
--- /dev/null
+++ b/main/src/addins/CSharpBinding/MonoDevelop.Ide.Completion.Presentation/RoslynExperimentationService.cs
@@ -0,0 +1,45 @@
+//
+// RoslynExperimentationService.cs
+//
+// Author:
+// Sandy Armstrong <sandy@xamarin.com>
+//
+// Copyright (c) 2019 Microsoft Corporation
+//
+// 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 System.Composition;
+
+using Microsoft.CodeAnalysis.Experiments;
+using Microsoft.CodeAnalysis.Host.Mef;
+
+namespace MonoDevelop.Ide.Composition
+{
+ [ExportWorkspaceService (typeof (IExperimentationService), ServiceLayer.Editor), Shared]
+ class RoslynExperimentationService: IExperimentationService
+ {
+ readonly EditorExperimentationServiceInternal editorExperimentationService
+ = new EditorExperimentationServiceInternal ();
+
+ public bool IsExperimentEnabled (string experimentName)
+ {
+ return editorExperimentationService.IsCachedFlightEnabled (experimentName);
+ }
+ }
+}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
index 968adc6dd6..f63c179045 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentEngine.cs
@@ -36,7 +36,7 @@ namespace MonoDevelop.JSon
{
class JSonIndentEngine : IStateMachineIndentEngine
{
- TextEditor editor;
+ Ide.Editor.TextEditor editor;
int offset, line, column;
internal int thisLineIndent, nextLineIndent;
StringBuilder currentIndent;
@@ -45,7 +45,7 @@ namespace MonoDevelop.JSon
bool isLineStart;
bool isInString;
- public JSonIndentEngine (TextEditor editor)
+ public JSonIndentEngine (Ide.Editor.TextEditor editor)
{
if (editor == null)
throw new ArgumentNullException ("editor");
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentationTracker.cs b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentationTracker.cs
index acf3e676db..0aaa9e41d3 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentationTracker.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.JSon/JSonIndentationTracker.cs
@@ -33,7 +33,7 @@ namespace MonoDevelop.JSon
{
class JSonIndentationTracker : IndentationTracker
{
- readonly TextEditor data;
+ readonly Ide.Editor.TextEditor data;
readonly CacheIndentEngine stateTracker;
public override IndentationTrackerFeatures SupportedFeatures {
@@ -42,7 +42,7 @@ namespace MonoDevelop.JSon
}
}
- public JSonIndentationTracker(TextEditor data, CacheIndentEngine stateTracker)
+ public JSonIndentationTracker(Ide.Editor.TextEditor data, CacheIndentEngine stateTracker)
{
this.data = data;
this.stateTracker = stateTracker;
diff --git a/main/src/addins/CSharpBinding/packages.config b/main/src/addins/CSharpBinding/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/CSharpBinding/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/ChangeLogAddIn/Makefile.am b/main/src/addins/ChangeLogAddIn/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/ChangeLogAddIn/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/Deployment/Makefile.am b/main/src/addins/Deployment/Makefile.am
deleted file mode 100644
index 6efbab8d9f..0000000000
--- a/main/src/addins/Deployment/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = MonoDevelop.Deployment MonoDevelop.Deployment.Linux
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/Makefile.am b/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/Deployment/MonoDevelop.Deployment.Linux/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am b/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.csproj b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.csproj
index 3cf59f0137..d5165719dc 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.csproj
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment.csproj
@@ -17,14 +17,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="ICSharpCode.SharpZipLib">
- <HintPath>..\..\..\..\packages\JetBrains.SharpZipLib.Stripped.0.87.20170615.10\lib\net40\ICSharpCode.SharpZipLib.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
index fb960e7c81..4529a91554 100644
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
+++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs
@@ -174,31 +174,12 @@ namespace MonoDevelop.Deployment
}
}
- // Temporary hack in place to build with GAC'd SharpZipLib on Windows
- static void SetAsciiTranslate (TarArchive archive)
- {
-#if WIN32
- archive.SetAsciiTranslation (false);
-#else
- archive.AsciiTranslate = false;
-#endif
- }
-
- static void CloseArchive (TarArchive archive)
- {
-#if WIN32
- archive?.CloseArchive ();
-#else
- archive?.Close ();
-#endif
- }
-
static void CreateTarArchive (ProgressMonitor mon, string folder, Stream outStream)
{
TarArchive archive = null;
try {
archive = TarArchive.CreateOutputTarArchive (outStream);
- SetAsciiTranslate (archive);
+ archive.AsciiTranslate = false;
archive.RootPath = folder;
archive.ProgressMessageEvent += delegate (TarArchive ac, TarEntry e, string message) {
if (message != null)
@@ -229,7 +210,7 @@ namespace MonoDevelop.Deployment
tarOut.Finish ();
}
} finally {
- CloseArchive (archive);
+ archive?.Close ();
}
}
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/packages.config b/main/src/addins/Deployment/MonoDevelop.Deployment/packages.config
deleted file mode 100644
index 49924db03a..0000000000
--- a/main/src/addins/Deployment/MonoDevelop.Deployment/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="JetBrains.SharpZipLib.Stripped" version="0.87.20170615.10" targetFramework="net461" />
-</packages>
diff --git a/main/src/addins/GnomePlatform/GnomePlatform.cs b/main/src/addins/GnomePlatform/GnomePlatform.cs
index 1fea9cd7de..d24bd6f705 100644
--- a/main/src/addins/GnomePlatform/GnomePlatform.cs
+++ b/main/src/addins/GnomePlatform/GnomePlatform.cs
@@ -72,16 +72,6 @@ namespace MonoDevelop.Platform
return Gio.GetMimeTypeForUri (uri);
}
-
- protected override bool OnGetMimeTypeIsText (string mimeType)
- {
- // If gedit can open the file, this editor also can do it
- foreach (DesktopApplication app in GetApplicationsForMimeType (mimeType))
- if (app.Id == "gedit")
- return true;
- return base.OnGetMimeTypeIsText (mimeType);
- }
-
public override void ShowUrl (string url)
{
diff --git a/main/src/addins/GnomePlatform/Makefile.am b/main/src/addins/GnomePlatform/Makefile.am
deleted file mode 100644
index 55fe085e70..0000000000
--- a/main/src/addins/GnomePlatform/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_GNOMEPLATFORM
-SKIP=y
-endif
diff --git a/main/src/addins/ILAsmBinding/Makefile.am b/main/src/addins/ILAsmBinding/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/ILAsmBinding/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
index 4295e92e49..6a5db6fb1b 100644
--- a/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
+++ b/main/src/addins/MacPlatform/Dialogs/MacAlertDialogHandler.cs
@@ -143,8 +143,15 @@ namespace MonoDevelop.MacIntegration
}
var accessoryView = ArrangeAccessoryViews (accessoryViews);
- if (accessoryView != null)
+ if (accessoryView != null) {
+ if (accessoryViews?[0] == messageView) {
+ accessoryView.SetCustomSpacing (accessoryView.Spacing * 2, messageView);
+ var size = accessoryView.Frame.Size;
+ size.Height += accessoryView.Spacing;
+ accessoryView.SetFrameSize (size);
+ }
alert.AccessoryView = accessoryView;
+ }
NSButton applyToAllCheck = null;
if (data.Message.AllowApplyToAll) {
@@ -254,7 +261,7 @@ namespace MonoDevelop.MacIntegration
var stackView = NSStackView.FromViews (views);
stackView.Orientation = NSUserInterfaceLayoutOrientation.Vertical;
- stackView.Distribution = NSStackViewDistribution.EqualSpacing;
+ stackView.Distribution = NSStackViewDistribution.Fill;
stackView.Alignment = NSLayoutAttribute.Left;
stackView.Spacing = spacing;
@@ -266,7 +273,7 @@ namespace MonoDevelop.MacIntegration
return stackView;
}
- static bool TryGetMessageView (string text, out NSView messageView, int viewWidth = 450, int topPadding = 10)
+ static bool TryGetMessageView (string text, out NSView messageView, int viewWidth = 450, int topPadding = 0)
{
messageView = null;
diff --git a/main/src/addins/MacPlatform/MacIntegrationCommands.cs b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
index 74f42bb874..c094f33dd1 100644
--- a/main/src/addins/MacPlatform/MacIntegrationCommands.cs
+++ b/main/src/addins/MacPlatform/MacIntegrationCommands.cs
@@ -39,6 +39,7 @@ namespace MonoDevelop.MacIntegration
HideOthers,
ShowOthers,
Services,
+ OrderFrontCharacterPalette,
}
class MacMinimizeWindowHandler : CommandHandler
@@ -104,4 +105,10 @@ namespace MonoDevelop.MacIntegration
w.PerformZoom (w);
}
}
+
+ class MacOrderFrontCharacterPaletteHandler : CommandHandler
+ {
+ protected override void Run ()
+ => NSApplication.SharedApplication.OrderFrontCharacterPalette (NSApplication.SharedApplication);
+ }
}
diff --git a/main/src/addins/MacPlatform/MacPlatform.addin.xml b/main/src/addins/MacPlatform/MacPlatform.addin.xml
index 76317cd810..5567c5ee4f 100644
--- a/main/src/addins/MacPlatform/MacPlatform.addin.xml
+++ b/main/src/addins/MacPlatform/MacPlatform.addin.xml
@@ -64,6 +64,17 @@
</Condition>
</Extension>
+ <Extension path = "/MonoDevelop/Ide/Commands/Edit">
+ <Command id = "MonoDevelop.MacIntegration.MacIntegrationCommands.OrderFrontCharacterPalette"
+ defaultHandler = "MonoDevelop.MacIntegration.MacOrderFrontCharacterPaletteHandler"
+ _label = "Emoji &amp; Symbols"
+ macShortcut = "Control+Meta+Space" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/MainMenu/Edit">
+ <CommandItem id = "MonoDevelop.MacIntegration.MacIntegrationCommands.OrderFrontCharacterPalette" insertafter = "Separator6" />
+ </Extension>
+
<Extension path = "/MonoDevelop/Components/DialogHandlers">
<Condition id = "Platform" value = "mac">
<Class class="MonoDevelop.MacIntegration.MacSelectFileDialogHandler" />
diff --git a/main/src/addins/MacPlatform/MacPlatform.csproj b/main/src/addins/MacPlatform/MacPlatform.csproj
index c8a39a37b1..7f051bd92d 100644
--- a/main/src/addins/MacPlatform/MacPlatform.csproj
+++ b/main/src/addins/MacPlatform/MacPlatform.csproj
@@ -13,6 +13,9 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
+ <IncludeCopyLocal Include="Xwt.Gtk.Mac.dll" />
+ </ItemGroup>
+ <ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
@@ -22,10 +25,6 @@
<Reference Include="Xamarin.Mac">
<HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
</Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
@@ -52,6 +51,7 @@
<ProjectReference Include="..\..\..\external\xwt\Xwt.Gtk.Mac\Xwt.Gtk.Mac.csproj">
<Project>{E95833C9-90AA-4366-9262-0A1BED148249}</Project>
<Name>Xwt.Gtk.Mac</Name>
+ <Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\external\xwt\Xwt.Gtk\Xwt.Gtk.csproj">
<Project>{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}</Project>
@@ -118,9 +118,6 @@
<Compile Include="BasicAuthenticationHandler.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
<EmbeddedResource Include="MacPlatform.addin.xml" />
<EmbeddedResource Include="maintoolbarbg.png" />
<EmbeddedResource Include="icons\build.png" />
diff --git a/main/src/addins/MacPlatform/Makefile.am b/main/src/addins/MacPlatform/Makefile.am
deleted file mode 100644
index 1afa12c04a..0000000000
--- a/main/src/addins/MacPlatform/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_MACPLATFORM
-SKIP=y
-endif
diff --git a/main/src/addins/MacPlatform/packages.config b/main/src/addins/MacPlatform/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/MacPlatform/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/Makefile.am b/main/src/addins/Makefile.am
deleted file mode 100644
index e41a99aafc..0000000000
--- a/main/src/addins/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-SUBDIRS = \
- MacPlatform \
- GnomePlatform \
- MonoDevelop.DesignerSupport \
- MonoDevelop.Debugger \
- MonoDevelop.Debugger.Gdb \
- Deployment \
- MonoDevelop.SourceEditor2 \
- MonoDevelop.Refactoring \
- VersionControl \
- MonoDevelop.Autotools \
- MonoDevelop.Gettext \
- Xml \
- TextTemplating \
- AspNet \
- CSharpBinding \
- ILAsmBinding \
- MonoDevelop.UnitTesting \
- MonoDevelop.UnitTesting.NUnit \
- MonoDeveloperExtensions \
- VBNetBinding \
- MonoDevelop.GtkCore \
- ChangeLogAddIn \
- MonoDevelop.WebReferences \
- MonoDevelop.RegexToolkit \
- MonoDevelop.AssemblyBrowser \
- MonoDevelop.Debugger.Soft \
- WindowsPlatform \
- MonoDevelop.HexEditor \
- MonoDevelop.DocFood \
- MonoDevelop.AspNetCore \
- MonoDevelop.DotNetCore \
- MonoDevelop.ConnectedServices \
- MonoDevelop.Packaging \
- MonoDevelop.Debugger.Win32 \
- PerformanceDiagnostics \
- MonoDevelop.Debugger.VSCodeDebugProtocol \
- MonoDevelop.PackageManagement
-
diff --git a/main/src/addins/MonoDevelop.AspNetCore/Makefile.am b/main/src/addins/MonoDevelop.AspNetCore/Makefile.am
deleted file mode 100644
index 0c03503f0f..0000000000
--- a/main/src/addins/MonoDevelop.AspNetCore/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-EXTRA_DIST += \
- $(wildcard Templates/*.cshtml)
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Tests/MonoDevelop.AspNetCore.Tests.csproj b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Tests/MonoDevelop.AspNetCore.Tests.csproj
index 48b7e6641f..6d015a58ec 100644
--- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Tests/MonoDevelop.AspNetCore.Tests.csproj
+++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.Tests/MonoDevelop.AspNetCore.Tests.csproj
@@ -1,23 +1,21 @@
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesGtk)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{44FFFDDA-156F-49F9-AE6A-BA640C198B33}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
+ <OutputType>Library</OutputType>
+ <OutputPath>..\..\..\..\build\tests</OutputPath>
<TestRunnerCommand>..\..\..\..\build\bin\mdtool.exe</TestRunnerCommand>
<TestRunnerArgs>run-md-tests</TestRunnerArgs>
- <OutputPath>..\..\..\..\build\tests</OutputPath>
- <RARResolveFromOutputDirectory>true</RARResolveFromOutputDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -27,38 +25,46 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
<Name>MonoDevelop.Core</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\MonoDevelop.AspNetCore.csproj">
<Project>{B3E73DE7-8AFC-429A-9B68-5699B1E63A02}</Project>
<Name>MonoDevelop.AspNetCore</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\tests\UnitTests\UnitTests.csproj">
<Project>{1497D0A8-AFF1-4938-BC22-BE79B358BA5B}</Project>
<Name>UnitTests</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\external\xwt\Xwt\Xwt.csproj">
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
<Name>Xwt</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
<Name>MonoDevelop.Ide</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\MonoDevelop.DotNetCore\MonoDevelop.DotNetCore.csproj">
<Project>{6868153E-41EA-43A4-A81A-C1E7256373F7}</Project>
<Name>MonoDevelop.DotNetCore</Name>
+ <Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="MonoDevelop.AspNetCore.Tests\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.csproj b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.csproj
index d7d352bbbe..a62ac2542f 100644
--- a/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.csproj
+++ b/main/src/addins/MonoDevelop.AspNetCore/MonoDevelop.AspNetCore.csproj
@@ -15,10 +15,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="MonoDevelop.AspNetCore.Templating\AspNetCoreFileTemplateCondition.cs" />
@@ -114,7 +110,6 @@
<None Include="Templates\WebApiControllerTemplate.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="packages.config" />
<None Include="Templates\AppSettingsFile.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -150,23 +145,12 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <InternalsVisibleTo Include="DotNetCore.Debugger" />
- <InternalsVisibleTo Include="MonoDevelop.AspNetCore.Tests" />
+ <DownloadNupkg Include="Microsoft.DotNet.Web.ProjectTemplates.1.x" Version="$(TemplatesVersion1x)" ExtensionDir="Templates" />
+ <DownloadNupkg Include="Microsoft.DotNet.Web.ProjectTemplates.2.0" Version="$(TemplatesVersion20)" ExtensionDir="Templates" />
</ItemGroup>
<ItemGroup>
- <Folder Include="MonoDevelop.AspNetCore.Commands\" />
- <Folder Include="MonoDevelop.AspNetCore.Dialogs\" />
+ <InternalsVisibleTo Include="DotNetCore.Debugger" />
+ <InternalsVisibleTo Include="MonoDevelop.AspNetCore.Tests" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Target Name="BeforeBuild">
- <ItemGroup>
- <NuGetPackage Include="Microsoft.DotNet.Web.ProjectTemplates.1.x">
- <Version>$(TemplatesVersion1x)</Version>
- </NuGetPackage>
- <NuGetPackage Include="Microsoft.DotNet.Web.ProjectTemplates.2.0">
- <Version>$(TemplatesVersion20)</Version>
- </NuGetPackage>
- </ItemGroup>
- <Copy SourceFiles="..\..\..\packages\%(NuGetPackage.Identity).%(NuGetPackage.Version)\%(NuGetPackage.Identity).%(NuGetPackage.Version).nupkg" DestinationFolder="$(OutputPath)\Templates" SkipUnchangedFiles="true" />
- </Target>
-</Project> \ No newline at end of file
+</Project>
diff --git a/main/src/addins/MonoDevelop.AspNetCore/packages.config b/main/src/addins/MonoDevelop.AspNetCore/packages.config
deleted file mode 100644
index 6d3bab5899..0000000000
--- a/main/src/addins/MonoDevelop.AspNetCore/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
- <package id="Microsoft.DotNet.Web.ProjectTemplates.1.x" version="1.0.0-beta2-20170430-208" targetFramework="net46" />
- <package id="Microsoft.DotNet.Web.ProjectTemplates.2.0" version="1.0.0-beta2-20170727-301" targetFramework="net46" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/Makefile.am b/main/src/addins/MonoDevelop.AssemblyBrowser/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
index 40d6c6408e..88a8e5c326 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
@@ -8,54 +8,18 @@
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\DisplayBindings\AssemblyBrowser</OutputPath>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="ICSharpCode.Decompiler">
- <HintPath>..\..\..\packages\ICSharpCode.Decompiler.3.2.0.3856\lib\net46\ICSharpCode.Decompiler.dll</HintPath>
- <Private>false</Private>
- </Reference>
<Reference Include="System.Core" />
<Reference Include="monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<Reference Include="System.Xml" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\build\bin\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -137,12 +101,10 @@
<Compile Include="MonoDevelop.AssemblyBrowser\AssemblyBrowserHandler.cs" />
<Compile Include="MonoDevelop.AssemblyBrowser\AssemblyBrowserWidget.AssemblyBrowserTreeView.cs" />
<Compile Include="MonoDevelop.AssemblyBrowser\AssemblyBrowserWidget.SearchIdleRunner.cs" />
+ <Compile Include="MonoDevelop.AssemblyBrowser\MetadataExtensions.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.AssemblyBrowser.addin.xml" />
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.SearchIdleRunner.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.SearchIdleRunner.cs
index 88fc84e688..93f46c4277 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.SearchIdleRunner.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.SearchIdleRunner.cs
@@ -28,12 +28,12 @@
using System;
using System.Collections.Generic;
-
-using Mono.Cecil;
+
using MonoDevelop.Ide;
using System.Threading;
using MonoDevelop.Core.Text;
using System.Collections.Immutable;
+using ICSharpCode.Decompiler.TypeSystem;
namespace MonoDevelop.AssemblyBrowser
{
@@ -43,7 +43,7 @@ namespace MonoDevelop.AssemblyBrowser
{
readonly AssemblyBrowserWidget assemblyBrowserWidget;
readonly CancellationToken token;
- readonly List<IMemberDefinition> memberList = new List<IMemberDefinition> ();
+ readonly List<IEntity> memberList = new List<IEntity> ();
readonly bool publicOnly;
readonly string pattern;
readonly ImmutableList<AssemblyLoader> definitions;
@@ -52,7 +52,7 @@ namespace MonoDevelop.AssemblyBrowser
bool fillStepFinished;
int currentDefinition;
int i = 0;
- IEnumerator<TypeDefinition> currentTypeEnumerator;
+ IEnumerator<ITypeDefinition> currentTypeEnumerator;
public SearchIdleRunner (AssemblyBrowserWidget assemblyBrowserWidget, string pattern, CancellationToken token)
{
@@ -102,8 +102,9 @@ namespace MonoDevelop.AssemblyBrowser
return;
}
var unit = definitions [currentDefinition];
+ var typeSystem = unit.DecompilerTypeSystem;
if (currentTypeEnumerator == null) {
- currentTypeEnumerator = unit.Assembly.MainModule.Types.GetEnumerator ();
+ currentTypeEnumerator = typeSystem.GetAllTypeDefinitions ().GetEnumerator ();
if (!currentTypeEnumerator.MoveNext ()) {
currentTypeEnumerator = null;
currentDefinition++;
@@ -121,14 +122,12 @@ namespace MonoDevelop.AssemblyBrowser
case SearchMode.Member:
if (token.IsCancellationRequested)
return;
- if (!type.IsPublic && publicOnly)
+ if (!type.IsPublic () && publicOnly)
return;
foreach (var member in type.Methods) {
if (token.IsCancellationRequested)
return;
- if (!member.IsPublic && publicOnly)
- continue;
- if (member.IsSpecialName || member.IsRuntimeSpecialName)
+ if (!member.IsPublic () && publicOnly)
continue;
if (matcher.IsMatch (member.Name))
memberList.Add (member);
@@ -136,9 +135,7 @@ namespace MonoDevelop.AssemblyBrowser
foreach (var member in type.Fields) {
if (token.IsCancellationRequested)
return;
- if (!member.IsPublic && publicOnly)
- continue;
- if (member.IsSpecialName || member.IsRuntimeSpecialName)
+ if (!member.IsPublic () && publicOnly)
continue;
if (matcher.IsMatch (member.Name))
memberList.Add (member);
@@ -146,10 +143,8 @@ namespace MonoDevelop.AssemblyBrowser
foreach (var member in type.Properties) {
if (token.IsCancellationRequested)
return;
- var accessor = member.GetMethod ?? member.SetMethod;
- if (!accessor.IsPublic && publicOnly)
- continue;
- if (member.IsSpecialName || member.IsRuntimeSpecialName)
+ var accessor = member.Getter ?? member.Setter;
+ if (!accessor.IsPublic () && publicOnly)
continue;
if (matcher.IsMatch (member.Name))
memberList.Add (member);
@@ -157,19 +152,17 @@ namespace MonoDevelop.AssemblyBrowser
foreach (var member in type.Events) {
if (token.IsCancellationRequested)
return;
- if (member.IsSpecialName || member.IsRuntimeSpecialName)
- continue;
- var accessor = member.AddMethod ?? member.RemoveMethod;
- if (!accessor.IsPublic && publicOnly)
+ var accessor = member.AddAccessor ?? member.RemoveAccessor;
+ if (!accessor.IsPublic () && publicOnly)
continue;
if (matcher.IsMatch (member.Name))
memberList.Add (member);
}
break;
case SearchMode.Type:
- if (!type.IsPublic && publicOnly)
+ if (!type.IsPublic () && publicOnly)
return;
- if (type.IsSpecialName || type.IsRuntimeSpecialName || type.Name == "<Module>")
+ if (type.Name == "<Module>")
return;
if (matcher.IsMatch (type.FullName))
memberList.Add (type);
@@ -177,9 +170,9 @@ namespace MonoDevelop.AssemblyBrowser
case SearchMode.TypeAndMembers:
if (token.IsCancellationRequested)
return;
- if (!type.IsPublic && publicOnly)
+ if (!type.IsPublic () && publicOnly)
return;
- if (type.IsSpecialName || type.IsRuntimeSpecialName || type.Name == "<Module>")
+ if (type.Name == "<Module>")
return;
if (matcher.IsMatch (type.FullName))
memberList.Add (type);
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
index 9da9528358..4744bf114f 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
@@ -33,7 +33,6 @@ using System.Text;
using System.Xml;
using Gtk;
-using Mono.Cecil;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -42,6 +41,8 @@ using MonoDevelop.Ide.Gui.Components;
using System.Linq;
using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem;
+using ICSharpCode.Decompiler.Metadata;
+using ICSharpCode.Decompiler.Documentation;
using MonoDevelop.Projects;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using XmlDocIdLib;
@@ -93,6 +94,10 @@ namespace MonoDevelop.AssemblyBrowser
if (referencedSegment == null)
return null;
+ return null;
+
+ // TODO fixme
+ /*
var td = referencedSegment.Reference as TypeDefinition;
if (td != null) {
isNotPublic = !td.IsPublic;
@@ -128,6 +133,7 @@ namespace MonoDevelop.AssemblyBrowser
}
return referencedSegment.Reference.ToString ();
+ */
}
@@ -208,7 +214,6 @@ namespace MonoDevelop.AssemblyBrowser
new ErrorNodeBuilder (),
new ProjectNodeBuilder (this),
new AssemblyNodeBuilder (this),
- new ModuleReferenceNodeBuilder (),
new AssemblyReferenceNodeBuilder (this),
//new AssemblyReferenceFolderNodeBuilder (this),
new AssemblyResourceFolderNodeBuilder (),
@@ -260,7 +265,7 @@ namespace MonoDevelop.AssemblyBrowser
notebook1.Page = 0;
//this.searchWidget.Visible = false;
- resultListStore = new Gtk.ListStore (typeof(IMemberDefinition));
+ resultListStore = new Gtk.ListStore (typeof(IMember));
CreateColumns ();
// this.searchEntry.Changed += SearchEntryhandleChanged;
@@ -332,7 +337,7 @@ namespace MonoDevelop.AssemblyBrowser
{
TreeIter selectedIter;
if (searchTreeview.Selection.GetSelected (out selectedIter)) {
- var member = (IMemberDefinition)resultListStore.GetValue (selectedIter, 0);
+ var member = (IMember)resultListStore.GetValue (selectedIter, 0);
var nav = SearchMember (member);
if (nav != null) {
@@ -365,9 +370,10 @@ namespace MonoDevelop.AssemblyBrowser
TreeView.GrabFocus ();
}
- ITreeNavigator SearchMember (IMemberDefinition member, bool expandNode = true)
+ ITreeNavigator SearchMember (IMember member, bool expandNode = true)
{
- return SearchMember (Mono.Cecil.Rocks.DocCommentId.GetDocCommentId (member), expandNode);
+ //return SearchMember (Mono.Cecil.Rocks.DocCommentId.GetDocCommentId (member), expandNode);
+ return SearchMember (member.ReflectionName, expandNode);
}
ITreeNavigator SearchMember (string helpUrl, bool expandNode = true)
@@ -376,24 +382,23 @@ namespace MonoDevelop.AssemblyBrowser
if (nav != null)
return nav;
// Constructor may be a generated default without implementation.
- var ctorIdx = helpUrl.IndexOf (".#ctor", StringComparison.Ordinal);
- if (helpUrl.StartsWith ("M:", StringComparison.Ordinal) && ctorIdx > 0) {
- return SearchMember ("T" + helpUrl.Substring (1, ctorIdx - 1), expandNode);
- }
+ //var ctorIdx = helpUrl.IndexOf (".#ctor", StringComparison.Ordinal);
+ //if (helpUrl.StartsWith ("M:", StringComparison.Ordinal) && ctorIdx > 0) {
+ // return SearchMember ("T" + helpUrl.Substring (1, ctorIdx - 1), expandNode);
+ //}
return null;
}
bool IsMatch (ITreeNavigator nav, string helpUrl, bool searchType)
{
- var member = nav.DataItem as IMemberDefinition;
- if (member == null)
- return false;
- return Mono.Cecil.Rocks.DocCommentId.GetDocCommentId (member) == helpUrl;
+ if (nav.DataItem is IEntity entity)
+ return entity.GetIdString () == helpUrl;
+ return false;
}
static bool SkipChildren (ITreeNavigator nav, string helpUrl, bool searchType)
{
- if (nav.DataItem is IMemberDefinition && !(nav.DataItem is TypeDefinition))
+ if (nav.DataItem is IMember && !(nav.DataItem is ITypeDefinition))
return true;
if (nav.DataItem is BaseTypeFolder)
return true;
@@ -411,7 +416,7 @@ namespace MonoDevelop.AssemblyBrowser
int idx = helpUrl.IndexOf ('~', startIndex);
if (idx > 0)
endIndex = idx;
- var type = nav.DataItem as TypeDefinition;
+ var type = nav.DataItem as ITypeDefinition;
if (type != null && helpUrl.IndexOf (type.FullName, startIndex, Math.Min (endIndex - startIndex, type.FullName.Length), StringComparison.Ordinal) == -1)
return true;
var @namespace = nav.DataItem as NamespaceData;
@@ -544,14 +549,14 @@ namespace MonoDevelop.AssemblyBrowser
void RenderDeclaringTypeOrNamespace (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
var ct = (Gtk.CellRendererText)cell;
- var entity = tree_model.GetValue (iter, 0) as IMemberDefinition;
+ var entity = tree_model.GetValue (iter, 0) as IEntity;
if (entity != null) {
if (entity.DeclaringType != null) {
ct.Text = entity.DeclaringType.FullName;
return;
}
- if (entity is TypeDefinition) {
- ct.Text = ((TypeDefinition)entity).Namespace;
+ if (entity is ITypeDefinition type) {
+ ct.Text = type.Namespace;
} else {
ct.Text = entity.DeclaringType.Namespace;
}
@@ -561,7 +566,7 @@ namespace MonoDevelop.AssemblyBrowser
void RenderText (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
var ct = (Gtk.CellRendererText)cell;
- var entity = tree_model.GetValue (iter, 0) as IMemberDefinition;
+ var entity = tree_model.GetValue (iter, 0) as INamedElement;
if (entity != null)
ct.Text = entity.Name;
}
@@ -569,32 +574,28 @@ namespace MonoDevelop.AssemblyBrowser
void RenderImage (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
{
var ct = (CellRendererImage)cell;
- var evt = tree_model.GetValue (iter, 0) as EventDefinition;
- if (evt != null) {
+ var entity = tree_model.GetValue (iter, 0) as IEntity;
+ if (entity is IEvent evt) {
ct.Image = ImageService.GetIcon (EventDefinitionNodeBuilder.GetStockIcon (evt), Gtk.IconSize.Menu);
return;
}
- var field = tree_model.GetValue (iter, 0) as FieldDefinition;
- if (field != null) {
+ if (entity is IField field) {
ct.Image = ImageService.GetIcon (FieldDefinitionNodeBuilder.GetStockIcon (field), Gtk.IconSize.Menu);
return;
}
- var method = tree_model.GetValue (iter, 0) as MethodDefinition;
- if (method != null) {
+ if (entity is IMethod method) {
ct.Image = ImageService.GetIcon (MethodDefinitionNodeBuilder.GetStockIcon (method), Gtk.IconSize.Menu);
return;
}
- var property = tree_model.GetValue (iter, 0) as PropertyDefinition;
- if (property != null) {
+ if (entity is IProperty property) {
ct.Image = ImageService.GetIcon (PropertyDefinitionNodeBuilder.GetStockIcon (property), Gtk.IconSize.Menu);
return;
}
-
- var type = tree_model.GetValue (iter, 0) as TypeDefinition;
- if (type != null) {
+
+ if (entity is ITypeDefinition type) {
ct.Image = ImageService.GetIcon (TypeDefinitionNodeBuilder.GetStockIcon (type), Gtk.IconSize.Menu);
return;
}
@@ -971,13 +972,13 @@ namespace MonoDevelop.AssemblyBrowser
int i = 0;
System.Action loadNext = null;
- var references = cecilObject.MainModule.AssemblyReferences;
+ var references = cecilObject.AssemblyReferences;
loadNext = () => {
var reference = references [i];
string fileName = currentAssembly.LookupAssembly (reference.FullName);
if (string.IsNullOrEmpty (fileName)) {
LoggingService.LogWarning ("Assembly browser: Can't find assembly: " + reference.FullName + ".");
- if (++i == references.Count)
+ if (++i == references.Length)
LoggingService.LogError ("Assembly browser: Can't find: " + url + ".");
else
loadNext ();
@@ -992,7 +993,7 @@ namespace MonoDevelop.AssemblyBrowser
Application.Invoke ((o, args) => {
var nav = SearchMember (url, expandNode);
if (nav == null) {
- if (++i == references.Count)
+ if (++i == references.Length)
LoggingService.LogError ("Assembly browser: Can't find: " + url + ".");
else
loadNext ();
@@ -1011,8 +1012,8 @@ namespace MonoDevelop.AssemblyBrowser
LoggingService.LogWarning ("Assembly browser: Can't find assembly: " + definition.Assembly.FullName + ".");
continue;
}
- foreach (var assemblyNameReference in cecilObject.MainModule.AssemblyReferences) {
- var result = AddReferenceByAssemblyName (assemblyNameReference);
+ foreach (var assemblyNameReference in cecilObject.AssemblyReferences) {
+ var result = AddReferenceByAssemblyName (assemblyNameReference.FullName);
if (result == null) {
LoggingService.LogWarning ("Assembly browser: Can't find assembly: " + assemblyNameReference.FullName + ".");
} else {
@@ -1051,7 +1052,7 @@ namespace MonoDevelop.AssemblyBrowser
internal void SelectAssembly (AssemblyLoader loader)
{
- AssemblyDefinition cu = loader.Assembly;
+ PEFile cu = loader.Assembly;
Application.Invoke ((o, args) => {
ITreeNavigator nav = TreeView.GetRootNode ();
if (nav == null)
@@ -1097,7 +1098,7 @@ namespace MonoDevelop.AssemblyBrowser
nav.MoveToFirstChild ();
do {
- if (nav.DataItem is AssemblyDefinition d)
+ if (nav.DataItem is PEFile d)
d.Dispose ();
} while (nav.MoveNext ());
nav.MoveToParent ();
@@ -1152,9 +1153,9 @@ namespace MonoDevelop.AssemblyBrowser
ImmutableList<AssemblyLoader> definitions = ImmutableList<AssemblyLoader>.Empty;
List<Project> projects = new List<Project> ();
- internal AssemblyLoader AddReferenceByAssemblyName (AssemblyNameReference reference, bool expand = false)
+ internal AssemblyLoader AddReferenceByAssemblyName (PEFile reference, bool expand = false)
{
- return AddReferenceByAssemblyName (reference.Name, expand, querySearch: false);
+ return AddReferenceByAssemblyName (reference.FullName, expand, querySearch: false);
}
internal AssemblyLoader AddReferenceByAssemblyName (string assemblyFullName, bool expand = false, bool querySearch = true)
@@ -1242,7 +1243,7 @@ namespace MonoDevelop.AssemblyBrowser
void HandleCursorChanged (object sender, EventArgs e)
{
if (!suspendNavigation) {
- var selectedEntity = TreeView.GetSelectedNode ()?.DataItem as IMemberDefinition;
+ var selectedEntity = TreeView.GetSelectedNode ()?.DataItem as IEntity;
if (selectedEntity != null)
IdeServices.NavigationHistoryService.LogActiveDocument ();
}
@@ -1253,11 +1254,12 @@ namespace MonoDevelop.AssemblyBrowser
public NavigationPoint BuildNavigationPoint ()
{
var node = TreeView.GetSelectedNode ();
- var selectedEntity = node?.DataItem as IMemberDefinition;
+ var selectedEntity = node?.DataItem as INamedElement;
AssemblyLoader loader = null;
if (selectedEntity != null) {
loader = (AssemblyLoader)this.TreeView.GetSelectedNode ().GetParentDataItem (typeof (AssemblyLoader), true);
- return new AssemblyBrowserNavigationPoint (definitions, loader, Mono.Cecil.Rocks.DocCommentId.GetDocCommentId (selectedEntity));
+ // TODO: fix this
+ return new AssemblyBrowserNavigationPoint (definitions, loader, selectedEntity.ReflectionName);
}
loader = node?.DataItem as AssemblyLoader;
if (loader != null)
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyLoader.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyLoader.cs
index 9f49f87521..4f132fb1e1 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyLoader.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyLoader.cs
@@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Mono.Cecil;
using ICSharpCode.Decompiler.CSharp;
using ICSharpCode.Decompiler.TypeSystem;
using System.Threading.Tasks;
@@ -32,10 +31,14 @@ using MonoDevelop.Core;
using System.IO;
using System.Threading;
using System.Collections.Generic;
+using ICSharpCode.Decompiler.Metadata;
+using System.Reflection.Metadata;
+using System.Linq;
+
namespace MonoDevelop.AssemblyBrowser
{
- class AssemblyLoader : IAssemblyResolver, IDisposable
+ class AssemblyLoader : IDisposable
{
readonly CancellationTokenSource src = new CancellationTokenSource ();
readonly AssemblyBrowserWidget widget;
@@ -45,10 +48,10 @@ namespace MonoDevelop.AssemblyBrowser
private set;
}
- Task<AssemblyDefinition> assemblyLoaderTask;
- TaskCompletionSource<AssemblyDefinition> assemblyDefinitionTaskSource;
+ Task<PEFile> assemblyLoaderTask;
+ TaskCompletionSource<PEFile> assemblyDefinitionTaskSource;
- public Task<AssemblyDefinition> LoadingTask {
+ public Task<PEFile> LoadingTask {
get {
return assemblyLoaderTask;
}
@@ -57,12 +60,12 @@ namespace MonoDevelop.AssemblyBrowser
}
}
- public AssemblyDefinition Assembly => AssemblyTask.Result;
- public Task<AssemblyDefinition> AssemblyTask => assemblyDefinitionTaskSource.Task;
+ public PEFile Assembly => AssemblyTask.Result;
+ public Task<PEFile> AssemblyTask => assemblyDefinitionTaskSource.Task;
- public ModuleDefinition ModuleDefinition {
+ public MetadataReader ModuleDefinition {
get {
- return assemblyLoaderTask.Result.MainModule;
+ return assemblyLoaderTask.Result.Metadata;
}
}
@@ -82,8 +85,7 @@ namespace MonoDevelop.AssemblyBrowser
public DecompilerTypeSystem DecompilerTypeSystem {
get {
if (decompilerTypeSystem == null) {
- decompilerTypeSystem = new DecompilerTypeSystem (Assembly.MainModule);
-
+ decompilerTypeSystem = new DecompilerTypeSystem (Assembly, new AssemblyResolver (widget));
}
return decompilerTypeSystem;
}
@@ -102,15 +104,13 @@ namespace MonoDevelop.AssemblyBrowser
if (!File.Exists (fileName))
throw new ArgumentException ("File doesn't exist.", nameof (fileName));
- assemblyDefinitionTaskSource = new TaskCompletionSource<AssemblyDefinition> ();
+ assemblyDefinitionTaskSource = new TaskCompletionSource<PEFile> ();
assemblyLoaderTask = Task.Run (() => {
try {
- var assemblyDefinition = AssemblyDefinition.ReadAssembly (FileName, new ReaderParameters {
- AssemblyResolver = this
- });
- assemblyDefinitionTaskSource.SetResult (assemblyDefinition);
- return assemblyDefinition;
+ var peFile = new PEFile (FileName, System.Reflection.PortableExecutable.PEStreamOptions.PrefetchEntireImage);
+ assemblyDefinitionTaskSource.SetResult (peFile);
+ return peFile;
} catch (Exception e) {
LoggingService.LogError ("Error while reading assembly " + FileName, e);
Error = new Error(e.Message);
@@ -120,6 +120,27 @@ namespace MonoDevelop.AssemblyBrowser
});
}
+ class AssemblyResolver : IAssemblyResolver
+ {
+ readonly AssemblyBrowserWidget widget;
+ public AssemblyResolver (AssemblyBrowserWidget widget)
+ {
+ this.widget = widget;
+ }
+
+ public PEFile Resolve (IAssemblyReference reference)
+ {
+ var loader = widget.AddReferenceByAssemblyName (reference.FullName);
+ return loader != null ? loader.Assembly : null;
+ }
+
+ public PEFile ResolveModule (PEFile mainModule, string moduleName)
+ {
+ var loader = widget.AddReferenceByFileName (mainModule.FileName);
+ return loader != null ? loader.Assembly : null;
+ }
+ }
+
class FastNonInterningProvider : InterningProvider
{
Dictionary<string, string> stringDict = new Dictionary<string, string> ();
@@ -152,20 +173,6 @@ namespace MonoDevelop.AssemblyBrowser
}
}
- #region IAssemblyResolver implementation
- AssemblyDefinition IAssemblyResolver.Resolve (AssemblyNameReference name)
- {
- var loader = widget.AddReferenceByAssemblyName (name);
- return loader != null ? loader.Assembly : null;
- }
-
- AssemblyDefinition IAssemblyResolver.Resolve (AssemblyNameReference name, ReaderParameters parameters)
- {
- var loader = widget.AddReferenceByAssemblyName (name);
- return loader != null ? loader.Assembly : null;
- }
- #endregion
-
public string LookupAssembly (string fullAssemblyName)
{
var assemblyFile = Runtime.SystemAssemblyService.DefaultAssemblyContext.GetAssemblyLocation (fullAssemblyName, null);
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyReferenceFolder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyReferenceFolder.cs
index 96400f68c0..511d90b77f 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyReferenceFolder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyReferenceFolder.cs
@@ -27,38 +27,41 @@
using System;
using System.Linq;
using System.Text;
-
-using Mono.Cecil;
-
+
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Pads;
using MonoDevelop.Ide.Gui.Components;
using System.Collections.Generic;
+using ICSharpCode.Decompiler.Metadata;
+using ICSharpCode.Decompiler.TypeSystem;
namespace MonoDevelop.AssemblyBrowser
{
class AssemblyReferenceFolder
{
- AssemblyDefinition definition;
+ PEFile definition;
- public IEnumerable<AssemblyNameReference> AssemblyReferences {
+ public IEnumerable<AssemblyReference> AssemblyReferences {
get {
- return definition.MainModule.AssemblyReferences;
+ return definition.AssemblyReferences;
}
}
+
+ // Ass
- public IEnumerable<ModuleReference> ModuleReferences {
+ public IEnumerable<IModule> ModuleReferences {
get {
- return definition.MainModule.ModuleReferences;
+ // TODO:
+ yield break;
+ //foreach (var reference in definition.Metadata.GetModuleReferences ())
+ //yield return definition.Metadata.GetModuleReference (reference);
}
}
- public AssemblyReferenceFolder (AssemblyDefinition definition)
+ public AssemblyReferenceFolder (PEFile definition)
{
- if (definition == null)
- throw new ArgumentNullException ("definition");
- this.definition = definition;
+ this.definition = definition ?? throw new ArgumentNullException (nameof (definition));
}
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyResourceFolder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyResourceFolder.cs
index bcc024e808..e96e6841ba 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyResourceFolder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyResourceFolder.cs
@@ -27,26 +27,24 @@
//
using System;
-using Mono.Cecil;
using System.Collections.Generic;
+using ICSharpCode.Decompiler.Metadata;
namespace MonoDevelop.AssemblyBrowser
{
class AssemblyResourceFolder
{
- AssemblyDefinition definition;
+ PEFile definition;
public IEnumerable<Resource> Resources {
get {
- return definition.MainModule.Resources;
+ return definition.Resources;
}
}
- public AssemblyResourceFolder (AssemblyDefinition definition)
+ public AssemblyResourceFolder (PEFile definition)
{
- if (definition == null)
- throw new ArgumentNullException ("definition");
- this.definition = definition;
+ this.definition = definition ?? throw new ArgumentNullException (nameof (definition));
}
}
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/BaseTypeFolder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/BaseTypeFolder.cs
index c036cb19d3..091a476763 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/BaseTypeFolder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/BaseTypeFolder.cs
@@ -28,18 +28,17 @@
using System;
using ICSharpCode.Decompiler.TypeSystem;
-using Mono.Cecil;
namespace MonoDevelop.AssemblyBrowser
{
class BaseTypeFolder : IDisposable
{
- public TypeDefinition Type {
+ public ITypeDefinition Type {
get;
private set;
}
- public BaseTypeFolder (TypeDefinition type)
+ public BaseTypeFolder (ITypeDefinition type)
{
this.Type = type;
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/ColoredCSharpFormatter.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/ColoredCSharpFormatter.cs
index 61b7e8b97e..2cbbfb0b20 100755
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/ColoredCSharpFormatter.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/ColoredCSharpFormatter.cs
@@ -32,6 +32,10 @@ using System.Linq;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Editor;
using ICSharpCode.Decompiler.CSharp.Syntax;
+using ICSharpCode.Decompiler.Disassembler;
+using ICSharpCode.Decompiler.Metadata;
+using System.Reflection.Metadata;
+using ICSharpCode.Decompiler.TypeSystem;
namespace MonoDevelop.AssemblyBrowser
{
@@ -46,7 +50,9 @@ namespace MonoDevelop.AssemblyBrowser
get;
set;
}
-
+ public bool IsLocal { get; set; }
+ public bool IsLocalTarget { get; set; }
+
public ReferenceSegment (int offset, int length, object reference)
{
this.Reference = reference;
@@ -76,8 +82,26 @@ namespace MonoDevelop.AssemblyBrowser
return referenceSegment.Segment;
}
}
-
-
+
+ sealed class DefinitionLookup
+ {
+ internal Dictionary<object, int> definitions = new Dictionary<object, int> ();
+
+ public int GetDefinitionPosition (object definition)
+ {
+ if (!definitions.TryGetValue (definition, out int val))
+ val = -1;
+
+ return val;
+ }
+
+ public void AddDefinition (object definition, int offset)
+ {
+ definitions [definition] = offset;
+ }
+ }
+
+
class ColoredCSharpFormatter : ICSharpCode.Decompiler.ITextOutput
{
public StringBuilder sb = new StringBuilder();
@@ -86,7 +110,8 @@ namespace MonoDevelop.AssemblyBrowser
int indent;
public List<IFoldSegment> FoldSegments = new List<IFoldSegment>();
public List<ReferenceSegment> ReferencedSegments = new List<ReferenceSegment>();
-
+ internal readonly DefinitionLookup DefinitionLookup = new DefinitionLookup ();
+
public ColoredCSharpFormatter (TextEditor doc)
{
this.doc = doc;
@@ -128,9 +153,62 @@ namespace MonoDevelop.AssemblyBrowser
sb.Append (ch);
}
- void ITextOutput.Write (string text)
+ public void Write (string text)
+ {
+ WriteIndent ();
+ sb.Append (text);
+ }
+
+ public void WriteReference (OpCodeInfo opCode)
{
WriteIndent ();
+ ReferencedSegments.Add (new ReferenceSegment (sb.Length, opCode.Name.Length, opCode));
+ sb.Append (opCode.Name);
+ }
+
+ public void WriteReference (PEFile module, EntityHandle handle, string text, bool isDefinition = false)
+ {
+ WriteIndent ();
+ if (isDefinition) {
+ this.DefinitionLookup.AddDefinition ((module, handle), sb.Length);
+ }
+
+ ReferencedSegments.Add (new ReferenceSegment (sb.Length, text.Length, (module, handle)));
+ sb.Append (text);
+ }
+
+ public void WriteReference (IType type, string text, bool isDefinition = false)
+ {
+ WriteIndent ();
+ if (isDefinition) {
+ this.DefinitionLookup.AddDefinition (type, sb.Length);
+ }
+
+ ReferencedSegments.Add (new ReferenceSegment (sb.Length, text.Length, type));
+ sb.Append (text);
+ }
+
+ public void WriteReference (IMember member, string text, bool isDefinition = false)
+ {
+ WriteIndent ();
+ if (isDefinition) {
+ this.DefinitionLookup.AddDefinition (member, sb.Length);
+ }
+ ReferencedSegments.Add (new ReferenceSegment (sb.Length, text.Length, member));
+ sb.Append (text);
+ }
+
+ public void WriteLocalReference (string text, object reference, bool isDefinition)
+ {
+ WriteIndent ();
+
+ bool isLocalTarget = false;
+ if (isDefinition) {
+ this.DefinitionLookup.AddDefinition (reference, sb.Length);
+ isLocalTarget = true;
+ }
+
+ ReferencedSegments.Add (new ReferenceSegment (sb.Length, text.Length, reference) { IsLocal = true, IsLocalTarget = isLocalTarget });
sb.Append (text);
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/MetadataExtensions.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/MetadataExtensions.cs
new file mode 100644
index 0000000000..197fb93c08
--- /dev/null
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/MetadataExtensions.cs
@@ -0,0 +1,62 @@
+//
+// MetadataExtensions.cs
+//
+// Author:
+// Marius Ungureanu <maungu@microsoft.com>
+//
+// Copyright (c) 2019 Microsoft Inc.
+//
+// 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 System;
+using ICSharpCode.Decompiler.TypeSystem;
+
+namespace MonoDevelop.AssemblyBrowser
+{
+ static class MetadataExtensions
+ {
+ public static bool IsPrivate (this IEntity entity) =>
+ entity.Accessibility == Accessibility.Private ||
+ entity.Accessibility == Accessibility.Internal ||
+ entity.Accessibility == Accessibility.ProtectedAndInternal;
+
+ public static bool IsPublic (this IEntity entity) =>
+ entity.Accessibility == Accessibility.Protected ||
+ entity.Accessibility == Accessibility.ProtectedOrInternal ||
+ entity.Accessibility == Accessibility.Public;
+
+ public static string GetStockIcon (this Accessibility attributes)
+ {
+ switch (attributes) {
+ case Accessibility.Private:
+ return "private-";
+ case Accessibility.Public:
+ return "";
+ case Accessibility.Protected:
+ return "protected-";
+ case Accessibility.Internal:
+ return "internal-";
+ case Accessibility.ProtectedOrInternal:
+ case Accessibility.ProtectedAndInternal: // FIXME we have no icon here
+ return "ProtectedOrInternal-";
+ default:
+ return "";
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyBrowserTypeNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyBrowserTypeNodeBuilder.cs
index a116fa5de3..acb09dfc83 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyBrowserTypeNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyBrowserTypeNodeBuilder.cs
@@ -27,7 +27,6 @@
using MonoDevelop.Ide.Gui.Components;
using ICSharpCode.Decompiler.TypeSystem;
using System;
-using Mono.Cecil;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using MonoDevelop.Core;
using MonoDevelop.Projects;
@@ -60,8 +59,8 @@ namespace MonoDevelop.AssemblyBrowser
try {
if (thisNode == null || otherNode == null)
return -1;
- var e1 = thisNode.DataItem as IMemberDefinition;
- var e2 = otherNode.DataItem as IMemberDefinition;
+ var e1 = thisNode.DataItem as IMember;
+ var e2 = otherNode.DataItem as IMember;
if (e1 == null && e2 == null)
return 0;
@@ -77,7 +76,7 @@ namespace MonoDevelop.AssemblyBrowser
}
}
- public AssemblyBrowserTypeNodeBuilder (AssemblyBrowserWidget assemblyBrowserWidget)
+ protected AssemblyBrowserTypeNodeBuilder (AssemblyBrowserWidget assemblyBrowserWidget)
{
this.Widget = assemblyBrowserWidget;
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceFolderNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceFolderNodeBuilder.cs
index 988df2ea2e..184e865ad9 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceFolderNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceFolderNodeBuilder.cs
@@ -24,12 +24,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using Mono.Cecil;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui;
using System.IO;
+
+using ICSharpCode.Decompiler.Metadata;
namespace MonoDevelop.AssemblyBrowser
{
@@ -60,7 +61,7 @@ namespace MonoDevelop.AssemblyBrowser
var referenceFolder = (AssemblyReferenceFolder)dataObject;
var wrapper = (AssemblyLoader)ctx.GetParentDataItem (typeof (AssemblyLoader), false);
- foreach (AssemblyNameReference assemblyNameReference in referenceFolder.AssemblyReferences) {
+ foreach (var assemblyNameReference in referenceFolder.AssemblyReferences) {
try {
string assemblyFile = wrapper.LookupAssembly (assemblyNameReference.FullName);
if (assemblyFile != null && System.IO.File.Exists (assemblyFile)) {
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceNodeBuilder.cs
index 0e53fa2c13..0db6f14f66 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/AssemblyReferenceNodeBuilder.cs
@@ -25,11 +25,11 @@
// THE SOFTWARE.
using System;
-using Mono.Cecil;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
+using ICSharpCode.Decompiler.Metadata;
namespace MonoDevelop.AssemblyBrowser
{
@@ -41,7 +41,7 @@ namespace MonoDevelop.AssemblyBrowser
}
public override Type NodeDataType {
- get { return typeof(AssemblyNameReference); }
+ get { return typeof(AssemblyReference); }
}
public override Type CommandHandlerType {
@@ -56,13 +56,13 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var reference = (AssemblyNameReference)dataObject;
+ var reference = (AssemblyReference)dataObject;
return reference.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var reference = (AssemblyNameReference)dataObject;
+ var reference = (AssemblyReference)dataObject;
nodeInfo.Label = reference.Name;
nodeInfo.Icon = Context.GetIcon (Stock.Reference);
}
@@ -72,8 +72,8 @@ namespace MonoDevelop.AssemblyBrowser
try {
if (thisNode == null || otherNode == null)
return -1;
- var e1 = thisNode.DataItem as AssemblyNameReference;
- var e2 = otherNode.DataItem as AssemblyNameReference;
+ var e1 = thisNode.DataItem as AssemblyReference;
+ var e2 = otherNode.DataItem as AssemblyReference;
if (e1 == null && e2 == null)
return 0;
@@ -94,7 +94,7 @@ namespace MonoDevelop.AssemblyBrowser
{
public override void ActivateItem ()
{
- var reference = (AssemblyNameReference)CurrentNode.DataItem;
+ var reference = (AssemblyReference)CurrentNode.DataItem;
if (reference == null)
return;
var loader = (AssemblyLoader)CurrentNode.GetParentDataItem (typeof(AssemblyLoader), false);
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/BaseTypeFolderNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/BaseTypeFolderNodeBuilder.cs
index e0eeb9f581..93b42c91aa 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/BaseTypeFolderNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/BaseTypeFolderNodeBuilder.cs
@@ -28,9 +28,7 @@
using System;
using System.Collections.Generic;
-
-using Mono.Cecil;
-
+
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Pads;
using MonoDevelop.Ide.Gui.Components;
@@ -100,9 +98,9 @@ namespace MonoDevelop.AssemblyBrowser
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
var baseTypeFolder = (BaseTypeFolder)dataObject;
- builder.AddChild (baseTypeFolder.Type.BaseType);
- builder.AddChildren (baseTypeFolder.Type.Interfaces);
+ builder.AddChildren (baseTypeFolder.Type.DirectBaseTypes);
}
+
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
{
return true;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/AssemblyNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/AssemblyNodeBuilder.cs
index 78f1ee9934..a0404ce725 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/AssemblyNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/AssemblyNodeBuilder.cs
@@ -30,8 +30,6 @@ using System;
using System.Linq;
using System.Text;
-using Mono.Cecil;
-
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Components;
@@ -39,6 +37,7 @@ using System.Collections.Generic;
using System.IO;
using MonoDevelop.Ide.Editor;
using ICSharpCode.Decompiler.TypeSystem;
+using ICSharpCode.Decompiler.Metadata;
namespace MonoDevelop.AssemblyBrowser
{
@@ -86,19 +85,19 @@ namespace MonoDevelop.AssemblyBrowser
var namespaces = new Dictionary<string, NamespaceData> ();
bool publicOnly = Widget.PublicApiOnly;
- foreach (var type in compilationUnit.ModuleDefinition.Types) {
+ foreach (var type in compilationUnit.DecompilerTypeSystem.MainModule.TypeDefinitions) {
string namespaceName = string.IsNullOrEmpty (type.Namespace) ? "" : type.Namespace;
if (!namespaces.ContainsKey (namespaceName))
namespaces [namespaceName] = new NamespaceData (namespaceName);
var ns = namespaces [namespaceName];
- ns.Types.Add ((type.IsPublic, type));
+ ns.Types.Add ((type.IsPublic (), type));
}
treeBuilder.AddChildren (namespaces.Where (ns => ns.Key != "" && (!publicOnly || ns.Value.Types.Any (t => t.isPublic))).Select (n => n.Value));
if (namespaces.ContainsKey ("")) {
foreach (var child in namespaces [""].Types) {
- if (((TypeDefinition)child.typeObject).Name == "<Module>")
+ if (((INamedElement)child.typeObject).Name == "<Module>")
continue;
treeBuilder.AddChild (child);
}
@@ -108,7 +107,7 @@ namespace MonoDevelop.AssemblyBrowser
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
{
var compilationUnit = (AssemblyLoader)dataObject;
- return compilationUnit.Assembly?.MainModule.HasTypes == true || compilationUnit.Error != null;
+ return compilationUnit.DecompilerTypeSystem?.MainModule.TypeDefinitions.Any () == true || compilationUnit.Error != null;
}
public override int CompareObjects (ITreeNavigator thisNode, ITreeNavigator otherNode)
@@ -126,7 +125,7 @@ namespace MonoDevelop.AssemblyBrowser
if (e2 == null || e2.Assembly == null)
return -1;
- return string.Compare (e1.Assembly.Name.Name, e2.Assembly.Name.Name, StringComparison.Ordinal);
+ return string.Compare (e1.Assembly.Name, e2.Assembly.Name, StringComparison.Ordinal);
} catch (Exception e) {
LoggingService.LogError ("Exception in assembly browser sort function.", e);
return -1;
@@ -134,30 +133,17 @@ namespace MonoDevelop.AssemblyBrowser
}
#region IAssemblyBrowserNodeBuilder
- void PrintAssemblyHeader (StringBuilder result, AssemblyDefinition assemblyDefinition)
+ void PrintAssemblyHeader (StringBuilder result, PEFile assemblyDefinition)
{
result.Append ("<span style=\"comment\">");
result.Append ("// ");
result.Append (string.Format (GettextCatalog.GetString ("Assembly <b>{0}</b>, Version {1}"),
- assemblyDefinition.Name.Name,
- assemblyDefinition.Name.Version));
+ assemblyDefinition.Name,
+ assemblyDefinition.Metadata.MetadataVersion));
result.Append ("</span>");
result.AppendLine ();
}
- static string GetTypeString (ModuleKind kind)
- {
- switch (kind) {
- case ModuleKind.Console:
- return GettextCatalog.GetString ("Console application");
- case ModuleKind.Dll:
- return GettextCatalog.GetString ("Library");
- case ModuleKind.Windows:
- return GettextCatalog.GetString ("Application");
- }
- return GettextCatalog.GetString ("Unknown");
- }
-
public List<ReferenceSegment> Disassemble (TextEditor data, ITreeNavigator navigator)
{
var assemblyLoader = (AssemblyLoader)navigator.DataItem;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/EventDefinitionNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/EventDefinitionNodeBuilder.cs
index 06e3eddf0a..422286936e 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/EventDefinitionNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/EventDefinitionNodeBuilder.cs
@@ -34,12 +34,10 @@ using MonoDevelop.Ide;
using ICSharpCode.Decompiler;
using System.Threading;
using System.Collections.Generic;
-using Mono.Cecil;
using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem;
using MonoDevelop.Ide.Editor;
using ICSharpCode.Decompiler.CSharp;
-using ICSharpCode.ILSpy;
using MonoDevelop.Core;
namespace MonoDevelop.AssemblyBrowser
@@ -47,7 +45,7 @@ namespace MonoDevelop.AssemblyBrowser
class EventDefinitionNodeBuilder : AssemblyBrowserTypeNodeBuilder, IAssemblyBrowserNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(EventDefinition); }
+ get { return typeof(IEvent); }
}
public EventDefinitionNodeBuilder (AssemblyBrowserWidget widget) : base (widget)
@@ -56,37 +54,39 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var evt = (EventDefinition)dataObject;
+ var evt = (IEvent)dataObject;
return evt.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var evt = (EventDefinition)dataObject;
- nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (evt.Name + " : " + CSharpLanguage.Instance.TypeToString (evt.EventType, false, evt));
- var accessor = evt.AddMethod ?? evt.RemoveMethod;
+ var evt = (IEvent)dataObject;
+ nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (evt.Name + " : ");
+ // TODO: Fix this.
+ //nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (evt.Name + " : " + CSharpLanguage.Instance.TypeToString (evt.ReturnType, false, evt));
+ var accessor = evt.AddAccessor ?? evt.RemoveAccessor;
- if (!accessor.IsPublic)
+ if (!accessor.IsPublic ())
nodeInfo.Label = MethodDefinitionNodeBuilder.FormatPrivate (nodeInfo.Label);
nodeInfo.Icon = Context.GetIcon (GetStockIcon (evt));
}
- public static IconId GetStockIcon (EventDefinition evt)
+ public static IconId GetStockIcon (IEvent evt)
{
- var accessor = evt.AddMethod ?? evt.RemoveMethod;
+ var accessor = evt.AddAccessor ?? evt.RemoveAccessor;
return MethodDefinitionNodeBuilder.GetStockIcon (accessor);
}
public override void BuildChildNodes (ITreeBuilder ctx, object dataObject)
{
- var evt = (EventDefinition)dataObject;
- if (evt.AddMethod != null)
- ctx.AddChild (evt.AddMethod);
- if (evt.RemoveMethod != null)
- ctx.AddChild (evt.RemoveMethod);
- if (evt.InvokeMethod != null)
- ctx.AddChild (evt.InvokeMethod);
+ var evt = (IEvent)dataObject;
+ if (evt.AddAccessor != null)
+ ctx.AddChild (evt.AddAccessor);
+ if (evt.RemoveAccessor != null)
+ ctx.AddChild (evt.RemoveAccessor);
+ if (evt.InvokeAccessor != null)
+ ctx.AddChild (evt.InvokeAccessor);
}
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
@@ -99,18 +99,18 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var evt = (EventDefinition)navigator.DataItem;
- return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleEvent (evt));
+ var evt = (IEvent)navigator.DataItem;
+ return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleEvent (evt.ParentModule.PEFile, (System.Reflection.Metadata.EventDefinitionHandle)evt.MetadataToken));
}
List<ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile (TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var evt = navigator.DataItem as EventDefinition;
+ var evt = navigator.DataItem as IEvent;
if (evt == null)
return null;
- return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (evt), flags: flags);
+ return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (evt.MetadataToken), flags: flags);
}
#endregion
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/FieldDefinitionNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/FieldDefinitionNodeBuilder.cs
index 670bc298a4..c25e26e82c 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/FieldDefinitionNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/FieldDefinitionNodeBuilder.cs
@@ -28,8 +28,7 @@
using System;
using System.Collections.Generic;
-using ICSharpCode.ILSpy;
-using Mono.Cecil;
+using ICSharpCode.Decompiler.TypeSystem;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Gui.Components;
@@ -39,7 +38,7 @@ namespace MonoDevelop.AssemblyBrowser
class FieldDefinitionNodeBuilder : AssemblyBrowserTypeNodeBuilder, IAssemblyBrowserNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(FieldDefinition); }
+ get { return typeof(IField); }
}
public FieldDefinitionNodeBuilder (AssemblyBrowserWidget widget) : base (widget)
@@ -49,45 +48,28 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var field = (FieldDefinition)dataObject;
+ var field = (IField)dataObject;
return field.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var field = (FieldDefinition)dataObject;
- nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (field.Name + " : " + CSharpLanguage.Instance.TypeToString (field.FieldType, false, field));
+ var field = (IField)dataObject;
+ // FIXME?
+ //nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (field.Name + " : " + CSharpLanguage.Instance.TypeToString (field.FieldType, false, field));
+ nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (field.Name + " : " + field.ReturnType.Name);
- if (!field.IsPublic)
+ if (!field.IsPublic ())
nodeInfo.Label = MethodDefinitionNodeBuilder.FormatPrivate (nodeInfo.Label);
nodeInfo.Icon = Context.GetIcon (GetStockIcon(field));
}
- public static IconId GetStockIcon (FieldDefinition field)
+ public static IconId GetStockIcon (IField field)
{
- var isStatic = (field.Attributes & FieldAttributes.Static) != 0;
- var source = field.HasConstant ? "literal" : "field";
- var global = field.HasConstant ? "" : (isStatic ? "static-" : "");
- return "md-" + GetAccess (field.Attributes) + global + source;
- }
-
- static string GetAccess (FieldAttributes attributes)
- {
- switch (attributes & FieldAttributes.FieldAccessMask) {
- case FieldAttributes.Private:
- return "private-";
- case FieldAttributes.Public:
- return "";
- case FieldAttributes.Family:
- return "protected-";
- case FieldAttributes.Assembly:
- return "internal-";
- case FieldAttributes.FamORAssem:
- case FieldAttributes.FamANDAssem:
- return "ProtectedOrInternal-";
- default:
- return "";
- }
+ var isStatic = field.IsStatic;
+ var source = field.IsConst ? "literal" : "field";
+ var global = field.IsConst ? "" : (isStatic ? "static-" : "");
+ return "md-" + field.Accessibility.GetStockIcon () + global + source;
}
#region IAssemblyBrowserNodeBuilder
@@ -96,20 +78,20 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var field = (FieldDefinition)navigator.DataItem;
+ var field = (IField)navigator.DataItem;
if (field == null)
return null;
- return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleField (field));
+ return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleField (field.ParentModule.PEFile, (System.Reflection.Metadata.FieldDefinitionHandle)field.MetadataToken));
}
List<ReferenceSegment> IAssemblyBrowserNodeBuilder.Decompile (TextEditor data, ITreeNavigator navigator, DecompileFlags flags)
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var field = (FieldDefinition)navigator.DataItem;
+ var field = (IField)navigator.DataItem;
if (field == null)
return null;
- return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (field), flags: flags);
+ return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (field.MetadataToken), flags: flags);
}
#endregion
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/MethodDefinitionNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/MethodDefinitionNodeBuilder.cs
index cd3e7a89a3..bb0ea528a4 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/MethodDefinitionNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/MethodDefinitionNodeBuilder.cs
@@ -39,21 +39,18 @@ using ICSharpCode.Decompiler.CSharp.TypeSystem;
using ICSharpCode.Decompiler.Disassembler;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
-using Mono.Cecil;
-using Mono.Cecil.Cil;
using MonoDevelop.Core;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Gui.Components;
-using ICSharpCode.ILSpy;
namespace MonoDevelop.AssemblyBrowser
{
class MethodDefinitionNodeBuilder : AssemblyBrowserTypeNodeBuilder, IAssemblyBrowserNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(MethodDefinition); }
+ get { return typeof(IMethod); }
}
public MethodDefinitionNodeBuilder (AssemblyBrowserWidget widget) : base (widget)
@@ -62,7 +59,7 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var method = (MethodDefinition)dataObject;
+ var method = (IMethod)dataObject;
if (method.IsConstructor)
return method.DeclaringType.Name;
return method.Name;
@@ -75,7 +72,7 @@ namespace MonoDevelop.AssemblyBrowser
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var method = (MethodDefinition)dataObject;
+ var method = (IMethod)dataObject;
var ambience = new CSharpAmbience ();
try {
@@ -84,39 +81,19 @@ namespace MonoDevelop.AssemblyBrowser
nodeInfo.Label = method.Name;
}
- if (method.IsPrivate || method.IsAssembly)
+ if (method.IsPrivate ())
nodeInfo.Label = MethodDefinitionNodeBuilder.FormatPrivate (nodeInfo.Label);
nodeInfo.Icon = Context.GetIcon (GetStockIcon (method));
}
- public static IconId GetStockIcon (MethodDefinition method)
+ public static IconId GetStockIcon (IMethod method)
{
- var isStatic = (method.Attributes & MethodAttributes.Static) != 0;
- var global = isStatic ? "static-" : "";
- return "md-" + GetAccess (method.Attributes) + global + "method";
+ var global = method.IsStatic ? "static-" : "";
+ return "md-" + method.Accessibility.GetStockIcon () + global + "method";
}
- internal static string GetAccess (MethodAttributes attributes)
- {
- switch (attributes & MethodAttributes.MemberAccessMask) {
- case MethodAttributes.Private:
- return "private-";
- case MethodAttributes.Public:
- return "";
- case MethodAttributes.Family:
- return "protected-";
- case MethodAttributes.Assembly:
- return "internal-";
- case MethodAttributes.FamORAssem:
- case MethodAttributes.FamANDAssem:
- return "ProtectedOrInternal-";
- default:
- return "";
- }
- }
-
- public static string GetText (MethodDefinition method)
+ public static string GetText (IMethod method)
{
var b = StringBuilderCache.Allocate ();
try {
@@ -124,20 +101,25 @@ namespace MonoDevelop.AssemblyBrowser
for (int i = 0; i < method.Parameters.Count; i++) {
if (i > 0)
b.Append (", ");
- b.Append (CSharpLanguage.Instance.TypeToString (method.Parameters [i].ParameterType, false, method.Parameters [i]));
- }
- if (method.CallingConvention == MethodCallingConvention.VarArg) {
- if (method.HasParameters)
- b.Append (", ");
- b.Append ("...");
+ // TODO: Fix this.
+ //b.Append (CSharpLanguage.Instance.TypeToString (method.Parameters [i].ParameterType, false, method.Parameters [i]));
+ b.Append (method.Parameters [i].Type.Name);
}
+ //if (method.CallingConvention == MethodCallingConvention.VarArg) {
+ // if (method.HasParameters)
+ // b.Append (", ");
+ // b.Append ("...");
+ //}
if (method.IsConstructor) {
b.Append (')');
} else {
b.Append (") : ");
- b.Append (CSharpLanguage.Instance.TypeToString (method.ReturnType, false, method.MethodReturnType));
+ //b.Append (CSharpLanguage.Instance.TypeToString (method.ReturnType, false, method.MethodReturnType));
+ b.Append (method.ReturnType.Name);
}
- return CSharpLanguage.Instance.FormatMethodName (method) + b;
+
+ //return CSharpLanguage.Instance.FormatMethodName (method) + b;
+ return method.Name + b;
} finally {
StringBuilderCache.Free (b);
}
@@ -154,11 +136,6 @@ namespace MonoDevelop.AssemblyBrowser
result.AppendLine ();
}
- static string GetInstructionOffset (Instruction instruction)
- {
- return String.Format ("IL_{0:X4}", instruction.Offset);
- }
-
public static AssemblyLoader GetAssemblyLoader (ITreeNavigator navigator)
{
var nav = navigator.Clone ();
@@ -223,10 +200,10 @@ namespace MonoDevelop.AssemblyBrowser
{
if (HandleSourceCodeEntity (navigator, data))
return null;
- var cecilMethod = (MethodDefinition)navigator.DataItem;
+ var cecilMethod = (IMethod)navigator.DataItem;
if (cecilMethod == null)
return null;
- return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (cecilMethod), flags: flags);
+ return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (cecilMethod.MetadataToken), flags: flags);
}
static void AppendLink (StringBuilder sb, string link, string text)
@@ -265,10 +242,9 @@ namespace MonoDevelop.AssemblyBrowser
{
if (HandleSourceCodeEntity (navigator, data))
return null;
- var cecilMethod = (MethodDefinition)navigator.DataItem;
- if (cecilMethod == null)
+ if (!(navigator.DataItem is IMethod cecilMethod))
return null;
- return Disassemble (data, rd => rd.DisassembleMethod (cecilMethod));
+ return Disassemble (data, rd => rd.DisassembleMethod (cecilMethod.ParentModule.PEFile, (System.Reflection.Metadata.MethodDefinitionHandle)cecilMethod.MetadataToken));
}
#endregion
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/PropertyDefinitionNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/PropertyDefinitionNodeBuilder.cs
index 0e61a50423..d65dc169cb 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/PropertyDefinitionNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/PropertyDefinitionNodeBuilder.cs
@@ -35,11 +35,9 @@ using MonoDevelop.Projects.Text;
using ICSharpCode.Decompiler;
using System.Threading;
using System.Collections.Generic;
-using Mono.Cecil;
using ICSharpCode.Decompiler.TypeSystem;
using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Ide.Editor;
-using ICSharpCode.ILSpy;
using MonoDevelop.Core;
namespace MonoDevelop.AssemblyBrowser
@@ -47,7 +45,7 @@ namespace MonoDevelop.AssemblyBrowser
class PropertyDefinitionNodeBuilder : AssemblyBrowserTypeNodeBuilder, IAssemblyBrowserNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(PropertyDefinition); }
+ get { return typeof(IProperty); }
}
public PropertyDefinitionNodeBuilder (AssemblyBrowserWidget widget) : base (widget)
@@ -57,54 +55,57 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var property = (PropertyDefinition)dataObject;
+ var property = (IProperty)dataObject;
return property.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var property = (PropertyDefinition)dataObject;
- nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (GetText (property, property.IsIndexer ()));
+ var property = (IProperty)dataObject;
+ nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (GetText (property, property.IsIndexer));
- var accessor = property.GetMethod ?? property.SetMethod;
+ var accessor = property.Getter ?? property.Setter;
- if (!accessor.IsPublic)
+ if (!accessor.IsPublic ())
nodeInfo.Label = MethodDefinitionNodeBuilder.FormatPrivate (nodeInfo.Label);
nodeInfo.Icon = Context.GetIcon (GetStockIcon (property));
}
- public static IconId GetStockIcon (PropertyDefinition property)
+ public static IconId GetStockIcon (IProperty property)
{
- var accessor = property.GetMethod ?? property.SetMethod;
- var isStatic = (accessor.Attributes & MethodAttributes.Static) != 0;
- var global = isStatic ? "static-" : "";
- return "md-" + MethodDefinitionNodeBuilder.GetAccess (accessor.Attributes) + global + "property";
+ var accessor = property.Getter ?? property.Setter;
+ var global = accessor.IsStatic ? "static-" : "";
+ return "md-" + accessor.Accessibility.GetStockIcon () + global + "property";
}
- static string GetText (PropertyDefinition property, bool? isIndexer = null)
+ static string GetText (IProperty property, bool? isIndexer = null)
{
- string name = CSharpLanguage.Instance.FormatPropertyName (property, isIndexer);
+ // TODO: fix this
+ string name = property.Name;// CSharpLanguage.Instance.FormatPropertyName (property, isIndexer);
var b = new System.Text.StringBuilder ();
- if (property.HasParameters) {
+ var parameters = property.Parameters;
+ if (parameters.Count != 0) {
b.Append ('(');
- for (int i = 0; i < property.Parameters.Count; i++) {
+ for (int i = 0; i < parameters.Count; i++) {
if (i > 0)
b.Append (", ");
- b.Append (CSharpLanguage.Instance.TypeToString (property.Parameters [i].ParameterType, false, property.Parameters [i]));
- }
- var method = property.GetMethod ?? property.SetMethod;
- if (method.CallingConvention == MethodCallingConvention.VarArg) {
- if (property.HasParameters)
- b.Append (", ");
- b.Append ("...");
+ //b.Append (CSharpLanguage.Instance.TypeToString (property.Parameters [i].ParameterType, false, property.Parameters [i]));
+ b.Append (parameters [i].Type.Name);
}
+ //var method = property.GetMethod ?? property.SetMethod;
+ //if (method.CallingConvention == MethodCallingConvention.VarArg) {
+ // if (property.HasParameters)
+ // b.Append (", ");
+ // b.Append ("...");
+ //}
b.Append (") : ");
} else {
b.Append (" : ");
}
- b.Append (CSharpLanguage.Instance.TypeToString (property.PropertyType, false, property));
+ //b.Append (CSharpLanguage.Instance.TypeToString (property.PropertyType, false, property));
+ b.Append (property.ReturnType.Name);
return name + b;
}
@@ -126,8 +127,8 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var property = (PropertyDefinition)navigator.DataItem;
- return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleProperty (property));
+ var property = (IProperty)navigator.DataItem;
+ return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleProperty (property.ParentModule.PEFile, (System.Reflection.Metadata.PropertyDefinitionHandle)property.MetadataToken));
}
static string GetBody (string text)
@@ -146,10 +147,9 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var property = navigator.DataItem as PropertyDefinition;
- if (property == null)
+ if (!(navigator.DataItem is IProperty property))
return null;
- return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (property), flags: flags);
+ return MethodDefinitionNodeBuilder.Decompile (data, MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator), b => b.Decompile (property.MetadataToken), flags: flags);
}
#endregion
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/TypeDefinitionNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/TypeDefinitionNodeBuilder.cs
index 002611033a..b317218fea 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/TypeDefinitionNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Cecil/TypeDefinitionNodeBuilder.cs
@@ -29,7 +29,6 @@
using System;
using System.Text;
using System.Linq;
-using Mono.Cecil;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide;
@@ -42,14 +41,13 @@ using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Highlighting;
using MonoDevelop.Ide.Gui.Content;
using ICSharpCode.Decompiler.CSharp.OutputVisitor;
-using ICSharpCode.ILSpy;
namespace MonoDevelop.AssemblyBrowser
{
class TypeDefinitionNodeBuilder : AssemblyBrowserTypeNodeBuilder, IAssemblyBrowserNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(TypeDefinition); }
+ get { return typeof(ITypeDefinition); }
}
public override string ContextMenuAddinPath {
@@ -62,94 +60,76 @@ namespace MonoDevelop.AssemblyBrowser
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var type = (TypeDefinition)dataObject;
+ var type = (ITypeDefinition)dataObject;
return type.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var type = (TypeDefinition)dataObject;
- nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (CSharpLanguage.Instance.FormatTypeName (type));
- if (!type.IsPublic)
+ var type = (ITypeDefinition)dataObject;
+ // TODO: fix this
+ //nodeInfo.Label = MonoDevelop.Ide.TypeSystem.Ambience.EscapeText (CSharpLanguage.Instance.FormatTypeName (type));
+ nodeInfo.Label = type.FullTypeName.Name;
+ if (!type.IsPublic ())
nodeInfo.Label = MethodDefinitionNodeBuilder.FormatPrivate (nodeInfo.Label);
nodeInfo.Icon = Context.GetIcon (GetStockIcon(type));
}
- public static IconId GetStockIcon (TypeDefinition type)
+ public static IconId GetStockIcon (ITypeDefinition type)
{
- return "md-" + GetAccess (type.Attributes) + GetSource (type);
+ return "md-" + type.Accessibility.GetStockIcon () + GetSource (type);
}
- static string GetSource (TypeDefinition type)
+ static string GetSource (ITypeDefinition type)
{
- if (type.IsInterface)
+ if (type.Kind == TypeKind.Interface)
return "interface";
- if (type.IsValueType)
+ if (type.Kind == TypeKind.Struct)
return "struct";
- if (type.IsEnum)
+ if (type.Kind == TypeKind.Enum)
return "enum";
- if (type.IsDelegate ())
+ if (type.Kind == TypeKind.Delegate)
return "delegate";
return "class";
}
- static string GetAccess (TypeAttributes attributes)
- {
- switch (attributes & TypeAttributes.VisibilityMask) {
- case TypeAttributes.NestedPrivate:
- return "private-";
- case TypeAttributes.Public:
- case TypeAttributes.NestedPublic:
- return "";
- case TypeAttributes.NestedFamily:
- return "protected-";
- case TypeAttributes.NestedAssembly:
- return "internal-";
- case TypeAttributes.NestedFamORAssem:
- case TypeAttributes.NestedFamANDAssem:
- return "ProtectedOrInternal-";
- default:
- return "";
- }
- }
-
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
- var type = (TypeDefinition)dataObject;
+ var type = (ITypeDefinition)dataObject;
var list = new System.Collections.ArrayList ();
- if (type.BaseType != null || type.HasInterfaces)
+ if (type.DirectBaseTypes.Any ())
list.Add (new BaseTypeFolder (type));
bool publicOnly = Widget.PublicApiOnly;
foreach (var nestedType in type.NestedTypes.OrderBy (m => m.Name, StringComparer.InvariantCulture)) {
- if (publicOnly && !nestedType.IsPublic)
+ if (publicOnly && !nestedType.IsPublic ())
continue;
builder.AddChild (nestedType);
}
foreach (var field in type.Fields.OrderBy (m => m.Name, StringComparer.InvariantCulture)) {
- if (publicOnly && !field.IsPublic)
+ if (publicOnly && !field.IsPublic ())
continue;
builder.AddChild (field);
}
foreach (var property in type.Properties.OrderBy (m => m.Name, StringComparer.InvariantCulture)) {
- var accessor = property.GetMethod ?? property.SetMethod;
- if (publicOnly && !accessor.IsPublic)
+ var accessor = property.Getter ?? property.Setter;
+ if (publicOnly && !accessor.IsPublic ())
continue;
builder.AddChild (property);
}
foreach (var evt in type.Events.OrderBy (m => m.Name, StringComparer.InvariantCulture)) {
- var accessor = evt.AddMethod ?? evt.RemoveMethod;
- if (publicOnly && !accessor.IsPublic)
+ var accessor = evt.AddAccessor ?? evt.RemoveAccessor;
+ if (publicOnly && !accessor.IsPublic ())
continue;
builder.AddChild (evt);
}
- var accessorMethods = type.GetAccessorMethods ();
+ var accessorMethods = type.GetAccessors ();
foreach (var method in type.Methods.OrderBy (m => m.Name, StringComparer.InvariantCulture)) {
- if (publicOnly && !method.IsPublic)
+ if (publicOnly && !method.IsPublic ())
continue;
if (!accessorMethods.Contains (method)) {
builder.AddChild (method);
@@ -165,13 +145,13 @@ namespace MonoDevelop.AssemblyBrowser
#region IAssemblyBrowserNodeBuilder
internal static void PrintAssembly (StringBuilder result, ITreeNavigator navigator)
{
- var assemblyDefinition = (AssemblyDefinition)navigator.GetParentDataItem (typeof (AssemblyDefinition), false);
+ var assemblyDefinition = (AssemblyLoader)navigator.GetParentDataItem (typeof (AssemblyLoader), false);
if (assemblyDefinition == null)
return;
-
+
result.Append (GettextCatalog.GetString ("<b>Assembly:</b>\t{0}, Version={1}",
- assemblyDefinition.Name.Name,
- assemblyDefinition.Name.Version));
+ assemblyDefinition.Assembly.Name,
+ assemblyDefinition.Assembly.Metadata.MetadataVersion));
result.AppendLine ();
}
@@ -195,11 +175,11 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var type = (TypeDefinition)navigator.DataItem;
+ var type = (ITypeDefinition)navigator.DataItem;
if (type == null)
return null;
-
- return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleType (type));
+
+ return MethodDefinitionNodeBuilder.Disassemble (data, rd => rd.DisassembleType (type.ParentModule.PEFile, (System.Reflection.Metadata.TypeDefinitionHandle)type.MetadataToken));
}
internal static DecompilerSettings CreateDecompilerSettings (bool publicOnly, MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy codePolicy)
@@ -222,7 +202,7 @@ namespace MonoDevelop.AssemblyBrowser
{
if (MethodDefinitionNodeBuilder.HandleSourceCodeEntity (navigator, data))
return null;
- var type = (TypeDefinition)navigator.DataItem;
+ var type = (ITypeDefinition)navigator.DataItem;
if (type == null)
return null;
var settings = MethodDefinitionNodeBuilder.GetDecompilerSettings (data, flags.PublicOnly);
@@ -230,7 +210,7 @@ namespace MonoDevelop.AssemblyBrowser
return MethodDefinitionNodeBuilder.Decompile (
data,
MethodDefinitionNodeBuilder.GetAssemblyLoader (navigator),
- builder => builder.DecompileType (type.GetFullTypeName ()), flags: flags);
+ builder => builder.DecompileType (type.FullTypeName), flags: flags);
}
#endregion
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ErrorNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ErrorNodeBuilder.cs
index ed9c4f4614..ec4c8567ad 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ErrorNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ErrorNodeBuilder.cs
@@ -29,8 +29,6 @@
using System;
using System.Collections.Generic;
-using Mono.Cecil;
-
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Pads;
using MonoDevelop.Ide.Gui.Components;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ModuleReferenceNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ModuleReferenceNodeBuilder.cs
index be49f43061..80205e6c0a 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ModuleReferenceNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ModuleReferenceNodeBuilder.cs
@@ -27,29 +27,30 @@
//
using System;
-using Mono.Cecil;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
+using System.Reflection.Metadata;
+using ICSharpCode.Decompiler.TypeSystem;
namespace MonoDevelop.AssemblyBrowser
{
class ModuleReferenceNodeBuilder : TypeNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(ModuleReference); }
+ get { return typeof(IModule); }
}
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- var reference = (ModuleReference)dataObject;
+ var reference = (IModule)dataObject;
return reference.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- var reference = (ModuleReference)dataObject;
+ var reference = (IModule)dataObject;
nodeInfo.Label = reference.Name;
nodeInfo.Icon = Context.GetIcon (Stock.GenericFile);
}
@@ -59,8 +60,8 @@ namespace MonoDevelop.AssemblyBrowser
try {
if (thisNode == null || otherNode == null)
return -1;
- var e1 = thisNode.DataItem as ModuleReference;
- var e2 = otherNode.DataItem as ModuleReference;
+ var e1 = thisNode.DataItem as IModule;
+ var e2 = otherNode.DataItem as IModule;
if (e1 == null && e2 == null)
return 0;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/NamespaceData.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/NamespaceData.cs
index 4fc5a5ecea..56950b7d79 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/NamespaceData.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/NamespaceData.cs
@@ -29,7 +29,6 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Decompiler.TypeSystem;
-using Mono.Cecil;
namespace MonoDevelop.AssemblyBrowser
{
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ResourceNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ResourceNodeBuilder.cs
index a9b6fae962..b0727dbfa0 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ResourceNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ResourceNodeBuilder.cs
@@ -27,28 +27,28 @@
//
using System;
-using Mono.Cecil;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui;
-
+using ICSharpCode.Decompiler.Metadata;
+
namespace MonoDevelop.AssemblyBrowser
{
class ResourceNodeBuilder : TypeNodeBuilder
{
public override Type NodeDataType {
- get { return typeof(Mono.Cecil.Resource); }
+ get { return typeof(Resource); }
}
public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
{
- Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject;
+ var resource = (Resource)dataObject;
return resource.Name;
}
public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
{
- Mono.Cecil.Resource resource = (Mono.Cecil.Resource)dataObject;
+ var resource = (Resource)dataObject;
nodeInfo.Label = Ide.TypeSystem.Ambience.EscapeText (resource.Name);
nodeInfo.Icon = Context.GetIcon (Stock.ResourceFileIcon);
}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Roslyn/ProjectNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Roslyn/ProjectNodeBuilder.cs
index 3615f5c8c6..e65bfd01da 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Roslyn/ProjectNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/Roslyn/ProjectNodeBuilder.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectNodeBuilder.cs
//
// Author:
@@ -27,6 +27,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text;
+
using MonoDevelop.Core;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Gui.Components;
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/Util/CSharpLanguage.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/Util/CSharpLanguage.cs
index d195042a85..b0077d2421 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/Util/CSharpLanguage.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/Util/CSharpLanguage.cs
@@ -1,395 +1,395 @@
-// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
-//
-// 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 System;
-using System.Collections;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Resources;
-
-using ICSharpCode.Decompiler;
-using Mono.Cecil;
-using ICSharpCode.Decompiler.CSharp;
-using ICSharpCode.Decompiler.CSharp.OutputVisitor;
-using ICSharpCode.Decompiler.CSharp.Syntax;
-using ICSharpCode.Decompiler.TypeSystem;
-using ICSharpCode.Decompiler.CSharp.Transforms;
-
-namespace ICSharpCode.ILSpy
-{
- /// <summary>
- /// C# decompiler integration into ILSpy.
- /// Note: if you're interested in using the decompiler without the ILSpy UI,
- /// please directly use the CSharpDecompiler class.
- /// </summary>
- class CSharpLanguage
- {
- public static readonly CSharpLanguage Instance = new CSharpLanguage ();
- string name = "C#";
- int transformCount = int.MaxValue;
-
-#if DEBUG
- internal static IEnumerable<CSharpLanguage> GetDebugLanguages ()
- {
- var decompiler = new CSharpDecompiler (ModuleDefinition.CreateModule ("Dummy", ModuleKind.Dll), new DecompilerSettings ());
- string lastTransformName = "no transforms";
- int transformCount = 0;
- foreach (var transform in decompiler.AstTransforms) {
- yield return new CSharpLanguage {
- transformCount = transformCount,
- name = "C# - " + lastTransformName,
- };
- lastTransformName = "after " + transform.GetType ().Name;
- transformCount++;
- }
- yield return new CSharpLanguage {
- name = "C# - " + lastTransformName,
- };
- }
-#endif
-
- public string Name {
- get { return name; }
- }
-
- public string FileExtension {
- get { return ".cs"; }
- }
-
- public string ProjectFileExtension {
- get { return ".csproj"; }
- }
-
-
- CSharpDecompiler CreateDecompiler (ModuleDefinition module, DecompilerSettings options)
- {
- CSharpDecompiler decompiler = new CSharpDecompiler (module, options);
- //decompiler.CancellationToken = options.CancellationToken;
- while (decompiler.AstTransforms.Count > transformCount)
- decompiler.AstTransforms.RemoveAt (decompiler.AstTransforms.Count - 1);
- return decompiler;
- }
-
- void WriteCode (ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
- {
- syntaxTree.AcceptVisitor (new InsertParenthesesVisitor { InsertParenthesesForReadability = true });
- TokenWriter tokenWriter = new TextTokenWriter (output, settings, typeSystem) { FoldBraces = settings.FoldBraces, /*ExpandMemberDefinitions = settings.ExpandMemberDefinitions */};
- syntaxTree.AcceptVisitor (new CSharpOutputVisitor (tokenWriter, settings.CSharpFormattingOptions));
- }
-
- public void DecompileMethod (MethodDefinition method, ITextOutput output, DecompilerSettings options)
- {
- AddReferenceWarningMessage (method.Module.Assembly, output);
- WriteCommentLine (output, TypeToString (method.DeclaringType, includeNamespace: true));
- CSharpDecompiler decompiler = CreateDecompiler (method.Module, options);
- if (method.IsConstructor && !method.DeclaringType.IsValueType) {
- List<IMemberDefinition> members = CollectFieldsAndCtors (method.DeclaringType, method.IsStatic);
- decompiler.AstTransforms.Add (new SelectCtorTransform (decompiler.TypeSystem.Resolve (method)));
- WriteCode (output, options, decompiler.Decompile (members), decompiler.TypeSystem);
- } else {
- WriteCode (output, options, decompiler.Decompile (method), decompiler.TypeSystem);
- }
- }
-
- class SelectCtorTransform : IAstTransform
- {
- readonly IMethod ctor;
- readonly HashSet<ISymbol> removedSymbols = new HashSet<ISymbol> ();
-
- public SelectCtorTransform (IMethod ctor)
- {
- this.ctor = ctor;
- }
-
- public void Run (AstNode rootNode, TransformContext context)
- {
- ConstructorDeclaration ctorDecl = null;
- foreach (var node in rootNode.Children) {
- switch (node) {
- case ConstructorDeclaration ctor:
- if (ctor.GetSymbol () == this.ctor) {
- ctorDecl = ctor;
- } else {
- // remove other ctors
- ctor.Remove ();
- removedSymbols.Add (ctor.GetSymbol ());
- }
- break;
- case FieldDeclaration fd:
- // Remove any fields without initializers
- if (fd.Variables.All (v => v.Initializer.IsNull)) {
- fd.Remove ();
- removedSymbols.Add (fd.GetSymbol ());
- }
- break;
- }
- }
- if (ctorDecl?.Initializer.ConstructorInitializerType == ConstructorInitializerType.This) {
- // remove all fields
- foreach (var node in rootNode.Children) {
- switch (node) {
- case FieldDeclaration fd:
- fd.Remove ();
- removedSymbols.Add (fd.GetSymbol ());
- break;
- }
- }
- }
- foreach (var node in rootNode.Children) {
- if (node is Comment && removedSymbols.Contains (node.GetSymbol ()))
- node.Remove ();
- }
- }
- }
-
- public void DecompileProperty (PropertyDefinition property, ITextOutput output, DecompilerSettings options)
- {
- AddReferenceWarningMessage (property.Module.Assembly, output);
- WriteCommentLine (output, TypeToString (property.DeclaringType, includeNamespace: true));
- CSharpDecompiler decompiler = CreateDecompiler (property.Module, options);
- WriteCode (output, options, decompiler.Decompile (property), decompiler.TypeSystem);
- }
-
- public void DecompileField (FieldDefinition field, ITextOutput output, DecompilerSettings options)
- {
- AddReferenceWarningMessage (field.Module.Assembly, output);
- WriteCommentLine (output, TypeToString (field.DeclaringType, includeNamespace: true));
- CSharpDecompiler decompiler = CreateDecompiler (field.Module, options);
- if (field.IsLiteral) {
- WriteCode (output, options, decompiler.Decompile (field), decompiler.TypeSystem);
- } else {
- List<IMemberDefinition> members = CollectFieldsAndCtors (field.DeclaringType, field.IsStatic);
- decompiler.AstTransforms.Add (new SelectFieldTransform (decompiler.TypeSystem.Resolve (field)));
- WriteCode (output, options, decompiler.Decompile (members), decompiler.TypeSystem);
- }
- }
-
- private static List<IMemberDefinition> CollectFieldsAndCtors (TypeDefinition type, bool isStatic)
- {
- var members = new List<IMemberDefinition> ();
- foreach (var field in type.Fields) {
- if (field.IsStatic == isStatic)
- members.Add (field);
- }
- foreach (var ctor in type.Methods) {
- if (ctor.IsConstructor && ctor.IsStatic == isStatic)
- members.Add (ctor);
- }
-
- return members;
- }
-
- /// <summary>
- /// Removes all top-level members except for the specified fields.
- /// </summary>
- sealed class SelectFieldTransform : IAstTransform
- {
- readonly IField field;
-
- public SelectFieldTransform (IField field)
- {
- this.field = field;
- }
-
- public void Run (AstNode rootNode, TransformContext context)
- {
- foreach (var node in rootNode.Children) {
- switch (node) {
- case EntityDeclaration ed:
- if (node.GetSymbol () != field)
- node.Remove ();
- break;
- case Comment c:
- if (c.GetSymbol () != field)
- node.Remove ();
- break;
- }
- }
- }
- }
-
- public void DecompileEvent (EventDefinition ev, ITextOutput output, DecompilerSettings options)
- {
- AddReferenceWarningMessage (ev.Module.Assembly, output);
- WriteCommentLine (output, TypeToString (ev.DeclaringType, includeNamespace: true));
- CSharpDecompiler decompiler = CreateDecompiler (ev.Module, options);
- WriteCode (output, options, decompiler.Decompile (ev), decompiler.TypeSystem);
- }
-
- public void DecompileType (TypeDefinition type, ITextOutput output, DecompilerSettings options)
- {
- AddReferenceWarningMessage (type.Module.Assembly, output);
- WriteCommentLine (output, TypeToString (type, includeNamespace: true));
- CSharpDecompiler decompiler = CreateDecompiler (type.Module, options);
- WriteCode (output, options, decompiler.Decompile (type), decompiler.TypeSystem);
- }
-
- public static string GetPlatformDisplayName (ModuleDefinition module)
- {
- switch (module.Architecture) {
- case TargetArchitecture.I386:
- if ((module.Attributes & ModuleAttributes.Preferred32Bit) == ModuleAttributes.Preferred32Bit)
- return "AnyCPU (32-bit preferred)";
- else if ((module.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
- return "x86";
- else
- return "AnyCPU (64-bit preferred)";
- case TargetArchitecture.AMD64:
- return "x64";
- case TargetArchitecture.IA64:
- return "Itanium";
- default:
- return module.Architecture.ToString ();
- }
- }
-
- public static string GetRuntimeDisplayName (ModuleDefinition module)
- {
- switch (module.Runtime) {
- case TargetRuntime.Net_1_0:
- return ".NET 1.0";
- case TargetRuntime.Net_1_1:
- return ".NET 1.1";
- case TargetRuntime.Net_2_0:
- return ".NET 2.0";
- case TargetRuntime.Net_4_0:
- return ".NET 4.0";
- }
- return null;
- }
-
- void AddReferenceWarningMessage (AssemblyDefinition assembly, ITextOutput output)
- {
- /*var loadedAssembly = MainWindow.Instance.CurrentAssemblyList.GetAssemblies ().FirstOrDefault (la => la.GetAssemblyDefinitionOrNull () == assembly);
- if (loadedAssembly == null || !loadedAssembly.LoadedAssemblyReferencesInfo.HasErrors)
- return;
- const string line1 = "Warning: Some assembly references could not be loaded. This might lead to incorrect decompilation of some parts,";
- const string line2 = "for ex. property getter/setter access. To get optimal decompilation results, please manually add the references to the list of loaded assemblies.";
- if (output is ISmartTextOutput fancyOutput) {
- fancyOutput.AddUIElement (() => new StackPanel {
- Margin = new Thickness (5),
- Orientation = Orientation.Horizontal,
- Children = {
- new Image {
- Width = 32,
- Height = 32,
- Source = Images.LoadImage(this, "Images/Warning.png")
- },
- new TextBlock {
- Margin = new Thickness(5, 0, 0, 0),
- Text = line1 + Environment.NewLine + line2
- }
- }
- });
- fancyOutput.WriteLine ();
- fancyOutput.AddButton (Images.ViewCode, "Show assembly load log", delegate {
- MainWindow.Instance.SelectNode (MainWindow.Instance.FindTreeNode (assembly).Children.OfType<ReferenceFolderTreeNode> ().First ());
- });
- fancyOutput.WriteLine ();
- } else {
- WriteCommentLine (output, line1);
- WriteCommentLine (output, line2);
- }*/
- }
+//// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
+////
+//// 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 System;
+//using System.Collections;
+//using System.Collections.Generic;
+//using System.IO;
+//using System.Linq;
+//using System.Resources;
+
+//using ICSharpCode.Decompiler;
+//using Mono.Cecil;
+//using ICSharpCode.Decompiler.CSharp;
+//using ICSharpCode.Decompiler.CSharp.OutputVisitor;
+//using ICSharpCode.Decompiler.CSharp.Syntax;
+//using ICSharpCode.Decompiler.TypeSystem;
+//using ICSharpCode.Decompiler.CSharp.Transforms;
+
+//namespace ICSharpCode.ILSpy
+//{
+// /// <summary>
+// /// C# decompiler integration into ILSpy.
+// /// Note: if you're interested in using the decompiler without the ILSpy UI,
+// /// please directly use the CSharpDecompiler class.
+// /// </summary>
+// class CSharpLanguage
+// {
+// public static readonly CSharpLanguage Instance = new CSharpLanguage ();
+// string name = "C#";
+// int transformCount = int.MaxValue;
+
+//#if DEBUG
+// internal static IEnumerable<CSharpLanguage> GetDebugLanguages ()
+// {
+// var decompiler = new CSharpDecompiler (ModuleDefinition.CreateModule ("Dummy", ModuleKind.Dll), new DecompilerSettings ());
+// string lastTransformName = "no transforms";
+// int transformCount = 0;
+// foreach (var transform in decompiler.AstTransforms) {
+// yield return new CSharpLanguage {
+// transformCount = transformCount,
+// name = "C# - " + lastTransformName,
+// };
+// lastTransformName = "after " + transform.GetType ().Name;
+// transformCount++;
+// }
+// yield return new CSharpLanguage {
+// name = "C# - " + lastTransformName,
+// };
+// }
+//#endif
+
+// public string Name {
+// get { return name; }
+// }
+
+// public string FileExtension {
+// get { return ".cs"; }
+// }
+
+// public string ProjectFileExtension {
+// get { return ".csproj"; }
+// }
+
+
+// CSharpDecompiler CreateDecompiler (ModuleDefinition module, DecompilerSettings options)
+// {
+// CSharpDecompiler decompiler = new CSharpDecompiler (module, options);
+// //decompiler.CancellationToken = options.CancellationToken;
+// while (decompiler.AstTransforms.Count > transformCount)
+// decompiler.AstTransforms.RemoveAt (decompiler.AstTransforms.Count - 1);
+// return decompiler;
+// }
+
+// void WriteCode (ITextOutput output, DecompilerSettings settings, SyntaxTree syntaxTree, IDecompilerTypeSystem typeSystem)
+// {
+// syntaxTree.AcceptVisitor (new InsertParenthesesVisitor { InsertParenthesesForReadability = true });
+// TokenWriter tokenWriter = new TextTokenWriter (output, settings, typeSystem) { FoldBraces = settings.FoldBraces, /*ExpandMemberDefinitions = settings.ExpandMemberDefinitions */};
+// syntaxTree.AcceptVisitor (new CSharpOutputVisitor (tokenWriter, settings.CSharpFormattingOptions));
+// }
+
+// public void DecompileMethod (MethodDefinition method, ITextOutput output, DecompilerSettings options)
+// {
+// AddReferenceWarningMessage (method.Module.Assembly, output);
+// WriteCommentLine (output, TypeToString (method.DeclaringType, includeNamespace: true));
+// CSharpDecompiler decompiler = CreateDecompiler (method.Module, options);
+// if (method.IsConstructor && !method.DeclaringType.IsValueType) {
+// List<IMemberDefinition> members = CollectFieldsAndCtors (method.DeclaringType, method.IsStatic);
+// decompiler.AstTransforms.Add (new SelectCtorTransform (decompiler.TypeSystem.Resolve (method)));
+// WriteCode (output, options, decompiler.Decompile (members), decompiler.TypeSystem);
+// } else {
+// WriteCode (output, options, decompiler.Decompile (method), decompiler.TypeSystem);
+// }
+// }
+
+// class SelectCtorTransform : IAstTransform
+// {
+// readonly IMethod ctor;
+// readonly HashSet<ISymbol> removedSymbols = new HashSet<ISymbol> ();
+
+// public SelectCtorTransform (IMethod ctor)
+// {
+// this.ctor = ctor;
+// }
+
+// public void Run (AstNode rootNode, TransformContext context)
+// {
+// ConstructorDeclaration ctorDecl = null;
+// foreach (var node in rootNode.Children) {
+// switch (node) {
+// case ConstructorDeclaration ctor:
+// if (ctor.GetSymbol () == this.ctor) {
+// ctorDecl = ctor;
+// } else {
+// // remove other ctors
+// ctor.Remove ();
+// removedSymbols.Add (ctor.GetSymbol ());
+// }
+// break;
+// case FieldDeclaration fd:
+// // Remove any fields without initializers
+// if (fd.Variables.All (v => v.Initializer.IsNull)) {
+// fd.Remove ();
+// removedSymbols.Add (fd.GetSymbol ());
+// }
+// break;
+// }
+// }
+// if (ctorDecl?.Initializer.ConstructorInitializerType == ConstructorInitializerType.This) {
+// // remove all fields
+// foreach (var node in rootNode.Children) {
+// switch (node) {
+// case FieldDeclaration fd:
+// fd.Remove ();
+// removedSymbols.Add (fd.GetSymbol ());
+// break;
+// }
+// }
+// }
+// foreach (var node in rootNode.Children) {
+// if (node is Comment && removedSymbols.Contains (node.GetSymbol ()))
+// node.Remove ();
+// }
+// }
+// }
+
+// public void DecompileProperty (PropertyDefinition property, ITextOutput output, DecompilerSettings options)
+// {
+// AddReferenceWarningMessage (property.Module.Assembly, output);
+// WriteCommentLine (output, TypeToString (property.DeclaringType, includeNamespace: true));
+// CSharpDecompiler decompiler = CreateDecompiler (property.Module, options);
+// WriteCode (output, options, decompiler.Decompile (property), decompiler.TypeSystem);
+// }
+
+// public void DecompileField (FieldDefinition field, ITextOutput output, DecompilerSettings options)
+// {
+// AddReferenceWarningMessage (field.Module.Assembly, output);
+// WriteCommentLine (output, TypeToString (field.DeclaringType, includeNamespace: true));
+// CSharpDecompiler decompiler = CreateDecompiler (field.Module, options);
+// if (field.IsLiteral) {
+// WriteCode (output, options, decompiler.Decompile (field), decompiler.TypeSystem);
+// } else {
+// List<IMemberDefinition> members = CollectFieldsAndCtors (field.DeclaringType, field.IsStatic);
+// decompiler.AstTransforms.Add (new SelectFieldTransform (decompiler.TypeSystem.Resolve (field)));
+// WriteCode (output, options, decompiler.Decompile (members), decompiler.TypeSystem);
+// }
+// }
+
+// private static List<IMemberDefinition> CollectFieldsAndCtors (TypeDefinition type, bool isStatic)
+// {
+// var members = new List<IMemberDefinition> ();
+// foreach (var field in type.Fields) {
+// if (field.IsStatic == isStatic)
+// members.Add (field);
+// }
+// foreach (var ctor in type.Methods) {
+// if (ctor.IsConstructor && ctor.IsStatic == isStatic)
+// members.Add (ctor);
+// }
+
+// return members;
+// }
+
+// /// <summary>
+// /// Removes all top-level members except for the specified fields.
+// /// </summary>
+// sealed class SelectFieldTransform : IAstTransform
+// {
+// readonly IField field;
+
+// public SelectFieldTransform (IField field)
+// {
+// this.field = field;
+// }
+
+// public void Run (AstNode rootNode, TransformContext context)
+// {
+// foreach (var node in rootNode.Children) {
+// switch (node) {
+// case EntityDeclaration ed:
+// if (node.GetSymbol () != field)
+// node.Remove ();
+// break;
+// case Comment c:
+// if (c.GetSymbol () != field)
+// node.Remove ();
+// break;
+// }
+// }
+// }
+// }
+
+// public void DecompileEvent (EventDefinition ev, ITextOutput output, DecompilerSettings options)
+// {
+// AddReferenceWarningMessage (ev.Module.Assembly, output);
+// WriteCommentLine (output, TypeToString (ev.DeclaringType, includeNamespace: true));
+// CSharpDecompiler decompiler = CreateDecompiler (ev.Module, options);
+// WriteCode (output, options, decompiler.Decompile (ev), decompiler.TypeSystem);
+// }
+
+// public void DecompileType (TypeDefinition type, ITextOutput output, DecompilerSettings options)
+// {
+// AddReferenceWarningMessage (type.Module.Assembly, output);
+// WriteCommentLine (output, TypeToString (type, includeNamespace: true));
+// CSharpDecompiler decompiler = CreateDecompiler (type.Module, options);
+// WriteCode (output, options, decompiler.Decompile (type), decompiler.TypeSystem);
+// }
+
+// public static string GetPlatformDisplayName (ModuleDefinition module)
+// {
+// switch (module.Architecture) {
+// case TargetArchitecture.I386:
+// if ((module.Attributes & ModuleAttributes.Preferred32Bit) == ModuleAttributes.Preferred32Bit)
+// return "AnyCPU (32-bit preferred)";
+// else if ((module.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
+// return "x86";
+// else
+// return "AnyCPU (64-bit preferred)";
+// case TargetArchitecture.AMD64:
+// return "x64";
+// case TargetArchitecture.IA64:
+// return "Itanium";
+// default:
+// return module.Architecture.ToString ();
+// }
+// }
+
+// public static string GetRuntimeDisplayName (ModuleDefinition module)
+// {
+// switch (module.Runtime) {
+// case TargetRuntime.Net_1_0:
+// return ".NET 1.0";
+// case TargetRuntime.Net_1_1:
+// return ".NET 1.1";
+// case TargetRuntime.Net_2_0:
+// return ".NET 2.0";
+// case TargetRuntime.Net_4_0:
+// return ".NET 4.0";
+// }
+// return null;
+// }
+
+// void AddReferenceWarningMessage (AssemblyDefinition assembly, ITextOutput output)
+// {
+// /*var loadedAssembly = MainWindow.Instance.CurrentAssemblyList.GetAssemblies ().FirstOrDefault (la => la.GetAssemblyDefinitionOrNull () == assembly);
+// if (loadedAssembly == null || !loadedAssembly.LoadedAssemblyReferencesInfo.HasErrors)
+// return;
+// const string line1 = "Warning: Some assembly references could not be loaded. This might lead to incorrect decompilation of some parts,";
+// const string line2 = "for ex. property getter/setter access. To get optimal decompilation results, please manually add the references to the list of loaded assemblies.";
+// if (output is ISmartTextOutput fancyOutput) {
+// fancyOutput.AddUIElement (() => new StackPanel {
+// Margin = new Thickness (5),
+// Orientation = Orientation.Horizontal,
+// Children = {
+// new Image {
+// Width = 32,
+// Height = 32,
+// Source = Images.LoadImage(this, "Images/Warning.png")
+// },
+// new TextBlock {
+// Margin = new Thickness(5, 0, 0, 0),
+// Text = line1 + Environment.NewLine + line2
+// }
+// }
+// });
+// fancyOutput.WriteLine ();
+// fancyOutput.AddButton (Images.ViewCode, "Show assembly load log", delegate {
+// MainWindow.Instance.SelectNode (MainWindow.Instance.FindTreeNode (assembly).Children.OfType<ReferenceFolderTreeNode> ().First ());
+// });
+// fancyOutput.WriteLine ();
+// } else {
+// WriteCommentLine (output, line1);
+// WriteCommentLine (output, line2);
+// }*/
+// }
- public string TypeToString (TypeReference type, bool includeNamespace, ICustomAttributeProvider typeAttributes = null)
- {
- ConvertTypeOptions options = ConvertTypeOptions.IncludeTypeParameterDefinitions;
- if (includeNamespace)
- options |= ConvertTypeOptions.IncludeNamespace;
-
- return TypeToString (options, type, typeAttributes);
- }
-
- string TypeToString (ConvertTypeOptions options, TypeReference type, ICustomAttributeProvider typeAttributes = null)
- {
- AstType astType = CSharpDecompiler.ConvertType (type, typeAttributes, options);
-
- StringWriter w = new StringWriter ();
- if (type.IsByReference) {
- ParameterDefinition pd = typeAttributes as ParameterDefinition;
- if (pd != null && (!pd.IsIn && pd.IsOut))
- w.Write ("out ");
- else
- w.Write ("ref ");
-
- if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
- ((ComposedType)astType).PointerRank--;
- }
-
- astType.AcceptVisitor (new CSharpOutputVisitor (w, TypeToStringFormattingOptions));
- return w.ToString ();
- }
-
- static readonly CSharpFormattingOptions TypeToStringFormattingOptions = FormattingOptionsFactory.CreateEmpty ();
-
- public string FormatPropertyName (PropertyDefinition property, bool? isIndexer)
- {
- if (property == null)
- throw new ArgumentNullException (nameof (property));
-
- if (!isIndexer.HasValue) {
- isIndexer = property.IsIndexer ();
- }
- if (isIndexer.Value) {
- var buffer = new System.Text.StringBuilder ();
- var accessor = property.GetMethod ?? property.SetMethod;
- if (accessor.HasOverrides) {
- var declaringType = accessor.Overrides [0].DeclaringType;
- buffer.Append (TypeToString (declaringType, includeNamespace: true));
- buffer.Append (@".");
- }
- buffer.Append (@"this[");
- bool addSeparator = false;
- foreach (var p in property.Parameters) {
- if (addSeparator)
- buffer.Append (@", ");
- else
- addSeparator = true;
- buffer.Append (TypeToString (p.ParameterType, includeNamespace: true));
- }
- buffer.Append (@"]");
- return buffer.ToString ();
- } else
- return property.Name;
- }
-
- public string FormatMethodName (MethodDefinition method)
- {
- if (method == null)
- throw new ArgumentNullException ("method");
-
- return (method.IsConstructor) ? FormatTypeName (method.DeclaringType) : method.Name;
- }
-
- public string FormatTypeName (TypeDefinition type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- return TypeToString (ConvertTypeOptions.DoNotUsePrimitiveTypeNames | ConvertTypeOptions.IncludeTypeParameterDefinitions, type);
- }
-
- public void WriteCommentLine (ITextOutput output, string comment)
- {
- output.WriteLine ("// " + comment);
- }
- }
-}
+// public string TypeToString (TypeReference type, bool includeNamespace, ICustomAttributeProvider typeAttributes = null)
+// {
+// ConvertTypeOptions options = ConvertTypeOptions.IncludeTypeParameterDefinitions;
+// if (includeNamespace)
+// options |= ConvertTypeOptions.IncludeNamespace;
+
+// return TypeToString (options, type, typeAttributes);
+// }
+
+// string TypeToString (ConvertTypeOptions options, TypeReference type, ICustomAttributeProvider typeAttributes = null)
+// {
+// AstType astType = CSharpDecompiler.ConvertType (type, typeAttributes, options);
+
+// StringWriter w = new StringWriter ();
+// if (type.IsByReference) {
+// ParameterDefinition pd = typeAttributes as ParameterDefinition;
+// if (pd != null && (!pd.IsIn && pd.IsOut))
+// w.Write ("out ");
+// else
+// w.Write ("ref ");
+
+// if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
+// ((ComposedType)astType).PointerRank--;
+// }
+
+// astType.AcceptVisitor (new CSharpOutputVisitor (w, TypeToStringFormattingOptions));
+// return w.ToString ();
+// }
+
+// static readonly CSharpFormattingOptions TypeToStringFormattingOptions = FormattingOptionsFactory.CreateEmpty ();
+
+// public string FormatPropertyName (PropertyDefinition property, bool? isIndexer)
+// {
+// if (property == null)
+// throw new ArgumentNullException (nameof (property));
+
+// if (!isIndexer.HasValue) {
+// isIndexer = property.IsIndexer ();
+// }
+// if (isIndexer.Value) {
+// var buffer = new System.Text.StringBuilder ();
+// var accessor = property.GetMethod ?? property.SetMethod;
+// if (accessor.HasOverrides) {
+// var declaringType = accessor.Overrides [0].DeclaringType;
+// buffer.Append (TypeToString (declaringType, includeNamespace: true));
+// buffer.Append (@".");
+// }
+// buffer.Append (@"this[");
+// bool addSeparator = false;
+// foreach (var p in property.Parameters) {
+// if (addSeparator)
+// buffer.Append (@", ");
+// else
+// addSeparator = true;
+// buffer.Append (TypeToString (p.ParameterType, includeNamespace: true));
+// }
+// buffer.Append (@"]");
+// return buffer.ToString ();
+// } else
+// return property.Name;
+// }
+
+// public string FormatMethodName (MethodDefinition method)
+// {
+// if (method == null)
+// throw new ArgumentNullException ("method");
+
+// return (method.IsConstructor) ? FormatTypeName (method.DeclaringType) : method.Name;
+// }
+
+// public string FormatTypeName (TypeDefinition type)
+// {
+// if (type == null)
+// throw new ArgumentNullException ("type");
+
+// return TypeToString (ConvertTypeOptions.DoNotUsePrimitiveTypeNames | ConvertTypeOptions.IncludeTypeParameterDefinitions, type);
+// }
+
+// public void WriteCommentLine (ITextOutput output, string comment)
+// {
+// output.WriteLine ("// " + comment);
+// }
+// }
+//}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/XmlDocIdLib/XmlDocIdGenerator.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/XmlDocIdLib/XmlDocIdGenerator.cs
index 2bc932d588..c67eb02862 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/XmlDocIdLib/XmlDocIdGenerator.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/XmlDocIdLib/XmlDocIdGenerator.cs
@@ -1,651 +1,651 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-using Mono.Cecil;
-
-namespace XmlDocIdLib
-{
- #region XmlDocIdGenerator
- class XmlDocIdGenerator
- {
- #region Constructors
- public XmlDocIdGenerator()
- {
- this.m_compat = CompatibilityType.Net35;
- }
- #endregion
-
- #region Public methods
- public string GetXmlDocPath(
- MemberReference Member)
- {
- if (Member == null)
- throw new ArgumentNullException("Member");
-
- StringBuilder stbBuilder = new StringBuilder();
- List<string> Path = new List<string>();
-
- // get path
- GetXmlDocPathRecursive(Member, Path);
-
- // generate string
- if (Path.Count == 0)
- return string.Empty;
-
- foreach (string strTemp in Path)
- stbBuilder.Append(strTemp);
-
- return stbBuilder.ToString();
- }
-
- public void SetCompatibilityType(
- CompatibilityType Compatibility)
- {
- if (Compatibility == CompatibilityType.None)
- throw new ArgumentException("Invalid parameter value.");
-
- this.m_compat = Compatibility;
- }
-
- public CompatibilityType GetCompatibilityType()
- {
- return this.m_compat;
- }
- #endregion
-
- #region Private methods
- private string GetXmlDocExplicitIfaceImplPath(
- MemberReference Member)
- {
- TypeReference declaringTypeRef = null;
- TypeDefinition declaringTypeDef = null;
- string strPath = string.Empty;
-
- if (Member.DeclaringType is GenericInstanceType)
- declaringTypeRef = (Member.DeclaringType as GenericInstanceType).ElementType;
- else
- declaringTypeRef = Member.DeclaringType;
-
- // lookup TypeDefinition for TypeReference
- declaringTypeDef = TryLookUpTypeDefinition(declaringTypeRef);
-
- if (declaringTypeDef == null || declaringTypeDef.IsInterface)
- return string.Empty;
-
- foreach (InterfaceImplementation tempIface in declaringTypeDef.Interfaces)
- {
- var tempIfaceRef = tempIface.InterfaceType;
- // check whether this member name begins with interface name (plus generic arguments)
- if (Member.Name.StartsWith(this.StripInterfaceName(tempIfaceRef.FullName)))
- {
- // element begins with interface name, this is explicit interface implementation,
- // get explicit interface implementation path
-
- // add member's name to path, at this point
- // name contains interface name (with generic arguments) plus member name
- strPath = Member.Name;
-
- // remove text between "<" and ">" and put interface parameters
- // (in explicit mode of course)
- int LeftBrace = strPath.IndexOf("<");
- int RightBrace = strPath.LastIndexOf(">");
-
- if (LeftBrace != -1 && RightBrace != -1)
- {
- bool firstAppend = true;
- GenericInstanceType tempGenericIfaceDef = null;
- StringBuilder stbParameters = new StringBuilder();
-
- // convert to definition
- tempGenericIfaceDef = tempIfaceRef as GenericInstanceType;
-
- if (tempGenericIfaceDef == null)
- break;
-
- strPath = strPath.Remove(LeftBrace, (RightBrace - LeftBrace) + 1);
- stbParameters.Append("{");
- foreach (TypeReference tempParam in tempGenericIfaceDef.GenericArguments)
- {
- // in "explicit" mode "@" is used as a separator instead of ","
- // in "normal" mode
- if (!firstAppend)
- stbParameters.Append(CanAppendSpecialExplicitChar() ? "@" : ",");
-
- GetXmlDocParameterPathRecursive(tempParam, true, stbParameters);
- firstAppend = false;
- }
- stbParameters.Append("}");
-
- // insert
- strPath = strPath.Insert(LeftBrace, stbParameters.ToString());
- }
-
- // replace "." with "#"
- if (CanAppendSpecialExplicitChar())
- strPath = strPath.Replace(".", "#");
-
- return strPath;
- }
- }
-
- return string.Empty;
- }
-
- private TypeDefinition TryLookUpTypeDefinition(
- TypeReference Reference)
- {
- // try find in the current assembly
- foreach (TypeDefinition tempTypeDef in Reference.Module.Types)
- if (tempTypeDef.ToString() == Reference.ToString())
- return tempTypeDef;
-
- return null;
- }
-
- private string StripInterfaceName(
- string OrginalName)
- {
- StringBuilder builderStrippedName = new StringBuilder();
-
- // split name
- string[] strSlices = OrginalName.Split(new char[] { '`' });
-
- // remove numbers at the begining of each string to "<" charter
- if (strSlices.Length > 1)
- for (int i = 0; i < strSlices.Length; i++)
- if (strSlices[i].Contains("<"))
- strSlices[i] = strSlices[i].Remove(0, strSlices[i].IndexOf("<"));
-
- // build string
- foreach (string tempString in strSlices)
- builderStrippedName.Append(tempString);
-
- return builderStrippedName.ToString();
- }
-
- private void GetXmlDocPathRecursive(
- MemberReference Member,
- List<string> CurrPath)
- {
- /*
- * determine type of the current member, if current path is empty
- * we have also to insert to path element type:
- * - "N:" - for namespace (not used here)
- * - "T:" - for a type (class, structure, delegate)
- * - "M:" - for a method (or constructor)
- * - "F:" - for a field
- * - "P:" - for a property or indexer
- * - "E:" - for an event
- */
-
- StringBuilder stbTempPath = new StringBuilder();
- string strExplicitPath = string.Empty;
-
- if (Member is TypeReference)
- {
- TypeReference thisTypeRef = null;
- GenericInstanceType thisGenericTypeDef = null;
- GenericParameter thisGenericParam = null;
- string strTempTypeName = string.Empty;
-
- if (Member is GenericInstanceType)
- {
- thisGenericTypeDef = Member as GenericInstanceType;
- thisTypeRef = thisGenericTypeDef.ElementType;
- }
- else if (Member is GenericParameter)
- {
- thisGenericParam = Member as GenericParameter;
- CurrPath.Add("`" + thisGenericParam.Position.ToString());
-
- // return immediatelly, because there is nothing to do.
- return;
- }
- else
- {
- // cast to TypeReference
- thisTypeRef = Member as TypeReference;
- }
-
- // if nested, scan enclosing type
- if (this.IsNested(thisTypeRef))
- GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
-
- // determine namespace
- string strNamespace = string.Empty;
- if ((thisTypeRef.Namespace != null && thisTypeRef.Namespace.Length > 0) || thisTypeRef.DeclaringType != null)
- strNamespace = thisTypeRef.Namespace + ".";
-
- // remove "`" char or not
- string strTempShortTypeName = thisTypeRef.Name;
- if (thisTypeRef.Name.Contains("`") && thisGenericTypeDef != null)
- strTempShortTypeName = thisTypeRef.Name.Remove(thisTypeRef.Name.IndexOf("`"));
-
- // class, interface, structure or delegate
- if (CurrPath.Count == 0)
- strTempTypeName = "T:" + strNamespace + strTempShortTypeName;
- else if (CurrPath.Count > 0 && !this.IsNested(thisTypeRef))
- strTempTypeName = strNamespace + strTempShortTypeName;
- else
- strTempTypeName = "." + strTempShortTypeName;
-
- CurrPath.Add(strTempTypeName);
-
- // add generic _arguments_ (not parameters !)
- if (thisTypeRef.Name.Contains("`") && thisGenericTypeDef != null)
- {
- bool firstAppend = true;
-
- // open bracket
- CurrPath.Add("{");
-
- foreach (TypeReference tempGenArgument in thisGenericTypeDef.GenericArguments)
- {
- // add comma
- if (!firstAppend)
- CurrPath.Add(",");
-
- // add argument's xmlDocPath
- GetXmlDocPathRecursive(tempGenArgument as MemberReference, CurrPath);
-
- // first append done
- firstAppend = false;
- }
-
- // close bracket
- CurrPath.Add("}");
- }
- }
- else if (Member is MethodReference)
- {
- var thisMethodDef = Member as MethodReference;
-
- // method, get type's path firstAppend
- CurrPath.Add("M:");
- if (Member.DeclaringType != null)
- GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
-
- // method's path
- // check whether this is constructor method, or explicitly implemented method
- strExplicitPath = GetXmlDocExplicitIfaceImplPath(Member);
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+
+//using Mono.Cecil;
+
+//namespace XmlDocIdLib
+//{
+// #region XmlDocIdGenerator
+// class XmlDocIdGenerator
+// {
+// #region Constructors
+// public XmlDocIdGenerator()
+// {
+// this.m_compat = CompatibilityType.Net35;
+// }
+// #endregion
+
+// #region Public methods
+// public string GetXmlDocPath(
+// MemberReference Member)
+// {
+// if (Member == null)
+// throw new ArgumentNullException("Member");
+
+// StringBuilder stbBuilder = new StringBuilder();
+// List<string> Path = new List<string>();
+
+// // get path
+// GetXmlDocPathRecursive(Member, Path);
+
+// // generate string
+// if (Path.Count == 0)
+// return string.Empty;
+
+// foreach (string strTemp in Path)
+// stbBuilder.Append(strTemp);
+
+// return stbBuilder.ToString();
+// }
+
+// public void SetCompatibilityType(
+// CompatibilityType Compatibility)
+// {
+// if (Compatibility == CompatibilityType.None)
+// throw new ArgumentException("Invalid parameter value.");
+
+// this.m_compat = Compatibility;
+// }
+
+// public CompatibilityType GetCompatibilityType()
+// {
+// return this.m_compat;
+// }
+// #endregion
+
+// #region Private methods
+// private string GetXmlDocExplicitIfaceImplPath(
+// MemberReference Member)
+// {
+// TypeReference declaringTypeRef = null;
+// TypeDefinition declaringTypeDef = null;
+// string strPath = string.Empty;
+
+// if (Member.DeclaringType is GenericInstanceType)
+// declaringTypeRef = (Member.DeclaringType as GenericInstanceType).ElementType;
+// else
+// declaringTypeRef = Member.DeclaringType;
+
+// // lookup TypeDefinition for TypeReference
+// declaringTypeDef = TryLookUpTypeDefinition(declaringTypeRef);
+
+// if (declaringTypeDef == null || declaringTypeDef.IsInterface)
+// return string.Empty;
+
+// foreach (InterfaceImplementation tempIface in declaringTypeDef.Interfaces)
+// {
+// var tempIfaceRef = tempIface.InterfaceType;
+// // check whether this member name begins with interface name (plus generic arguments)
+// if (Member.Name.StartsWith(this.StripInterfaceName(tempIfaceRef.FullName)))
+// {
+// // element begins with interface name, this is explicit interface implementation,
+// // get explicit interface implementation path
+
+// // add member's name to path, at this point
+// // name contains interface name (with generic arguments) plus member name
+// strPath = Member.Name;
+
+// // remove text between "<" and ">" and put interface parameters
+// // (in explicit mode of course)
+// int LeftBrace = strPath.IndexOf("<");
+// int RightBrace = strPath.LastIndexOf(">");
+
+// if (LeftBrace != -1 && RightBrace != -1)
+// {
+// bool firstAppend = true;
+// GenericInstanceType tempGenericIfaceDef = null;
+// StringBuilder stbParameters = new StringBuilder();
+
+// // convert to definition
+// tempGenericIfaceDef = tempIfaceRef as GenericInstanceType;
+
+// if (tempGenericIfaceDef == null)
+// break;
+
+// strPath = strPath.Remove(LeftBrace, (RightBrace - LeftBrace) + 1);
+// stbParameters.Append("{");
+// foreach (TypeReference tempParam in tempGenericIfaceDef.GenericArguments)
+// {
+// // in "explicit" mode "@" is used as a separator instead of ","
+// // in "normal" mode
+// if (!firstAppend)
+// stbParameters.Append(CanAppendSpecialExplicitChar() ? "@" : ",");
+
+// GetXmlDocParameterPathRecursive(tempParam, true, stbParameters);
+// firstAppend = false;
+// }
+// stbParameters.Append("}");
+
+// // insert
+// strPath = strPath.Insert(LeftBrace, stbParameters.ToString());
+// }
+
+// // replace "." with "#"
+// if (CanAppendSpecialExplicitChar())
+// strPath = strPath.Replace(".", "#");
+
+// return strPath;
+// }
+// }
+
+// return string.Empty;
+// }
+
+// private TypeDefinition TryLookUpTypeDefinition(
+// TypeReference Reference)
+// {
+// // try find in the current assembly
+// foreach (TypeDefinition tempTypeDef in Reference.Module.Types)
+// if (tempTypeDef.ToString() == Reference.ToString())
+// return tempTypeDef;
+
+// return null;
+// }
+
+// private string StripInterfaceName(
+// string OrginalName)
+// {
+// StringBuilder builderStrippedName = new StringBuilder();
+
+// // split name
+// string[] strSlices = OrginalName.Split(new char[] { '`' });
+
+// // remove numbers at the begining of each string to "<" charter
+// if (strSlices.Length > 1)
+// for (int i = 0; i < strSlices.Length; i++)
+// if (strSlices[i].Contains("<"))
+// strSlices[i] = strSlices[i].Remove(0, strSlices[i].IndexOf("<"));
+
+// // build string
+// foreach (string tempString in strSlices)
+// builderStrippedName.Append(tempString);
+
+// return builderStrippedName.ToString();
+// }
+
+// private void GetXmlDocPathRecursive(
+// MemberReference Member,
+// List<string> CurrPath)
+// {
+// /*
+// * determine type of the current member, if current path is empty
+// * we have also to insert to path element type:
+// * - "N:" - for namespace (not used here)
+// * - "T:" - for a type (class, structure, delegate)
+// * - "M:" - for a method (or constructor)
+// * - "F:" - for a field
+// * - "P:" - for a property or indexer
+// * - "E:" - for an event
+// */
+
+// StringBuilder stbTempPath = new StringBuilder();
+// string strExplicitPath = string.Empty;
+
+// if (Member is TypeReference)
+// {
+// TypeReference thisTypeRef = null;
+// GenericInstanceType thisGenericTypeDef = null;
+// GenericParameter thisGenericParam = null;
+// string strTempTypeName = string.Empty;
+
+// if (Member is GenericInstanceType)
+// {
+// thisGenericTypeDef = Member as GenericInstanceType;
+// thisTypeRef = thisGenericTypeDef.ElementType;
+// }
+// else if (Member is GenericParameter)
+// {
+// thisGenericParam = Member as GenericParameter;
+// CurrPath.Add("`" + thisGenericParam.Position.ToString());
+
+// // return immediatelly, because there is nothing to do.
+// return;
+// }
+// else
+// {
+// // cast to TypeReference
+// thisTypeRef = Member as TypeReference;
+// }
+
+// // if nested, scan enclosing type
+// if (this.IsNested(thisTypeRef))
+// GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
+
+// // determine namespace
+// string strNamespace = string.Empty;
+// if ((thisTypeRef.Namespace != null && thisTypeRef.Namespace.Length > 0) || thisTypeRef.DeclaringType != null)
+// strNamespace = thisTypeRef.Namespace + ".";
+
+// // remove "`" char or not
+// string strTempShortTypeName = thisTypeRef.Name;
+// if (thisTypeRef.Name.Contains("`") && thisGenericTypeDef != null)
+// strTempShortTypeName = thisTypeRef.Name.Remove(thisTypeRef.Name.IndexOf("`"));
+
+// // class, interface, structure or delegate
+// if (CurrPath.Count == 0)
+// strTempTypeName = "T:" + strNamespace + strTempShortTypeName;
+// else if (CurrPath.Count > 0 && !this.IsNested(thisTypeRef))
+// strTempTypeName = strNamespace + strTempShortTypeName;
+// else
+// strTempTypeName = "." + strTempShortTypeName;
+
+// CurrPath.Add(strTempTypeName);
+
+// // add generic _arguments_ (not parameters !)
+// if (thisTypeRef.Name.Contains("`") && thisGenericTypeDef != null)
+// {
+// bool firstAppend = true;
+
+// // open bracket
+// CurrPath.Add("{");
+
+// foreach (TypeReference tempGenArgument in thisGenericTypeDef.GenericArguments)
+// {
+// // add comma
+// if (!firstAppend)
+// CurrPath.Add(",");
+
+// // add argument's xmlDocPath
+// GetXmlDocPathRecursive(tempGenArgument as MemberReference, CurrPath);
+
+// // first append done
+// firstAppend = false;
+// }
+
+// // close bracket
+// CurrPath.Add("}");
+// }
+// }
+// else if (Member is MethodReference)
+// {
+// var thisMethodDef = Member as MethodReference;
+
+// // method, get type's path firstAppend
+// CurrPath.Add("M:");
+// if (Member.DeclaringType != null)
+// GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
+
+// // method's path
+// // check whether this is constructor method, or explicitly implemented method
+// strExplicitPath = GetXmlDocExplicitIfaceImplPath(Member);
- //if (thisMethodDef.IsStatic && thisMethodDef.IsConstructor)
- // stbTempPath.Append(".#cctor");
- //if (!thisMethodDef.IsStatic && thisMethodDef.IsConstructor)
- // stbTempPath.Append(".#ctor");
- stbTempPath.Append (".");
- if (strExplicitPath.Length > 0)
- stbTempPath.Append (strExplicitPath);
- else
- stbTempPath.Append (thisMethodDef.Name);
-
- // check whether this method is generic
- if (thisMethodDef.GenericParameters.Count > 0)
- stbTempPath.Append("``").Append (thisMethodDef.GenericParameters.Count);
-
- if (thisMethodDef.Parameters.Count > 0)
- stbTempPath.Append("(");
- bool firstAppend = true;
- foreach (ParameterDefinition TempParam in thisMethodDef.Parameters)
- {
- if (!firstAppend)
- stbTempPath.Append(",");
-
- stbTempPath.Append(GetXmlDocParameterPath(TempParam.ParameterType, false));
- firstAppend = false;
- }
-
- if (thisMethodDef.Parameters.Count > 0)
- stbTempPath.Append(")");
-
- // check whether this is a conversion operator (implicit or explicit)
- // if so, we have to read return type and add "~" char.
- //if (IsOperator(thisMethodDef))
- //{
- // OperatorType OpType = GetOperatorType(thisMethodDef);
-
- // if (OpType == OperatorType.op_Implicit || OpType == OperatorType.op_Explicit)
- // {
- // // add return type parameter path
- // stbTempPath.Append("~");
- // stbTempPath.Append(GetXmlDocParameterPath(thisMethodDef.ReturnType, false));
- // }
- //}
-
- // add to path
- CurrPath.Add(stbTempPath.ToString());
- }
- else if (Member is FieldReference)
- {
- // field, get type's path name
- CurrPath.Add("F:");
- if (Member.DeclaringType != null)
- GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
-
- // field's path
- CurrPath.Add("." + Member.Name);
- }
- else if (Member is PropertyReference)
- {
- // property or indexer, get declaring type's path
- CurrPath.Add("P:");
- if (Member.DeclaringType != null)
- GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
-
- // property's path
- // check whether this is explicitly implemented property
- strExplicitPath = GetXmlDocExplicitIfaceImplPath(Member);
- stbTempPath.Append (".");
- if (strExplicitPath.Length > 0)
- stbTempPath.Append (strExplicitPath);
- else
- stbTempPath.Append (Member.Name);
-
- // is it an indexer ?
- bool firstAppend = true;
- PropertyDefinition piProperty = Member as PropertyDefinition;
- if (piProperty.Parameters.Count > 0)
- stbTempPath.Append("(");
-
- foreach (ParameterDefinition TempParam in piProperty.Parameters)
- {
- if (!firstAppend)
- stbTempPath.Append(",");
-
- stbTempPath.Append(GetXmlDocParameterPath(TempParam.ParameterType, false));
- firstAppend = false;
- }
-
- if (piProperty.Parameters.Count > 0)
- stbTempPath.Append(")");
-
- CurrPath.Add(stbTempPath.ToString());
- }
- else if (Member is EventReference)
- {
- // event, get type's path firstAppend
- CurrPath.Add("E:");
- if (Member.DeclaringType != null)
- GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
-
- // event's path
- CurrPath.Add("." + Member.Name);
- }
- }
-
- private string GetXmlDocParameterPath(
- TypeReference Type,
- bool ExplicitMode)
- {
- StringBuilder stbCurrPath = new StringBuilder();
-
- GetXmlDocParameterPathRecursive(Type, ExplicitMode, stbCurrPath);
-
- return stbCurrPath.ToString();
- }
-
- private void GetXmlDocParameterPathRecursive(
- TypeReference tpType,
- bool ExplicitMode,
- StringBuilder CurrPath)
- {
- if (tpType == null)
- return;
-
- if (tpType.GenericParameters.Count > 0)
- {
- CurrPath.Append(tpType.Namespace)
- .Append ((CanAppendSpecialExplicitChar () && ExplicitMode) ? "#" : ".")
- .Append(StripGenericName(tpType.Name));
-
- // list parameters or types
- bool firstAppend = true;
- CurrPath.Append("{");
- foreach (GenericParameter TempType in tpType.GenericParameters)
- {
- if (!firstAppend)
- CurrPath.Append(",");
-
- CurrPath.Append(GetXmlDocParameterPath(TempType, ExplicitMode));
- firstAppend = false;
- }
- CurrPath.Append("}");
- }
- else if (tpType is GenericInstanceType)
- {
- GenericInstanceType thisGenericType = tpType as GenericInstanceType;
-
- // if nested, scan enclosing type
- if (tpType.DeclaringType != null)
- CurrPath.Append(GetXmlDocParameterPath(tpType.DeclaringType, ExplicitMode));
-
- // determine namespace
- string strNamespace = string.Empty;
- if ((tpType.Namespace != null && tpType.Namespace.Length > 0) || tpType.DeclaringType != null)
- {
- strNamespace = tpType.Namespace +
- ((CanAppendSpecialExplicitChar() && ExplicitMode) ? "#" : ".");
- }
-
- CurrPath.Append(strNamespace).Append (StripGenericName(thisGenericType.Name));
-
- // list parameters or types
- bool firstAppend = true;
- CurrPath.Append("{");
- foreach (TypeReference tempTypeRef in thisGenericType.GenericArguments)
- {
- if (!firstAppend)
- CurrPath.Append(",");
-
- CurrPath.Append(GetXmlDocParameterPath(tempTypeRef, ExplicitMode));
- firstAppend = false;
- }
- CurrPath.Append("}");
- }
- else if (tpType is GenericParameter)
- {
- GenericParameter thisGenParam = tpType as GenericParameter;
-
- if (ExplicitMode)
- {
- // in explicit mode we print parameter name
- CurrPath.Append(thisGenParam.Name);
- }
- else
- {
- // in non-explicit mode we print parameter order
- int paramOrder = 0;
-
- // find
- for (int i = 0; i < thisGenParam.Owner.GenericParameters.Count; i++)
- {
- if (thisGenParam.Owner.GenericParameters[i].Name == tpType.Name)
- {
- paramOrder = i;
- break;
- }
- }
- if (thisGenParam.Owner is MethodReference)
- CurrPath.Append("``").Append (paramOrder);
- else
- CurrPath.Append("`").Append (paramOrder);
- }
- }
- else if (tpType is PointerType)
- {
- // parameter is pointer type
- CurrPath.Append(GetXmlDocParameterPath((tpType as PointerType).ElementType, ExplicitMode));
- CurrPath.Append("*");
- }
- else if (tpType is ArrayType)
- {
- ArrayType thisArrayType = tpType as ArrayType;
- if (thisArrayType.ElementType != null)
- CurrPath.Append(GetXmlDocParameterPath(thisArrayType.ElementType, ExplicitMode));
-
- int iRank = thisArrayType.Rank;
- if (iRank == 1)
- {
- CurrPath.Append("[]");
- }
- else
- {
- bool firstAppend = true;
- CurrPath.Append("[");
-
- for (int i = 0; i < (ExplicitMode ? iRank - 1 : iRank); i++)
- {
- // in explicit mode for .NET3.5/VS2008,
- // there is no separator char "," used for multi-dimensional array,
- // so there are three cases when comma shall be added:
- // firstAppend = false; ExplicitMode = false; CanAppendSpecialExplicitChar() = true;
- // firstAppend = false; ExplicitMode = false; CanAppendSpecialExplicitChar() = false;
- // firstAppend = false; ExplicitMode = true; CanAppendSpecialExplicitChar() = false;
- // below this is stored in decent manner
- if (!firstAppend && (!ExplicitMode || !CanAppendSpecialExplicitChar()))
- CurrPath.Append(",");
-
- CurrPath.Append(((CanAppendSpecialExplicitChar() && ExplicitMode) ? "@" : "0:"));
- if (thisArrayType.Dimensions[i].UpperBound > 0)
- CurrPath.Append(thisArrayType.Dimensions[i].UpperBound.ToString());
- firstAppend = false;
- }
-
- CurrPath.Append("]");
- }
- }
-// else if (!tpType.IsValueType)
+// //if (thisMethodDef.IsStatic && thisMethodDef.IsConstructor)
+// // stbTempPath.Append(".#cctor");
+// //if (!thisMethodDef.IsStatic && thisMethodDef.IsConstructor)
+// // stbTempPath.Append(".#ctor");
+// stbTempPath.Append (".");
+// if (strExplicitPath.Length > 0)
+// stbTempPath.Append (strExplicitPath);
+// else
+// stbTempPath.Append (thisMethodDef.Name);
+
+// // check whether this method is generic
+// if (thisMethodDef.GenericParameters.Count > 0)
+// stbTempPath.Append("``").Append (thisMethodDef.GenericParameters.Count);
+
+// if (thisMethodDef.Parameters.Count > 0)
+// stbTempPath.Append("(");
+// bool firstAppend = true;
+// foreach (ParameterDefinition TempParam in thisMethodDef.Parameters)
+// {
+// if (!firstAppend)
+// stbTempPath.Append(",");
+
+// stbTempPath.Append(GetXmlDocParameterPath(TempParam.ParameterType, false));
+// firstAppend = false;
+// }
+
+// if (thisMethodDef.Parameters.Count > 0)
+// stbTempPath.Append(")");
+
+// // check whether this is a conversion operator (implicit or explicit)
+// // if so, we have to read return type and add "~" char.
+// //if (IsOperator(thisMethodDef))
+// //{
+// // OperatorType OpType = GetOperatorType(thisMethodDef);
+
+// // if (OpType == OperatorType.op_Implicit || OpType == OperatorType.op_Explicit)
+// // {
+// // // add return type parameter path
+// // stbTempPath.Append("~");
+// // stbTempPath.Append(GetXmlDocParameterPath(thisMethodDef.ReturnType, false));
+// // }
+// //}
+
+// // add to path
+// CurrPath.Add(stbTempPath.ToString());
+// }
+// else if (Member is FieldReference)
// {
-// // parameter is passed by reference
-// CurrPath.Append(GetXmlDocParameterPath((tpType as ReferenceType).ElementType, false));
-// CurrPath.Append("@");
+// // field, get type's path name
+// CurrPath.Add("F:");
+// if (Member.DeclaringType != null)
+// GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
+
+// // field's path
+// CurrPath.Add("." + Member.Name);
// }
-// else if (tpType is ModifierOptional)
+// else if (Member is PropertyReference)
+// {
+// // property or indexer, get declaring type's path
+// CurrPath.Add("P:");
+// if (Member.DeclaringType != null)
+// GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
+
+// // property's path
+// // check whether this is explicitly implemented property
+// strExplicitPath = GetXmlDocExplicitIfaceImplPath(Member);
+// stbTempPath.Append (".");
+// if (strExplicitPath.Length > 0)
+// stbTempPath.Append (strExplicitPath);
+// else
+// stbTempPath.Append (Member.Name);
+
+// // is it an indexer ?
+// bool firstAppend = true;
+// PropertyDefinition piProperty = Member as PropertyDefinition;
+// if (piProperty.Parameters.Count > 0)
+// stbTempPath.Append("(");
+
+// foreach (ParameterDefinition TempParam in piProperty.Parameters)
+// {
+// if (!firstAppend)
+// stbTempPath.Append(",");
+
+// stbTempPath.Append(GetXmlDocParameterPath(TempParam.ParameterType, false));
+// firstAppend = false;
+// }
+
+// if (piProperty.Parameters.Count > 0)
+// stbTempPath.Append(")");
+
+// CurrPath.Add(stbTempPath.ToString());
+// }
+// else if (Member is EventReference)
+// {
+// // event, get type's path firstAppend
+// CurrPath.Add("E:");
+// if (Member.DeclaringType != null)
+// GetXmlDocPathRecursive(Member.DeclaringType, CurrPath);
+
+// // event's path
+// CurrPath.Add("." + Member.Name);
+// }
+// }
+
+// private string GetXmlDocParameterPath(
+// TypeReference Type,
+// bool ExplicitMode)
+// {
+// StringBuilder stbCurrPath = new StringBuilder();
+
+// GetXmlDocParameterPathRecursive(Type, ExplicitMode, stbCurrPath);
+
+// return stbCurrPath.ToString();
+// }
+
+// private void GetXmlDocParameterPathRecursive(
+// TypeReference tpType,
+// bool ExplicitMode,
+// StringBuilder CurrPath)
+// {
+// if (tpType == null)
+// return;
+
+// if (tpType.GenericParameters.Count > 0)
+// {
+// CurrPath.Append(tpType.Namespace)
+// .Append ((CanAppendSpecialExplicitChar () && ExplicitMode) ? "#" : ".")
+// .Append(StripGenericName(tpType.Name));
+
+// // list parameters or types
+// bool firstAppend = true;
+// CurrPath.Append("{");
+// foreach (GenericParameter TempType in tpType.GenericParameters)
+// {
+// if (!firstAppend)
+// CurrPath.Append(",");
+
+// CurrPath.Append(GetXmlDocParameterPath(TempType, ExplicitMode));
+// firstAppend = false;
+// }
+// CurrPath.Append("}");
+// }
+// else if (tpType is GenericInstanceType)
+// {
+// GenericInstanceType thisGenericType = tpType as GenericInstanceType;
+
+// // if nested, scan enclosing type
+// if (tpType.DeclaringType != null)
+// CurrPath.Append(GetXmlDocParameterPath(tpType.DeclaringType, ExplicitMode));
+
+// // determine namespace
+// string strNamespace = string.Empty;
+// if ((tpType.Namespace != null && tpType.Namespace.Length > 0) || tpType.DeclaringType != null)
+// {
+// strNamespace = tpType.Namespace +
+// ((CanAppendSpecialExplicitChar() && ExplicitMode) ? "#" : ".");
+// }
+
+// CurrPath.Append(strNamespace).Append (StripGenericName(thisGenericType.Name));
+
+// // list parameters or types
+// bool firstAppend = true;
+// CurrPath.Append("{");
+// foreach (TypeReference tempTypeRef in thisGenericType.GenericArguments)
+// {
+// if (!firstAppend)
+// CurrPath.Append(",");
+
+// CurrPath.Append(GetXmlDocParameterPath(tempTypeRef, ExplicitMode));
+// firstAppend = false;
+// }
+// CurrPath.Append("}");
+// }
+// else if (tpType is GenericParameter)
+// {
+// GenericParameter thisGenParam = tpType as GenericParameter;
+
+// if (ExplicitMode)
+// {
+// // in explicit mode we print parameter name
+// CurrPath.Append(thisGenParam.Name);
+// }
+// else
+// {
+// // in non-explicit mode we print parameter order
+// int paramOrder = 0;
+
+// // find
+// for (int i = 0; i < thisGenParam.Owner.GenericParameters.Count; i++)
+// {
+// if (thisGenParam.Owner.GenericParameters[i].Name == tpType.Name)
+// {
+// paramOrder = i;
+// break;
+// }
+// }
+// if (thisGenParam.Owner is MethodReference)
+// CurrPath.Append("``").Append (paramOrder);
+// else
+// CurrPath.Append("`").Append (paramOrder);
+// }
+// }
+// else if (tpType is PointerType)
+// {
+// // parameter is pointer type
+// CurrPath.Append(GetXmlDocParameterPath((tpType as PointerType).ElementType, ExplicitMode));
+// CurrPath.Append("*");
+// }
+// else if (tpType is ArrayType)
+// {
+// ArrayType thisArrayType = tpType as ArrayType;
+// if (thisArrayType.ElementType != null)
+// CurrPath.Append(GetXmlDocParameterPath(thisArrayType.ElementType, ExplicitMode));
+
+// int iRank = thisArrayType.Rank;
+// if (iRank == 1)
+// {
+// CurrPath.Append("[]");
+// }
+// else
+// {
+// bool firstAppend = true;
+// CurrPath.Append("[");
+
+// for (int i = 0; i < (ExplicitMode ? iRank - 1 : iRank); i++)
+// {
+// // in explicit mode for .NET3.5/VS2008,
+// // there is no separator char "," used for multi-dimensional array,
+// // so there are three cases when comma shall be added:
+// // firstAppend = false; ExplicitMode = false; CanAppendSpecialExplicitChar() = true;
+// // firstAppend = false; ExplicitMode = false; CanAppendSpecialExplicitChar() = false;
+// // firstAppend = false; ExplicitMode = true; CanAppendSpecialExplicitChar() = false;
+// // below this is stored in decent manner
+// if (!firstAppend && (!ExplicitMode || !CanAppendSpecialExplicitChar()))
+// CurrPath.Append(",");
+
+// CurrPath.Append(((CanAppendSpecialExplicitChar() && ExplicitMode) ? "@" : "0:"));
+// if (thisArrayType.Dimensions[i].UpperBound > 0)
+// CurrPath.Append(thisArrayType.Dimensions[i].UpperBound.ToString());
+// firstAppend = false;
+// }
+
+// CurrPath.Append("]");
+// }
+// }
+//// else if (!tpType.IsValueType)
+//// {
+//// // parameter is passed by reference
+//// CurrPath.Append(GetXmlDocParameterPath((tpType as ReferenceType).ElementType, false));
+//// CurrPath.Append("@");
+//// }
+//// else if (tpType is ModifierOptional)
+//// {
+//// // parameter has optional modifier
+//// ModifierOptional thisModOpt = tpType as ModifierOptional;
+////
+//// CurrPath.Append(GetXmlDocParameterPath(thisModOpt.ElementType, ExplicitMode));
+//// CurrPath.Append("!");
+//// CurrPath.Append(GetXmlDocParameterPath(thisModOpt.ModifierType, ExplicitMode));
+//// }
+//// else if (tpType is ModifierRequired)
+//// {
+//// // parameter has required modifier
+//// ModifierRequired thisModReq = tpType as ModifierRequired;
+////
+//// CurrPath.Append(GetXmlDocParameterPath(thisModReq.ElementType, ExplicitMode));
+//// CurrPath.Append("|");
+//// CurrPath.Append(GetXmlDocParameterPath(thisModReq.ModifierType, ExplicitMode));
+//// }
+// else if (tpType is FunctionPointerType)
+// {
+// // type is function pointer
+// FunctionPointerType thisFuncPtr = tpType as FunctionPointerType;
+//// string tempString = string.Empty;
+
+// // return type
+// CurrPath.Append("=FUNC:");
+// CurrPath.Append(GetXmlDocParameterPath(thisFuncPtr.ReturnType, ExplicitMode));
+
+// // method's parameters
+// if (thisFuncPtr.Parameters.Count > 0)
+// {
+// bool firstAppend = true;
+// CurrPath.Append("(");
+
+// foreach (ParameterDefinition tempParam in thisFuncPtr.Parameters)
+// {
+// if (!firstAppend)
+// CurrPath.Append(",");
+
+// CurrPath.Append(GetXmlDocParameterPath(tempParam.ParameterType, ExplicitMode));
+// firstAppend = false;
+// }
+
+// CurrPath.Append(")");
+// }
+// else
+// {
+// CurrPath.Append("(System.Void)");
+// }
+// }
+// else if (tpType is PinnedType)
+// {
+// // type is pinned type
+// CurrPath.Append(GetXmlDocParameterPath((tpType as PinnedType).ElementType, ExplicitMode));
+// CurrPath.Append("^");
+// }
+// else if (tpType is TypeReference)
+// {
+// // if nested, scan enclosing type
+// if (tpType.DeclaringType != null)
+// CurrPath.Append(GetXmlDocParameterPath(tpType.DeclaringType, ExplicitMode));
+
+// // determine namespace
+// string strNamespace = string.Empty;
+// if ((tpType.Namespace != null && tpType.Namespace.Length > 0) || tpType.DeclaringType != null)
+// {
+// strNamespace = tpType.Namespace +
+// ((CanAppendSpecialExplicitChar() && ExplicitMode) ? "#" : ".");
+// }
+
+// // concrete type
+// CurrPath.Append(strNamespace).Append (
+// ((CanAppendSpecialExplicitChar() && ExplicitMode) ? tpType.Name.Replace(".", "#") : tpType.Name));
+// }
+// }
+
+// private OperatorType GetOperatorType(MethodDefinition OperatorMethod)
+// {
+// try
// {
-// // parameter has optional modifier
-// ModifierOptional thisModOpt = tpType as ModifierOptional;
-//
-// CurrPath.Append(GetXmlDocParameterPath(thisModOpt.ElementType, ExplicitMode));
-// CurrPath.Append("!");
-// CurrPath.Append(GetXmlDocParameterPath(thisModOpt.ModifierType, ExplicitMode));
+// return (OperatorType)Enum.Parse(typeof(OperatorType), OperatorMethod.Name.Trim());
// }
-// else if (tpType is ModifierRequired)
+// catch
// {
-// // parameter has required modifier
-// ModifierRequired thisModReq = tpType as ModifierRequired;
-//
-// CurrPath.Append(GetXmlDocParameterPath(thisModReq.ElementType, ExplicitMode));
-// CurrPath.Append("|");
-// CurrPath.Append(GetXmlDocParameterPath(thisModReq.ModifierType, ExplicitMode));
+// return OperatorType.None;
// }
- else if (tpType is FunctionPointerType)
- {
- // type is function pointer
- FunctionPointerType thisFuncPtr = tpType as FunctionPointerType;
-// string tempString = string.Empty;
-
- // return type
- CurrPath.Append("=FUNC:");
- CurrPath.Append(GetXmlDocParameterPath(thisFuncPtr.ReturnType, ExplicitMode));
-
- // method's parameters
- if (thisFuncPtr.Parameters.Count > 0)
- {
- bool firstAppend = true;
- CurrPath.Append("(");
-
- foreach (ParameterDefinition tempParam in thisFuncPtr.Parameters)
- {
- if (!firstAppend)
- CurrPath.Append(",");
-
- CurrPath.Append(GetXmlDocParameterPath(tempParam.ParameterType, ExplicitMode));
- firstAppend = false;
- }
-
- CurrPath.Append(")");
- }
- else
- {
- CurrPath.Append("(System.Void)");
- }
- }
- else if (tpType is PinnedType)
- {
- // type is pinned type
- CurrPath.Append(GetXmlDocParameterPath((tpType as PinnedType).ElementType, ExplicitMode));
- CurrPath.Append("^");
- }
- else if (tpType is TypeReference)
- {
- // if nested, scan enclosing type
- if (tpType.DeclaringType != null)
- CurrPath.Append(GetXmlDocParameterPath(tpType.DeclaringType, ExplicitMode));
-
- // determine namespace
- string strNamespace = string.Empty;
- if ((tpType.Namespace != null && tpType.Namespace.Length > 0) || tpType.DeclaringType != null)
- {
- strNamespace = tpType.Namespace +
- ((CanAppendSpecialExplicitChar() && ExplicitMode) ? "#" : ".");
- }
-
- // concrete type
- CurrPath.Append(strNamespace).Append (
- ((CanAppendSpecialExplicitChar() && ExplicitMode) ? tpType.Name.Replace(".", "#") : tpType.Name));
- }
- }
-
- private OperatorType GetOperatorType(MethodDefinition OperatorMethod)
- {
- try
- {
- return (OperatorType)Enum.Parse(typeof(OperatorType), OperatorMethod.Name.Trim());
- }
- catch
- {
- return OperatorType.None;
- }
- }
-
- public bool IsNested(
- TypeReference Type)
- {
- if (Type.IsNested)
- return true;
-
- return false;
- }
-
- private bool IsOperator(MethodDefinition Method)
- {
- if (Method.IsSpecialName && Method.Name.StartsWith("op_"))
- return true;
-
- return false;
- }
-
- private bool CanAppendSpecialExplicitChar()
- {
- if (m_compat == CompatibilityType.Net35)
- return true;
-
- return false;
- }
-
- private string StripGenericName(string OrginalClassName)
- {
- if (OrginalClassName.IndexOf("`") != -1)
- return OrginalClassName.Remove(OrginalClassName.IndexOf("`"));
- else
- return OrginalClassName;
- }
- #endregion
-
- #region Private members
- private CompatibilityType m_compat;
- #endregion
- }
- #endregion
-}
+// }
+
+// public bool IsNested(
+// TypeReference Type)
+// {
+// if (Type.IsNested)
+// return true;
+
+// return false;
+// }
+
+// private bool IsOperator(MethodDefinition Method)
+// {
+// if (Method.IsSpecialName && Method.Name.StartsWith("op_"))
+// return true;
+
+// return false;
+// }
+
+// private bool CanAppendSpecialExplicitChar()
+// {
+// if (m_compat == CompatibilityType.Net35)
+// return true;
+
+// return false;
+// }
+
+// private string StripGenericName(string OrginalClassName)
+// {
+// if (OrginalClassName.IndexOf("`") != -1)
+// return OrginalClassName.Remove(OrginalClassName.IndexOf("`"));
+// else
+// return OrginalClassName;
+// }
+// #endregion
+
+// #region Private members
+// private CompatibilityType m_compat;
+// #endregion
+// }
+// #endregion
+//}
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config b/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config
deleted file mode 100644
index 66c14c17d2..0000000000
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Autotools/Makefile.am b/main/src/addins/MonoDevelop.Autotools/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Autotools/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj
index b39ea5c36b..18f0066265 100644
--- a/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj
+++ b/main/src/addins/MonoDevelop.Autotools/MonoDevelop.Autotools.csproj
@@ -40,10 +40,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
diff --git a/main/src/addins/MonoDevelop.ConnectedServices/CodeExtensions.cs b/main/src/addins/MonoDevelop.ConnectedServices/CodeExtensions.cs
index 17da306510..531f40aad8 100644
--- a/main/src/addins/MonoDevelop.ConnectedServices/CodeExtensions.cs
+++ b/main/src/addins/MonoDevelop.ConnectedServices/CodeExtensions.cs
@@ -2,8 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using ICSharpCode.NRefactory.TypeSystem;
-using ICSharpCode.NRefactory.CSharp;
using MonoDevelop.Core;
using MonoDevelop.Projects.Text;
using Microsoft.CodeAnalysis;
@@ -44,52 +42,6 @@ namespace MonoDevelop.ConnectedServices
}
/// <summary>
- /// Determines if the other is derived from type
- /// </summary>
- public static bool IsDerivedFromClass (this IType type, IType other)
- {
- var derived = type.DirectBaseTypes.Any (baseType => baseType == other);
- if (derived)
- return true;
-
- foreach (var baseType in type.DirectBaseTypes) {
- derived = IsDerivedFromClass (baseType, other);
- if (derived)
- return true;
- }
-
- return false;
- }
-
- /// <summary>
- /// Determines if the given type is defined in source code, ie is part of the project
- /// </summary>
- public static bool IsDefinedInSource (this ITypeDefinition type, ICompilation compilation)
- {
- if (compilation == null)
- return false;
-
- return type.ParentAssembly.UnresolvedAssembly.Location == compilation.MainAssembly.UnresolvedAssembly.Location;
- }
-
- /// <summary>
- /// Determines if the given type is defined in source code, ie is part of the project
- /// </summary>
- public static bool IsDefinedInSource (this IMember type, ICompilation compilation)
- {
- return type.ParentAssembly.UnresolvedAssembly.Location == compilation.MainAssembly.UnresolvedAssembly.Location;
- }
-
- /// <summary>
- /// Formats the syntax tree and saves it
- /// </summary>
- public static void FormatAndSave (this ICSharpCode.NRefactory.CSharp.SyntaxTree file, string fileName)
- {
- var result = FormatFile (file);
- SaveFile (fileName, result);
- }
-
- /// <summary>
/// Returns true if the given type is a derived class of 'param name="class"' and has an attribute of type 'param name="attributeType"' applied
/// </summary>
public static bool IsAttributedSubclass (this INamedTypeSymbol type, INamedTypeSymbol classType, INamedTypeSymbol attributeType)
@@ -114,22 +66,6 @@ namespace MonoDevelop.ConnectedServices
}
/// <summary>
- /// Formats the file
- /// </summary>
- static string FormatFile (ICSharpCode.NRefactory.CSharp.SyntaxTree file)
- {
- var formatting = FormattingOptionsFactory.CreateMono ();
- formatting.AutoPropertyFormatting = PropertyFormatting.ForceOneLine;
- formatting.SimplePropertyFormatting = PropertyFormatting.ForceOneLine;
-
- var formatter = new CSharpFormatter (formatting) {
- FormattingMode = FormattingMode.Intrusive
- };
-
- return formatter.Format (file.ToString ());
- }
-
- /// <summary>
/// Saves the file with the given content
/// </summary>
static void SaveFile (string file, string content)
@@ -137,4 +73,4 @@ namespace MonoDevelop.ConnectedServices
TextFile.WriteFile (file, content, null, null, true);
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/addins/MonoDevelop.ConnectedServices/Makefile.am b/main/src/addins/MonoDevelop.ConnectedServices/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.ConnectedServices/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.ConnectedServices/MonoDevelop.ConnectedServices.csproj b/main/src/addins/MonoDevelop.ConnectedServices/MonoDevelop.ConnectedServices.csproj
index 8d614adf80..fc08ed6b63 100644
--- a/main/src/addins/MonoDevelop.ConnectedServices/MonoDevelop.ConnectedServices.csproj
+++ b/main/src/addins/MonoDevelop.ConnectedServices/MonoDevelop.ConnectedServices.csproj
@@ -13,50 +13,10 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="ICSharpCode.NRefactory">
<HintPath>..\..\..\build\bin\ICSharpCode.NRefactory.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="ICSharpCode.NRefactory.CSharp">
- <HintPath>..\..\..\build\bin\ICSharpCode.NRefactory.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Composition.AttributedModel">
- <HintPath>..\..\..\build\bin\System.Composition.AttributedModel.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -141,7 +101,6 @@
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.md" />
- <None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.ConnectedServices/packages.config b/main/src/addins/MonoDevelop.ConnectedServices/packages.config
deleted file mode 100644
index ee51c23738..0000000000
--- a/main/src/addins/MonoDevelop.ConnectedServices/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Gdb/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Soft/Makefile.am
deleted file mode 100644
index c4c422e78c..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Soft/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = \
- MonoDevelop.Debugger.Soft \
- MonoDevelop.Debugger.Soft.AspNet
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.AspNet/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.csproj b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.csproj
index f28ffbf635..e36a3db61a 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.csproj
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft.csproj
@@ -13,22 +13,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@@ -73,9 +57,8 @@
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
+ <IncludeCopyLocal Include="Mono.Debugger.Soft.dll" />
+ <IncludeCopyLocal Include="Mono.Debugging.Soft.dll" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/packages.config b/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/packages.config
deleted file mode 100644
index f9194282d2..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Soft/MonoDevelop.Debugger.Soft/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/Makefile.am b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/Makefile.am
deleted file mode 100644
index 8f41a600f1..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = \
- MonoDevelop.Debugger.VsCodeDebugProtocol
-
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/Makefile.am b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol.csproj b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol.csproj
index cced3d764b..abfc017abb 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol.csproj
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol.csproj
@@ -11,13 +11,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Shared.VSCodeDebugProtocol">
- <HintPath>..\..\..\..\packages\Microsoft.VisualStudio.Shared.VsCodeDebugProtocol.15.8.20719.1\lib\net45\Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.dll</HintPath>
- </Reference>
+ <PackageReference Include="Microsoft.VisualStudio.Shared.VsCodeDebugProtocol" Version="$(NuGetVersionVSCodeDebugProtocol)" PrivateAssets="runtime" />
+ <PackageReference Include="Newtonsoft.Json" Version="$(NuGetVersionNewtonsoftJson)" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
@@ -45,6 +40,7 @@
<Name>Mono.Debugging</Name>
<Private>False</Private>
</ProjectReference>
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddinInfo.cs" />
@@ -53,8 +49,5 @@
<Compile Include="VsCodeObjectSource.cs" />
<Compile Include="VsCodeBacktrace.cs" />
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
index 0a61ae5d41..395bb8ebe1 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VSCodeDebuggerSession.cs
@@ -1,4 +1,4 @@
-//
+//
// VSCodeDebuggerSession.cs
//
// Author:
@@ -267,7 +267,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
if (j == -1)
break;
string se = exp.Substring(i + 1, j - i - 1);
- se = protocolClient.SendRequestSync(new EvaluateRequest(se, frameId)).Result;
+ se = protocolClient.SendRequestSync(new EvaluateRequest (se) { FrameId = frameId }).Result;
sb.Append(exp, last, i - last);
sb.Append(se);
last = j + 1;
@@ -368,27 +368,38 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
void UpdateBreakpoints ()
{
- //Disposed
- if (protocolClient == null)
- return;
-
var bks = breakpoints.Select (b => b.Key).OfType<Mono.Debugging.Client.Breakpoint> ().Where (b => b.Enabled && !string.IsNullOrEmpty (b.FileName)).GroupBy (b => b.FileName).ToArray ();
var filesForRemoval = pathsWithBreakpoints.Where (path => !bks.Any (b => b.Key == path)).ToArray ();
pathsWithBreakpoints = bks.Select (b => b.Key).ToList ();
- foreach (var path in filesForRemoval)
- protocolClient.SendRequest (new SetBreakpointsRequest (new Source (Path.GetFileName (path), path), new List<SourceBreakpoint> ()), null);
+ foreach (var path in filesForRemoval) {
+ //Disposed
+ if (protocolClient == null)
+ return;
+
+ protocolClient.SendRequest (
+ new SetBreakpointsRequest (
+ new Source { Name = Path.GetFileName (path), Path = path }) {
+ Breakpoints = new List<SourceBreakpoint> ()
+ },
+ null);
+ }
foreach (var sourceFile in bks) {
- var source = new Source (Path.GetFileName (sourceFile.Key), sourceFile.Key);
- protocolClient.SendRequest (new SetBreakpointsRequest (
- source,
- sourceFile.Select (b => new SourceBreakpoint {
- Line = b.OriginalLine,
- Column = b.OriginalColumn,
- Condition = b.ConditionExpression
- //TODO: HitCondition = b.HitCountMode + b.HitCount, wait for .Net Core Debugger
- }).ToList ()), (obj) => {
+ var source = new Source { Name = Path.GetFileName (sourceFile.Key), Path = sourceFile.Key };
+ //Disposed
+ if (protocolClient == null)
+ return;
+
+ protocolClient.SendRequest (
+ new SetBreakpointsRequest (source) {
+ Breakpoints = sourceFile.Select (b => new SourceBreakpoint {
+ Line = b.OriginalLine,
+ Column = b.OriginalColumn,
+ Condition = b.ConditionExpression
+ //TODO: HitCondition = b.HitCountMode + b.HitCount, wait for .Net Core Debugger
+ }).ToList ()
+ }, (obj) => {
Task.Run (() => {
for (int i = 0; i < obj.Breakpoints.Count; i++) {
breakpoints [sourceFile.ElementAt (i)].SetStatus (obj.Breakpoints [i].Line != -1 ? BreakEventStatus.Bound : BreakEventStatus.NotBound, "");
@@ -399,6 +410,10 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
});
}
+ //Disposed
+ if (protocolClient == null)
+ return;
+
//Notice that .NET Core adapter doesn't support Functions breakpoints yet: https://github.com/OmniSharp/omnisharp-vscode/issues/295
protocolClient.SendRequest (
new SetFunctionBreakpointsRequest (
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs
index d89f406cea..28344c4949 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeBacktrace.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages;
@@ -21,7 +21,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
this.threadId = threadId;
this.vsCodeDebuggerSession = vsCodeDebuggerSession;
frame0Format = VsCodeStackFrame.GetStackFrameFormat (vsCodeDebuggerSession.EvaluationOptions);
- var body = vsCodeDebuggerSession.protocolClient.SendRequestSync (new StackTraceRequest (threadId, 0, 1, frame0Format));
+ var body = vsCodeDebuggerSession.protocolClient.SendRequestSync (new StackTraceRequest (threadId) { StartFrame = 0, Levels = 1, Format = frame0Format });
totalFramesCount = body.TotalFrames ?? 0;
frames = new Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages.StackFrame [totalFramesCount];
if (totalFramesCount > 0 && body.StackFrames.Count > 0)
@@ -70,9 +70,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
var results = new List<ObjectValue> ();
foreach (var expr in expressions) {
using (var timer = vsCodeDebuggerSession.EvaluationStats.StartTimer ()) {
- var responseBody = vsCodeDebuggerSession.protocolClient.SendRequestSync (new EvaluateRequest (
- expr,
- frames [frameIndex].Id));
+ var responseBody = vsCodeDebuggerSession.protocolClient.SendRequestSync (new EvaluateRequest (expr) { FrameId = frames[frameIndex].Id });
results.Add (VsCodeVariableToObjectValue (vsCodeDebuggerSession, expr, expr, responseBody.Type, responseBody.Result, responseBody.VariablesReference, 0, frames [frameIndex].Id));
timer.Success = true;
}
@@ -114,7 +112,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
}
var stackFrames = new Mono.Debugging.Client.StackFrame [Math.Min (lastIndex - firstIndex, totalFramesCount - firstIndex)];
var format = VsCodeStackFrame.GetStackFrameFormat (vsCodeDebuggerSession.EvaluationOptions);
- var body = vsCodeDebuggerSession.protocolClient.SendRequestSync (new StackTraceRequest (threadId, firstIndex, stackFrames.Length, format));
+ var body = vsCodeDebuggerSession.protocolClient.SendRequestSync (new StackTraceRequest (threadId) { StartFrame = firstIndex, Levels = stackFrames.Length, Format = format });
for (int i = 0; i < stackFrames.Length; i++) {
frames [i + firstIndex] = body.StackFrames [i];
stackFrames [i] = new VsCodeStackFrame (format, threadId, i, body.StackFrames [i]);
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
index 02fd9fc481..d98418ec98 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeObjectSource.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages;
using Mono.Debugging.Backend;
@@ -84,7 +84,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
{
string val = null;
using (var timer = vsCodeDebuggerSession.EvaluationStats.StartTimer ()) {
- val = vsCodeDebuggerSession.protocolClient.SendRequestSync (new EvaluateRequest (evalName, frameId)).Result;
+ val = vsCodeDebuggerSession.protocolClient.SendRequestSync (new EvaluateRequest (evalName) { FrameId = frameId }).Result;
timer.Success = true;
}
if (val.StartsWith ("\"", StringComparison.Ordinal))
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs
index d3596fed7a..833ab92c89 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/VsCodeStackFrame.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using Microsoft.VisualStudio.Shared.VSCodeDebugProtocol.Messages;
using Mono.Debugging.Client;
@@ -10,15 +10,14 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
{
public static VsFormat GetStackFrameFormat (EvaluationOptions evalOptions)
{
- return new VsFormat (
- evalOptions.StackFrameFormat.ParameterTypes ||
- evalOptions.StackFrameFormat.ParameterNames ||
- evalOptions.StackFrameFormat.ParameterValues,
- evalOptions.StackFrameFormat.ParameterTypes,
- evalOptions.StackFrameFormat.ParameterNames,
- evalOptions.StackFrameFormat.ParameterValues,
- evalOptions.StackFrameFormat.Line,
- evalOptions.StackFrameFormat.Module);
+ return new VsFormat {
+ Parameters = evalOptions.StackFrameFormat.ParameterTypes || evalOptions.StackFrameFormat.ParameterNames || evalOptions.StackFrameFormat.ParameterValues,
+ ParameterTypes = evalOptions.StackFrameFormat.ParameterTypes,
+ ParameterNames = evalOptions.StackFrameFormat.ParameterNames,
+ ParameterValues = evalOptions.StackFrameFormat.ParameterValues,
+ Line = evalOptions.StackFrameFormat.Line,
+ Module = evalOptions.StackFrameFormat.Module
+ };
}
static string GetLanguage (string path)
@@ -83,7 +82,7 @@ namespace MonoDevelop.Debugger.VsCodeDebugProtocol
currentFormat.ParameterTypes != format.ParameterTypes ||
currentFormat.ParameterValues != format.ParameterValues) {
format = currentFormat;
- var body = ((VSCodeDebuggerSession)DebuggerSession).protocolClient.SendRequestSync (new StackTraceRequest (threadId, frameIndex, 1, currentFormat));
+ var body = ((VSCodeDebuggerSession)DebuggerSession).protocolClient.SendRequestSync (new StackTraceRequest (threadId) { StartFrame = frameIndex, Levels = 1, Format = currentFormat });
fullStackframeText = body.StackFrames [0].Name;
}
return fullStackframeText;
diff --git a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/packages.config b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/packages.config
index 9a5ab42712..5f282702bb 100644
--- a/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/packages.config
+++ b/main/src/addins/MonoDevelop.Debugger.VSCodeDebugProtocol/MonoDevelop.Debugger.VsCodeDebugProtocol/packages.config
@@ -1,5 +1 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.VisualStudio.Shared.VsCodeDebugProtocol" version="15.8.20719.1" targetFramework="net471" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
-</packages> \ No newline at end of file
+ \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Win32/Makefile.am
deleted file mode 100644
index c4345c4a6f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Win32/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = \
- MonoDevelop.Debugger.Win32
-
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/Makefile.am b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj
index e2223deff8..74a63b4193 100644
--- a/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj
+++ b/main/src/addins/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32/MonoDevelop.Debugger.Win32.csproj
@@ -61,6 +61,9 @@
<Project>{74704c00-5861-4f86-920c-865148a175c5}</Project>
<Name>Mono.Debugging.Win32</Name>
</ProjectReference>
+ <IncludeCopyLocal Include="Mono.Debugging.Win32.dll" />
+ <IncludeCopyLocal Include="CorApi2.dll" />
+ <IncludeCopyLocal Include="CorApi.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger/AddinInfo.cs b/main/src/addins/MonoDevelop.Debugger/AddinInfo.cs
index d1fa007c22..e7f96a36a0 100644
--- a/main/src/addins/MonoDevelop.Debugger/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.Debugger/AddinInfo.cs
@@ -14,3 +14,4 @@ using Mono.Addins.Description;
[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.Debugger/Makefile.am b/main/src/addins/MonoDevelop.Debugger/Makefile.am
deleted file mode 100644
index 0debb9b41f..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-NUNIT_CONSOLE = `pkg-config --variable=libdir mono-nunit`/mono/2.0/nunit-console.exe
-FIXTURE = /fixture=$(fixture)
-
-test: all
- if test -n "$(fixture)"; then \
- fp="-fixture=$(fixture)"; \
- fi; \
- $(MD_LAUNCH_SETUP) MONO_PATH=../AddIns/MonoDevelop.Debugger mono --debug $(NUNIT_CONSOLE) -noshadow $(top_builddir)/build/bin/MonoDevelop.Debugger.Tests.dll $$fp
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
index 4bed504e22..d25737367e 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Tests/MonoDevelop.Debugger.Tests.csproj
@@ -54,10 +54,12 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\external\debugger-libs\Mono.Debugging.Soft\Mono.Debugging.Soft.csproj">
<Project>{DE40756E-57F6-4AF2-B155-55E3A88CCED8}</Project>
<Name>Mono.Debugging.Soft</Name>
+ <Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManager.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManager.cs
new file mode 100644
index 0000000000..44991e0ccb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManager.cs
@@ -0,0 +1,117 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Text;
+using Mono.Debugging.Client;
+using MonoDevelop.Core;
+using System.Linq;
+
+namespace MonoDevelop.Debugger
+{
+ class BreakpointManager
+ {
+ private ITextBuffer textBuffer;
+ private readonly string file;
+
+ public BreakpointManager (ITextBuffer textBuffer)
+ {
+ this.textBuffer = textBuffer;
+ file = textBuffer.GetFilePathOrNull ();
+ if (file == null) {
+ LoggingService.LogWarning ("Failed to get filename of textbuffer, breakpoints integration will not work.");
+ return;
+ }
+ textBuffer.Changed += TextBuffer_Changed;
+ DebuggingService.Breakpoints.Changed += OnBreakpointsChanged;
+ DebuggingService.Breakpoints.BreakpointStatusChanged += OnBreakpointsChanged;
+ OnBreakpointsChanged (null, null);
+ }
+
+ void TextBuffer_Changed (object sender, TextContentChangedEventArgs e)
+ {
+ foreach (var breakpoint in breakpoints.Values) {
+ var newSpan = breakpoint.TrackingSpan.GetSpan (e.After);
+ if (newSpan.IsEmpty) {
+ DebuggingService.Breakpoints.Remove (breakpoint.Breakpoint);
+ continue;
+ }
+ var newLineNumber = e.After.GetLineFromPosition (newSpan.Start).LineNumber + 1;
+ if (breakpoint.Breakpoint.Line != newLineNumber) {
+ DebuggingService.Breakpoints.UpdateBreakpointLine (breakpoint.Breakpoint, newLineNumber);
+ }
+ }
+ }
+
+ class ManagerBreakpoint
+ {
+ public Breakpoint Breakpoint { get; set; }
+ public ITrackingSpan TrackingSpan { get; set; }
+ public Span Span { get; set; }
+ }
+
+ private Dictionary<Breakpoint, ManagerBreakpoint> breakpoints = new Dictionary<Breakpoint, ManagerBreakpoint> ();
+
+ private void OnBreakpointsChanged (object sender, EventArgs eventArgs)
+ {
+ var snapshot = textBuffer.CurrentSnapshot;
+ var newBreakpoints = new Dictionary<Breakpoint, ManagerBreakpoint> ();
+ bool needsUpdate = false;
+ foreach (var breakpoint in DebuggingService.Breakpoints.GetBreakpointsAtFile (file)) {
+ if (breakpoint.Line > snapshot.LineCount)
+ continue;
+ if (eventArgs is BreakpointEventArgs breakpointEventArgs && breakpointEventArgs.Breakpoint == breakpoint)
+ needsUpdate = true;
+ var newSpan = snapshot.GetLineFromLineNumber (breakpoint.Line - 1).Extent;
+ if (breakpoints.TryGetValue (breakpoint, out var existingBreakpoint)) {
+ newBreakpoints.Add (breakpoint, existingBreakpoint);
+ if (existingBreakpoint.Span != newSpan.Span) {
+ // Update if anything was modifed
+ needsUpdate = true;
+ existingBreakpoint.Span = newSpan.Span;
+ }
+ } else {
+ // Update if anything was added
+ needsUpdate = true;
+ newBreakpoints.Add (breakpoint, new ManagerBreakpoint () {
+ Breakpoint = breakpoint,
+ TrackingSpan = snapshot.CreateTrackingSpan (newSpan, SpanTrackingMode.EdgeExclusive),
+ Span = newSpan.Span
+ });
+ }
+ }
+ // Update if anything was removed
+ if (needsUpdate || breakpoints.Keys.Except (newBreakpoints.Keys).Any ())
+ needsUpdate = true;
+ breakpoints = newBreakpoints;
+ if (needsUpdate)
+ BreakpointsChanged?.Invoke (this, new SnapshotSpanEventArgs (new SnapshotSpan (snapshot, 0, snapshot.Length)));
+ }
+ public event EventHandler<SnapshotSpanEventArgs> BreakpointsChanged;
+
+ public void Dispose ()
+ {
+ BreakpointsChanged = null;
+ textBuffer.Changed -= TextBuffer_Changed;
+ DebuggingService.Breakpoints.Changed -= OnBreakpointsChanged;
+ DebuggingService.Breakpoints.BreakpointStatusChanged -= OnBreakpointsChanged;
+ }
+
+ public IEnumerable<BreakpointSpan> GetBreakpoints (ITextSnapshot snapshot)
+ {
+ foreach (var item in breakpoints.Values) {
+ yield return new BreakpointSpan (item.Breakpoint, item.TrackingSpan.GetSpan (snapshot));
+ }
+ }
+ }
+
+ class BreakpointSpan
+ {
+ public Breakpoint Breakpoint { get; }
+ public SnapshotSpan Span { get; }
+
+ public BreakpointSpan (Breakpoint breakpoint, SnapshotSpan span)
+ {
+ Breakpoint = breakpoint;
+ Span = span;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManagerService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManagerService.cs
new file mode 100644
index 0000000000..22b4c551dc
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/BreakpointManagerService.cs
@@ -0,0 +1,18 @@
+using System;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Debugger
+{
+ static class BreakpointManagerService
+ {
+ public static BreakpointManager GetBreakpointManager (ITextView textView)
+ {
+ return textView.Properties.GetOrCreateSingletonProperty (delegate {
+ var manager = new BreakpointManager (textView.TextBuffer);
+ textView.Closed += delegate { manager.Dispose (); };
+ return manager;
+ });
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs
new file mode 100644
index 0000000000..8b8181e327
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtAdornmentManager.cs
@@ -0,0 +1,287 @@
+#if !WINDOWS
+
+using System;
+using AppKit;
+using CoreGraphics;
+using Foundation;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.UI;
+using Microsoft.VisualStudio.UI.Controls;
+using Mono.Debugging.Client;
+using MonoDevelop.Components;
+using MonoDevelop.Components.Mac;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.TextEditing;
+using GettextCatalog = MonoDevelop.Core.GettextCatalog;
+
+namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught
+{
+ public class ExceptionCaughtAdornmentManager : IDisposable
+ {
+ readonly ICocoaTextView textView;
+ private readonly string filePath;
+ readonly IXPlatAdornmentLayer _exceptionCaughtLayer;
+ FileLineExtension extension;
+
+ public ExceptionCaughtAdornmentManager (ICocoaTextView textView)
+ {
+ filePath = textView.TextBuffer.GetFilePathOrNull ();
+ if (filePath == null)
+ return;
+ TextEditorService.FileExtensionAdded += FileExtensionAdded;
+ TextEditorService.FileExtensionRemoved += FileExtensionRemoved;
+ _exceptionCaughtLayer = textView.GetXPlatAdornmentLayer ("ExceptionCaught");
+ this.textView = textView;
+ this.textView.LayoutChanged += TextView_LayoutChanged;
+
+ foreach (var ext in TextEditorService.GetFileExtensions (filePath))
+ FileExtensionAdded (null, new FileExtensionEventArgs { Extension = ext });
+ }
+
+ private void FileExtensionRemoved (object sender, FileExtensionEventArgs e)
+ {
+ if (e.Extension == extension) {
+ extension = null;
+ _exceptionCaughtLayer.RemoveAllAdornments ();
+ }
+ }
+
+ private void FileExtensionAdded (object sender, FileExtensionEventArgs e)
+ {
+ if (e.Extension is FileLineExtension fileLineExtension && fileLineExtension.File == filePath) {
+ RenderAdornment (fileLineExtension);
+ }
+ }
+ ITrackingSpan trackingSpan;
+ private void RenderAdornment (FileLineExtension fileLineExtension)
+ {
+ NSView view;
+ if (fileLineExtension is ExceptionCaughtButton button)
+ view = CreateButton (button);
+ else if (fileLineExtension is ExceptionCaughtMiniButton miniButton)
+ view = CreateMiniButton (miniButton);
+ else
+ return;
+ if (extension != fileLineExtension) {
+ extension = fileLineExtension;
+ var newSpan = textView.TextSnapshot.SpanFromMDColumnAndLine (extension.Line, extension.Column, extension.Line, extension.Column);
+ trackingSpan = textView.TextSnapshot.CreateTrackingSpan (newSpan, SpanTrackingMode.EdgeInclusive);
+ }
+ var span = trackingSpan.GetSpan (textView.TextSnapshot);
+ if (textView.TextViewLines == null)
+ return;
+ if (!textView.TextViewLines.FormattedSpan.IntersectsWith (span))
+ return;
+ var charBound = textView.TextViewLines.GetCharacterBounds (span.End);
+ view.SetFrameOrigin (new CGPoint (
+ Math.Round (charBound.Left),
+ Math.Round (charBound.TextTop + charBound.TextHeight / 2 - view.Frame.Height / 2)));
+ _exceptionCaughtLayer.RemoveAllAdornments ();
+ _exceptionCaughtLayer.AddAdornment (XPlatAdornmentPositioningBehavior.TextRelative, span, null, view, null);
+ }
+
+ private void TextView_LayoutChanged (object sender, TextViewLayoutChangedEventArgs e)
+ {
+ RenderAdornment (extension);
+ }
+
+ static NSImage GetIcon(string iconName, bool tint)
+ {
+ var image = ImageService.GetIcon (iconName)?.ToNSImage ();
+ if (image != null) {
+ image.Template = true;
+ if (tint)
+ image = image.WithTint (NSColor.SystemOrangeColor);
+ }
+ return image;
+ }
+
+ class VSHandButton : NSButton
+ {
+ public VSHandButton()
+ {
+ Bordered = false;
+
+ AddTrackingArea (new NSTrackingArea (
+ default,
+ NSTrackingAreaOptions.ActiveInKeyWindow |
+ NSTrackingAreaOptions.InVisibleRect |
+ NSTrackingAreaOptions.MouseEnteredAndExited |
+ NSTrackingAreaOptions.CursorUpdate,
+ this,
+ null));
+ }
+
+ public override void CursorUpdate (NSEvent theEvent)
+ => NSCursor.PointingHandCursor.Set ();
+ }
+
+ class VSLinkLabelButton : VSHandButton
+ {
+ public VSLinkLabelButton(string title)
+ {
+ // terminate the string with a zero-width-non-breaking-space to
+ // work around a bug in AppKit where the last character does not
+ // have the underline style applied to it when rendered.
+ var attributedTitle = new NSMutableAttributedString (title + "\uFEFF");
+ var range = new NSRange (0, attributedTitle.Length);
+ attributedTitle.AddAttribute (NSStringAttributeKey.Link, new NSUrl ("#"), range);
+ AttributedTitle = attributedTitle;
+ }
+ }
+
+ class ExceptionCaughtPopoverView : VSPopoverView
+ {
+ public ExceptionCaughtPopoverView()
+ {
+ AcceptsTouchEvents = true;
+
+ AddTrackingArea (new NSTrackingArea (
+ default,
+ NSTrackingAreaOptions.ActiveInKeyWindow |
+ NSTrackingAreaOptions.InVisibleRect |
+ NSTrackingAreaOptions.MouseEnteredAndExited |
+ NSTrackingAreaOptions.MouseMoved |
+ NSTrackingAreaOptions.CursorUpdate,
+ this,
+ null));
+ }
+
+ public override void CursorUpdate (NSEvent theEvent)
+ => NSCursor.ArrowCursor.Set ();
+
+ public override bool AcceptsFirstMouse (NSEvent theEvent)
+ => true;
+
+ public override void MouseEntered (NSEvent theEvent) { }
+ public override void MouseExited (NSEvent theEvent) { }
+ public override void MouseMoved (NSEvent theEvent) { }
+ }
+
+ static NSView CreateMiniButton (ExceptionCaughtMiniButton miniButton)
+ {
+ var image = GetIcon ("md-exception-caught-template", tint: true);
+
+ var nsButton = new VSHandButton {
+ Image = image,
+ TranslatesAutoresizingMaskIntoConstraints = false
+ };
+
+ nsButton.SetContentCompressionResistancePriority (1, NSLayoutConstraintOrientation.Horizontal);
+ nsButton.SetContentCompressionResistancePriority (1, NSLayoutConstraintOrientation.Vertical);
+ nsButton.WidthAnchor.ConstraintEqualToConstant (image.Size.Width + 8).Active = true;
+ nsButton.HeightAnchor.ConstraintEqualToConstant (image.Size.Height + 8).Active = true;
+
+ nsButton.Activated += delegate {
+ miniButton.dlg.ShowButton ();
+ };
+
+ return new ExceptionCaughtPopoverView {
+ ContentView = nsButton,
+ CornerRadius = 3,
+ Material = NSVisualEffectMaterial.WindowBackground
+ };
+ }
+
+ static NSView CreateButton (ExceptionCaughtButton button)
+ {
+ var box = new NSGridView {
+ ColumnSpacing = 8,
+ RowSpacing = 8
+ };
+
+ var lightningImage = new NSImageView {
+ Image = GetIcon ("md-exception-caught-template", tint: true)
+ };
+ box.AddColumn (new [] { lightningImage });
+
+ var typeLabel = CreateTextField ();
+ var messageLabel = CreateTextField ();
+ var detailsButton = new VSLinkLabelButton (
+ GettextCatalog.GetString ("Show Details"));
+ detailsButton.Activated += (o, e) => button.dlg.ShowDialog ();
+ box.AddColumn (new NSView[] { typeLabel, messageLabel, detailsButton });
+
+ var closeButton = new NSButton {
+ Image = GetIcon ("md-popup-close", tint: false),
+ BezelStyle = NSBezelStyle.SmallSquare,
+ Bordered = false
+ };
+ closeButton.SetButtonType (NSButtonType.MomentaryLightButton);
+ closeButton.Activated += delegate {
+ button.dlg.ShowMiniButton ();
+ };
+ box.AddColumn (new NSView [] { closeButton });
+
+ button.exception.Changed += delegate {
+ Runtime
+ .RunInMainThread(()=> LoadData(button.exception, messageLabel, typeLabel))
+ .Ignore();
+ };
+
+ LoadData (button.exception, messageLabel, typeLabel);
+
+ box.GetCell (lightningImage).CustomPlacementConstraints = new [] {
+ NSLayoutConstraint.Create (
+ lightningImage, NSLayoutAttribute.CenterY,
+ NSLayoutRelation.Equal,
+ typeLabel, NSLayoutAttribute.CenterY,
+ 1, 0)
+ };
+
+ return new ExceptionCaughtPopoverView {
+ CornerRadius = 6,
+ Padding = new Padding (12),
+ ContentView = box
+ };
+ }
+
+ static NSTextField CreateTextField ()
+ => new NSTextField {
+ Alignment = NSTextAlignment.Natural,
+ Selectable = true,
+ Editable = false,
+ DrawsBackground = false,
+ Bezeled = false,
+ PreferredMaxLayoutWidth = 400,
+ Cell = {
+ Wraps = true,
+ LineBreakMode = NSLineBreakMode.ByWordWrapping,
+ UsesSingleLineMode = false
+ }
+ };
+
+ static void LoadData (ExceptionInfo exception, NSTextField messageLabel, NSTextField typeLabel)
+ {
+ if (!string.IsNullOrEmpty (exception.Message)) {
+ messageLabel.Hidden = false;
+ messageLabel.StringValue = exception.Message;
+ } else {
+ messageLabel.Hidden = true;
+ }
+ if (!string.IsNullOrEmpty (exception.Type)) {
+ typeLabel.Hidden = false;
+ typeLabel.AllowsEditingTextAttributes = true;
+ typeLabel.AttributedStringValue = Xwt
+ .FormattedText
+ .FromMarkup (GettextCatalog.GetString ("<b>{0}</b> has been thrown", exception.Type))
+ .ToAttributedString ((str, range) => {
+ str.AddAttribute (NSStringAttributeKey.Font, NSFont.LabelFontOfSize (NSFont.LabelFontSize * 1.5f), range);
+ str.AddAttribute (NSStringAttributeKey.ForegroundColor, NSColor.LabelColor, range);
+ });
+ } else {
+ typeLabel.Hidden = true;
+ }
+ }
+
+ public void Dispose ()
+ {
+ TextEditorService.FileExtensionAdded -= FileExtensionAdded;
+ TextEditorService.FileExtensionRemoved -= FileExtensionRemoved;
+ }
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtProvider.cs
new file mode 100644
index 0000000000..888e872ae9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/ExceptionCaught/ExceptionCaughtProvider.cs
@@ -0,0 +1,28 @@
+#if !WINDOWS
+
+using System;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger.VSTextView.ExceptionCaught
+{
+ [Export (typeof (ICocoaTextViewCreationListener))]
+ [ContentType ("text")]
+ [TextViewRole (PredefinedTextViewRoles.Debuggable)]
+ sealed class ExceptionCaughtProvider : ICocoaTextViewCreationListener
+ {
+ public void TextViewCreated (ICocoaTextView textView)
+ {
+ var manager = new ExceptionCaughtAdornmentManager (textView);
+ textView.Closed += (s, e) => manager.Dispose ();
+ }
+
+ [Export]
+ [Name ("ExceptionCaught")]
+ [Order (After = PredefinedAdornmentLayers.Caret)]
+ internal AdornmentLayerDefinition visibleWhitespaceLayer;
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphFactoryProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphFactoryProvider.cs
new file mode 100644
index 0000000000..bd921adafd
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphFactoryProvider.cs
@@ -0,0 +1,104 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+using Microsoft.VisualStudio.Core.Imaging;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (BreakpointGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (BreakpointGlyphTag))]
+ internal class BreakpointGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 324);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<BreakpointGlyphTag> (imageId, imageService);
+ }
+ }
+
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (BreakpointDisabledGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (BreakpointDisabledGlyphTag))]
+ internal class BreakpointDisabledGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 323);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<BreakpointDisabledGlyphTag> (imageId, imageService);
+ }
+ }
+
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (BreakpointInvalidGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (BreakpointInvalidGlyphTag))]
+ internal class BreakpointInvalidGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 327);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<BreakpointInvalidGlyphTag> (imageId, imageService);
+ }
+ }
+
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (TracepointGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (TracepointGlyphTag))]
+ internal class TracepointGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 3175);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<TracepointGlyphTag> (imageId, imageService);
+ }
+ }
+
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (TracepointDisabledGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (TracepointDisabledGlyphTag))]
+ internal class TracepointDisabledGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 3174);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<TracepointDisabledGlyphTag> (imageId, imageService);
+ }
+ }
+
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name (nameof (TracepointInvalidGlyphTag))]
+ [ContentType ("code")]
+ [TagType (typeof (TracepointInvalidGlyphTag))]
+ internal class TracepointInvalidGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 3178);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<TracepointInvalidGlyphTag> (imageId, imageService);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessor.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessor.cs
new file mode 100644
index 0000000000..d356e4b7be
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessor.cs
@@ -0,0 +1,605 @@
+#if MAC
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Threading;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Formatting;
+using Microsoft.VisualStudio.Text.Tagging;
+using AppKit;
+using CoreGraphics;
+using MonoDevelop.Debugger;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Editor;
+
+namespace MonoDevelop.Debugger
+{
+ class BreakpointGlyphMouseProcessor : CocoaMouseProcessorBase
+ {
+ readonly ICocoaTextViewHost textViewHost;
+ ITagAggregator<IGlyphTag> glyphTagAggregator;
+ readonly ICocoaTextViewMargin glyphMargin;
+ readonly IViewPrimitives viewPrimitives;
+ IActiveGlyphDropHandler activeGlyphDropHandler;
+
+ // Tooltip
+ //private readonly Popup popup;
+
+ // Hover members
+ DispatcherTimer mouseHoverTimer = null;
+ ITextViewLine lastHoverPosition;
+ ITextViewLine currentlyHoveringLine;
+
+ // Drag/drop members
+ CGPoint clickLocation;
+ internal bool LastLeftButtonWasDoubleClick = true; // internal for unit testing
+ bool dragOccurred = false;
+
+ // Constants for scrolling tolerance (borrowed from \platform\text\dragdrop\DragDropMouseProcessor.cs).
+ const double VerticalScrollTolerance = 15;
+ const double HorizontalScrollTolerance = 15;
+
+ // Delay before tooltips display
+ const int ToolTipDelayMilliseconds = 150;
+
+ public BreakpointGlyphMouseProcessor (
+ ICocoaTextViewHost wpfTextViewHost,
+ ICocoaTextViewMargin margin,
+ ITagAggregator<IGlyphTag> tagAggregator,
+ IViewPrimitives viewPrimitives)
+ {
+ this.textViewHost = wpfTextViewHost;
+ this.glyphMargin = margin;
+ this.glyphTagAggregator = tagAggregator;
+ this.viewPrimitives = viewPrimitives;
+
+ // Setup the UI
+ //TODO:MAC
+ //popup = new Popup();
+ //popup.IsOpen = false;
+ //popup.Visibility = Visibility.Hidden;
+
+ textViewHost.Closed += delegate {
+ glyphTagAggregator.Dispose ();
+ glyphTagAggregator = null;
+ };
+ }
+
+ public override void PreprocessMouseLeftButtonDown (MouseEvent e)
+ {
+ if ((e.Event.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask) == NSEventModifierMask.ControlKeyMask) {
+ PreprocessMouseRightButtonDown (e);
+ return;
+ }
+
+ // Record click location.
+ clickLocation = GetMouseLocationInTextView (e);
+
+ // We don't handle double-click, and set the flag so that the mouse
+ // up handler doesn't try to handle it as a click either.
+ LastLeftButtonWasDoubleClick = e.Event.ClickCount == 2;
+
+ if (LastLeftButtonWasDoubleClick) {
+ return;
+ }
+
+ // Starts a drag if applicable.
+ HandleDragStart (clickLocation);
+ }
+
+ public override void PreprocessMouseLeftButtonUp (MouseEvent e)
+ {
+ if ((e.Event.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask) == NSEventModifierMask.ControlKeyMask) {
+ PreprocessMouseRightButtonUp (e);
+ return;
+ }
+
+ // Did we successfully drag a glyph?
+ var mouseUpLocation = GetMouseLocationInTextView (e);
+ if (HandleDragEnd (mouseUpLocation)) {
+ e.Handled = true;
+ return;
+ }
+
+ // We don't handle double-click
+ if (LastLeftButtonWasDoubleClick) {
+ return;
+ }
+
+ if (GetTextViewLine (mouseUpLocation.Y) != GetTextViewLine (clickLocation.Y)) {
+ // If the user (probably accidentally) click-dragged to a different line, don't treat it as a click.
+ e.Handled = false;
+ return;
+ }
+
+ // Treat this as a marker click
+ e.Handled = HandleMarkerClick (e);
+ }
+
+ public override void PostprocessMouseRightButtonUp (MouseEvent e)
+ {
+ var mouseUpLocation = GetMouseLocationInTextView (e);
+ var textViewLine = GetTextViewLine (mouseUpLocation.Y);
+ if (!textViewLine.Extent.Contains (textViewHost.TextView.Caret.Position.BufferPosition))
+ textViewHost.TextView.Caret.MoveTo (textViewLine.Start);
+ var view = (ViewContent)textViewHost.TextView.Properties [typeof (ViewContent)];
+ var ctx = view.WorkbenchWindow?.ExtensionContext ?? Mono.Addins.AddinManager.AddinEngine;
+ var cset = IdeApp.CommandService.CreateCommandEntrySet (ctx, "/MonoDevelop/SourceEditor2/IconContextMenu/Editor");
+ var pt = ((NSEvent)e.Event).LocationInWindow;
+ pt = textViewHost.TextView.VisualElement.ConvertPointFromView (pt, null);
+ IdeApp.CommandService.ShowContextMenu (textViewHost.TextView.VisualElement, (int)pt.X, (int)pt.Y, cset, view);
+ }
+
+ public override void PostprocessMouseLeftButtonUp (MouseEvent e)
+ {
+ if ((e.Event.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask) == NSEventModifierMask.ControlKeyMask)
+ PostprocessMouseRightButtonUp (e);
+ }
+
+ public override void PostprocessMouseEnter (MouseEvent e)
+ {
+ EnableToolTips ();
+ }
+
+ public override void PostprocessMouseLeave (MouseEvent e)
+ {
+ DisableToolTips ();
+ }
+
+ public override void PreprocessMouseMove (MouseEvent e)
+ {
+ // If we're dragging a glyph, show proper cursor, scroll the view, etc.
+ var pt = GetMouseLocationInTextView (e);
+ if (HandleDragOver (pt)) {
+ return;
+ }
+
+ ITextViewLine textLine = GetTextViewLine (pt.Y);
+
+ // If we're hovering, make sure we're still hovering over the same line.
+ if (mouseHoverTimer != null) {
+ if (textLine != currentlyHoveringLine) {
+ currentlyHoveringLine = null;
+
+ HideTooltip ();
+ }
+
+ mouseHoverTimer.Start ();
+ }
+
+ // If there's a glyph with a hover mouse cursor, show it.
+ if (textLine != null) {
+ foreach (IInteractiveGlyph textMarkerGlyphTag in GetTextMarkerGlyphTagsStartingOnLine (textLine)) {
+ if (textMarkerGlyphTag.HoverCursor != null) {
+ //TODO:MAC
+ //Mouse.SetCursor(textMarkerGlyphTag.HoverCursor);
+ break;
+ }
+ }
+ }
+ }
+
+ #region Private Drag/Drop Helpers
+
+ // Internal for unit testing.
+ internal void HandleDragStart (CGPoint viewPoint)
+ {
+ Debug.Assert (activeGlyphDropHandler == null);
+ activeGlyphDropHandler = null;
+
+ // Get the ITextViewLine corresponding to the click point.
+ ITextViewLine textLine = GetTextViewLine (viewPoint.Y);
+ if (textLine == null) {
+ return;
+ }
+
+ // Is there a draggable glyph here?
+ IActiveGlyphDropHandler draggableTextMarkerGlyphTag = null;
+ foreach (IInteractiveGlyph textMarkerGlyphTag in GetTextMarkerGlyphTagsStartingOnLine (textLine)) {
+ if (textMarkerGlyphTag.DropHandler != null) {
+ draggableTextMarkerGlyphTag = textMarkerGlyphTag.DropHandler;
+ break;
+ }
+ }
+
+ if (draggableTextMarkerGlyphTag == null) {
+ return;
+ }
+
+ // We have a draggable glyph. Start dragging it!
+ // Store the handler for the glyph being dragged.
+ activeGlyphDropHandler = draggableTextMarkerGlyphTag;
+
+ HideTooltip ();
+
+ dragOccurred = false;
+
+ // Capture mouse events so we catch mouse moves over the entire screen and the mouse up event.
+ // Note: This may trigger an immediate OnMouseMove event, so make sure we do it last.
+ //glyphMargin.VisualElement.CaptureMouse();
+ }
+
+ internal bool HandleDragOver (CGPoint viewPoint)
+ {
+ if (activeGlyphDropHandler == null) {
+ return false; // not dragging
+ }
+
+ if (!dragOccurred) {
+ // if the mouse moved position is less than the system settings for drag start, don't start the
+ // drag operation
+ Vector dragDelta = new Vector (clickLocation.X - viewPoint.X, clickLocation.Y - viewPoint.Y);
+ if (Math.Abs (dragDelta.X) < SystemParameters.MinimumHorizontalDragDistance && Math.Abs (dragDelta.Y) < SystemParameters.MinimumVerticalDragDistance) {
+ return false;
+ }
+
+ // Now that the mouse has moved, this is an actual drag.
+ dragOccurred = true;
+ }
+
+ var (line, column) = GetLineNumberAndColumn (viewPoint);
+
+ // If this line isn't in the data (surface) buffer, we can't use it
+ if (line < 0) {
+ return false;
+ }
+
+ // Query if we can drop here and set mouse cursor appropriately.
+ if (activeGlyphDropHandler.CanDrop (line, column)) {
+ // We can drop here. Use "hand" cursor.
+ //TODO:MAC
+ //Mouse.OverrideCursor = Cursors.Hand;
+ } else {
+ // Can't drop here; change mouse cursor.
+ //TODO:MAC
+ //Mouse.OverrideCursor = Cursors.No;
+ }
+
+ // if the view does not have any focus, grab it
+ if (!textViewHost.TextView.HasAggregateFocus) {
+ textViewHost.TextView.VisualElement.BecomeFirstResponder ();
+ }
+
+ // Position the drag/drop caret and ensure it's visible.
+ ITextViewLine textViewLine = GetTextViewLine (viewPoint.Y);
+ viewPrimitives.Caret.AdvancedCaret.MoveTo (textViewLine, viewPoint.X);
+
+ this.EnsureCaretVisibleWithPadding ();
+
+ return true;
+ }
+
+ void EnsureCaretVisibleWithPadding ()
+ {
+ // ensure caret is visible with a little padding to all sides.
+ ITextViewLine caretLine = viewPrimitives.Caret.AdvancedCaret.ContainingTextViewLine;
+ double padding = Math.Max (0.0, (textViewHost.TextView.ViewportHeight - caretLine.Height) * 0.5);
+
+ // Ensure vertical padding.
+ double topSpace = caretLine.Top - (textViewHost.TextView.ViewportTop + VerticalScrollTolerance);
+ double bottomSpace = (textViewHost.TextView.ViewportBottom - VerticalScrollTolerance) - caretLine.Bottom;
+
+ var outsideTop = topSpace < 0.0;
+ var outsideBottom = bottomSpace < 0.0;
+ if (outsideTop != outsideBottom) {
+ if (outsideTop) {
+ textViewHost.TextView.DisplayTextLineContainingBufferPosition (caretLine.Start, Math.Min (VerticalScrollTolerance, padding), ViewRelativePosition.Top);
+ } else {
+ textViewHost.TextView.DisplayTextLineContainingBufferPosition (caretLine.Start, Math.Min (VerticalScrollTolerance, padding), ViewRelativePosition.Bottom);
+ }
+ }
+
+ // Ensure horizontal padding
+ double leftSpace = viewPrimitives.Caret.AdvancedCaret.Left - (textViewHost.TextView.ViewportLeft + HorizontalScrollTolerance);
+ double rightSpace = (textViewHost.TextView.ViewportRight - HorizontalScrollTolerance) - viewPrimitives.Caret.AdvancedCaret.Right;
+
+ var outsideLeft = leftSpace < 0.0;
+ var outsideRight = rightSpace < 0.0;
+ if (outsideLeft != outsideRight) {
+ if (outsideLeft) {
+ textViewHost.TextView.ViewportLeft = viewPrimitives.Caret.AdvancedCaret.Left - Math.Min (HorizontalScrollTolerance, rightSpace);
+ } else {
+ textViewHost.TextView.ViewportLeft = (viewPrimitives.Caret.AdvancedCaret.Right + Math.Min (HorizontalScrollTolerance, leftSpace)) - textViewHost.TextView.ViewportWidth;
+ }
+ }
+ }
+
+ internal bool HandleDragEnd (CGPoint viewPoint)
+ {
+ // Clean up our dragging state.
+ //glyphMargin.VisualElement.ReleaseMouseCapture();
+ //Mouse.OverrideCursor = null;
+
+ IActiveGlyphDropHandler glyphDropHandler = activeGlyphDropHandler;
+ activeGlyphDropHandler = null;
+
+ // Did we actually do a drag?
+ if (!dragOccurred) {
+ return false;
+ }
+
+ dragOccurred = false;
+
+ if (glyphDropHandler != null) {
+ var (line, column) = GetLineNumberAndColumn (viewPoint);
+
+ // If this line isn't in the data (surface) buffer, we can't use it
+ if (line < 0) {
+ return false;
+ }
+
+ // Query if we can drop here.
+ if (glyphDropHandler.CanDrop (line, column)) {
+ glyphDropHandler.DropAtLocation (line, column);
+ }
+ }
+
+ // Even if we couldn't drop here, we return true to ensure that we don't handle this as a normal click.
+ return true;
+ }
+
+ bool HandleMarkerClick (MouseEvent e)
+ {
+ // Raise MarkerCommandValues.mcvGlyphSingleClickCommand
+ if (ExecuteMarkerCommand (glyphMargin.VisualElement.ConvertPointFromView (e.Event.LocationInWindow, null),
+ GlyphCommandType.SingleClick)) {
+ return true;
+ }
+
+ // Also, make sure that this point in the margin maps to a line/column in the correct buffer. In
+ // certain projection scenarios, this span may not be in the data buffer.
+ var (line, column) = GetLineNumberAndColumn (GetMouseLocationInTextView (e));
+ if (line < 0) {
+ return false;
+ }
+
+ return ToggleBreakpoint (line, column);
+ }
+
+ bool ToggleBreakpoint (int line, int column)
+ {
+ var buffer = textViewHost.TextView.TextBuffer;
+ var path = buffer.GetFilePathOrNull ();
+ if (path == null)
+ return false;
+ DebuggingService.Breakpoints.Toggle (path, line + 1, column + 1);
+ return true;
+ }
+
+ #endregion
+
+ #region Private Helpers
+
+ CGPoint GetMouseLocationInTextView (MouseEvent e)
+ {
+ ICocoaTextView textView = textViewHost.TextView;
+ var pt = textView.VisualElement.ConvertPointFromView (e.Event.LocationInWindow, null);
+ pt.Y += (nfloat)textView.ViewportTop;
+ pt.X += (nfloat)textView.ViewportLeft;
+
+ return pt;
+ }
+
+ ITextViewLine GetTextViewLine (double y)
+ {
+ ICocoaTextView textView = textViewHost.TextView;
+
+ // Establish line for point
+ ITextViewLine textViewLine = textView.TextViewLines.GetTextViewLineContainingYCoordinate (y);
+ if (textViewLine == null) {
+ textViewLine = y <= textView.TextViewLines [0].Top ?
+ textView.TextViewLines.FirstVisibleLine :
+ textView.TextViewLines.LastVisibleLine;
+ }
+
+ return textViewLine;
+ }
+
+ static SnapshotPoint GetBufferPosition (ITextViewLine textViewLine, double x)
+ {
+ SnapshotPoint? bufferPosition = textViewLine.GetBufferPositionFromXCoordinate (x);
+ if (!bufferPosition.HasValue) {
+ bufferPosition = x < textViewLine.TextLeft ? textViewLine.Start : textViewLine.End;
+ }
+
+ return bufferPosition.Value;
+ }
+
+ (int line, int column) GetLineNumberAndColumn (CGPoint viewPoint)
+ {
+ int line = 0;
+ int col = 0;
+
+ ITextViewLine textViewLine = GetTextViewLine (viewPoint.Y);
+ if (textViewLine != null) {
+ // The line number should be the line number in the data buffer,
+ // which is the text buffer adapter's surface buffer
+ var dataSpans = textViewLine.ExtentAsMappingSpan.GetSpans (textViewHost.TextView.TextViewModel.DataBuffer);
+
+ // If this point doesn't map into the data buffer at all, then return line
+ // number of -1 to indicate failure
+ if (dataSpans.Count == 0) {
+ return (-1, -1);
+ }
+
+ line = dataSpans [0].Start.GetContainingLine ().LineNumber;
+ }
+
+ // Establish col for point
+ int bufferPosition = GetBufferPosition (textViewLine, viewPoint.X);
+ col = bufferPosition - textViewLine.Start;
+
+ return (line, col);
+ }
+
+ // Internal for unit testing
+ internal bool ExecuteMarkerCommand (CGPoint pt, GlyphCommandType markerCommand)
+ {
+ bool commandHandled = false;
+
+ pt.Y += (nfloat)textViewHost.TextView.ViewportTop;
+
+ ITextViewLine textLine = textViewHost.TextView.TextViewLines.GetTextViewLineContainingYCoordinate (pt.Y);
+ if (textLine == null) {
+ return commandHandled;
+ }
+
+ // Tags are sorted from low priority to high priority
+ IInteractiveGlyph highestPriorityTag = null;
+ foreach (IInteractiveGlyph textMarkerTag in GetTextMarkerGlyphTagsStartingOnLine (textLine)) {
+ // only consider visible glyph markers.
+ if (textMarkerTag.IsEnabled) {
+ highestPriorityTag = textMarkerTag;
+ }
+ }
+
+ if (highestPriorityTag != null && highestPriorityTag.ExecuteCommand (markerCommand)) {
+ // Only handle the highest priority command
+ commandHandled = true;
+ }
+
+ return commandHandled;
+ }
+
+ void EnableToolTips ()
+ {
+ if (mouseHoverTimer == null) {
+ mouseHoverTimer = new DispatcherTimer (
+ TimeSpan.FromMilliseconds (ToolTipDelayMilliseconds),
+ DispatcherPriority.Normal,
+ OnHoverTimer,
+ Dispatcher.CurrentDispatcher);
+ }
+
+ mouseHoverTimer.Start ();
+ }
+
+ void DisableToolTips ()
+ {
+ if (mouseHoverTimer != null) {
+ mouseHoverTimer.Stop ();
+ }
+
+ HideTooltip ();
+ lastHoverPosition = null;
+ }
+
+ void OnHoverTimer (object sender, EventArgs e)
+ {
+ // It's possible the view was closed before our timer triggered, in which case
+ // _glyphMargin is disposed and we can't touch it.
+ if (textViewHost.IsClosed) {
+ return;
+ }
+
+ if ((NSEvent.CurrentPressedMouseButtons & 1) > 0) {
+ return; // don't show tooltips when button is pressed (e.g. during a drag)
+ }
+ //TODO:MAC, convert mouse location
+ HoverAtPoint (NSEvent.CurrentMouseLocation);
+ }
+
+ // internal for exposure to unit tests
+ internal void HoverAtPoint (CGPoint pt)
+ {
+ // The HoverAtPoint calls get dispatched to the UI thread and you can imagine rare scenarios where
+ // either multiple calls get queued up (and, possibly, execute after the view has lost focus and
+ // the mouse hover has been disabled). Only execute if we still have a running mouse timer.
+ if ((mouseHoverTimer != null) && mouseHoverTimer.IsEnabled && glyphMargin.Enabled && !dragOccurred) {
+ ITextViewLine textLine = textViewHost.TextView.TextViewLines.GetTextViewLineContainingYCoordinate (pt.Y + textViewHost.TextView.ViewportTop);
+ if (textLine != lastHoverPosition) {
+ lastHoverPosition = textLine;
+
+ // Get textmarkers
+ if (textLine != null) {
+ // Tags are returned in lowest to highest priority order
+ // Keep track of highest priority tip text
+ string tipText = null;
+ foreach (IInteractiveGlyph textMarkerGlyphTag in GetTextMarkerGlyphTagsStartingOnLine (textLine)) {
+ tipText = textMarkerGlyphTag.TooltipText;
+ }
+ //TODO:MAC
+ //if (!string.IsNullOrEmpty(tipText))
+ //{
+ // popup.Child = null;
+
+ // TextBlock textBlock = new TextBlock();
+ // textBlock.Text = tipText;
+ // textBlock.Name = "GlyphToolTip";
+
+ // Border border = new Border();
+ // border.Padding = new Thickness(1);
+ // border.BorderThickness = new Thickness(1);
+ // border.Child = textBlock;
+
+ // // set colors of the tooltip to shell's defined colors
+ // textBlock.SetResourceReference(TextBlock.ForegroundProperty, "VsBrush.ScreenTipText");
+ // border.SetResourceReference(Border.BorderBrushProperty, "VsBrush.ScreenTipBorder");
+ // border.SetResourceReference(Border.BackgroundProperty, "VsBrush.ScreenTipBackground");
+
+ // popup.Child = border;
+ // popup.Placement = PlacementMode.Relative;
+ // popup.PlacementTarget = glyphMargin.VisualElement;
+ // popup.HorizontalOffset = 0.0;
+ // popup.VerticalOffset = textLine.Bottom - textViewHost.TextView.ViewportTop;
+ // popup.IsOpen = true;
+ // popup.Visibility = Visibility.Visible;
+
+ // currentlyHoveringLine = textLine;
+ //}
+ }
+ }
+ }
+ }
+
+ void HideTooltip ()
+ {
+ //TODO:MAC
+ //popup.Child = null;
+ //popup.IsOpen = false;
+ //popup.Visibility = Visibility.Hidden;
+ }
+
+ // helper method to get the text marker tags starting on a line.
+ IEnumerable<IInteractiveGlyph> GetTextMarkerGlyphTagsStartingOnLine (ITextViewLine textViewLine)
+ {
+ var visualBuffer = textViewHost.TextView.TextViewModel.VisualBuffer;
+ var editBuffer = textViewHost.TextView.TextBuffer;
+
+ // Tags are sorted from low priority to high priority
+ foreach (var mappingTagSpan in glyphTagAggregator.GetTags (textViewLine.ExtentAsMappingSpan)) {
+ // Only take tag spans with a visible start point and that map to something
+ // in the edit buffer, and the markers that *start* on this line
+
+ IInteractiveGlyph textMarkerGlyphTag = mappingTagSpan.Tag as IInteractiveGlyph;
+
+ if (textMarkerGlyphTag == null) {
+ continue;
+ }
+
+ SnapshotPoint? pointInVisualBuffer = mappingTagSpan.Span.Start.GetPoint (
+ visualBuffer,
+ PositionAffinity.Predecessor);
+ SnapshotPoint? pointInEditBuffer = mappingTagSpan.Span.Start.GetPoint (
+ editBuffer,
+ PositionAffinity.Predecessor);
+
+ if (!(pointInVisualBuffer.HasValue && pointInEditBuffer.HasValue)) {
+ continue;
+ }
+
+ if (pointInEditBuffer.Value >= textViewLine.Start &&
+ pointInEditBuffer.Value <= textViewLine.End) {
+ yield return textMarkerGlyphTag;
+ }
+ }
+ }
+
+ #endregion
+ }
+}
+#endif \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessorProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessorProvider.cs
new file mode 100644
index 0000000000..afd57b957c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphMouseProcessorProvider.cs
@@ -0,0 +1,33 @@
+#if MAC
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IGlyphMouseProcessorProvider))]
+ [Name ("BreakpointGlyphMouseProcessorProvider")]
+ [Order]
+ [ContentType ("any")]
+ class BreakpointGlyphMouseProcessorProvider : IGlyphMouseProcessorProvider
+ {
+ [Import]
+ private IViewTagAggregatorFactoryService viewTagAggregatorService = null;
+
+ [Import]
+ private IEditorPrimitivesFactoryService editorPrimitivesFactoryService = null;
+
+ public ICocoaMouseProcessor GetAssociatedMouseProcessor (
+ ICocoaTextViewHost wpfTextViewHost,
+ ICocoaTextViewMargin margin)
+ {
+ return new BreakpointGlyphMouseProcessor (
+ wpfTextViewHost,
+ margin,
+ viewTagAggregatorService.CreateTagAggregator<IGlyphTag> (wpfTextViewHost.TextView),
+ editorPrimitivesFactoryService.GetViewPrimitives (wpfTextViewHost.TextView));
+ }
+ }
+}
+#endif \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTag.cs
new file mode 100644
index 0000000000..577462318e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTag.cs
@@ -0,0 +1,88 @@
+using System.Windows.Input;
+using Microsoft.VisualStudio.Text.Editor;
+using Mono.Debugging.Client;
+using MonoDevelop.Debugger;
+using MonoDevelop.Ide.Gui;
+
+namespace MonoDevelop.Debugger
+{
+ class BreakpointGlyphTag : BaseBreakpointGlyphTag
+ {
+ public BreakpointGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+ class BreakpointDisabledGlyphTag : BaseBreakpointGlyphTag
+ {
+ public BreakpointDisabledGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+ class BreakpointInvalidGlyphTag : BaseBreakpointGlyphTag
+ {
+ public BreakpointInvalidGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+ class TracepointGlyphTag : BaseBreakpointGlyphTag
+ {
+ public TracepointGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+ class TracepointDisabledGlyphTag : BaseBreakpointGlyphTag
+ {
+ public TracepointDisabledGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+ class TracepointInvalidGlyphTag : BaseBreakpointGlyphTag
+ {
+ public TracepointInvalidGlyphTag (BreakEvent breakpoint) : base (breakpoint)
+ {
+ }
+ }
+
+ abstract class BaseBreakpointGlyphTag : IGlyphTag, IInteractiveGlyph
+ {
+ private readonly BreakEvent breakpoint;
+
+ public BaseBreakpointGlyphTag (BreakEvent breakpoint)
+ {
+ this.breakpoint = breakpoint;
+ }
+
+ public object HoverCursor {
+ get {
+ return null;
+ }
+ }
+
+ public IActiveGlyphDropHandler DropHandler {
+ get {
+ return null;
+ }
+ }
+
+ public bool IsEnabled {
+ get {
+ return true;
+ }
+ }
+
+ public bool ExecuteCommand (GlyphCommandType markerCommand)
+ {
+ if (markerCommand == GlyphCommandType.SingleClick) {
+ DebuggingService.Breakpoints.Remove (breakpoint);
+ return true;
+ }
+ return false;
+ }
+
+ public string TooltipText {
+ get {
+ return null;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTagger.cs
new file mode 100644
index 0000000000..79f4d9c750
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTagger.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Mono.Debugging.Client;
+using MonoDevelop.Debugger;
+
+namespace MonoDevelop.Debugger
+{
+ internal class BreakpointGlyphTagger : ITagger<BaseBreakpointGlyphTag>
+ {
+ private readonly ITextView textView;
+ private readonly ITextDocumentFactoryService textDocumentFactoryService;
+ readonly BreakpointManager breakpointManager;
+
+ public BreakpointGlyphTagger (ITextDocumentFactoryService textDocumentFactoryService, ITextView textView, BreakpointManager breakpointManager)
+ {
+ this.breakpointManager = breakpointManager;
+ this.textView = textView;
+ this.textDocumentFactoryService = textDocumentFactoryService;
+ breakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
+ this.textView.Closed += (s, e) => this.breakpointManager.BreakpointsChanged -= BreakpointManager_BreakpointsChanged;
+ }
+
+ void BreakpointManager_BreakpointsChanged (object sender, SnapshotSpanEventArgs e)
+ {
+ TagsChanged?.Invoke (this, e);
+ }
+
+ public IEnumerable<ITagSpan<BaseBreakpointGlyphTag>> GetTags (NormalizedSnapshotSpanCollection spans)
+ {
+ foreach (var breakpointTag in breakpointManager.GetBreakpoints(spans[0].Snapshot)) {
+ var span= breakpointTag.Span;
+ if (spans.IntersectsWith (span)) {
+ var breakpoint = breakpointTag.Breakpoint;
+ bool tracepoint = (breakpoint.HitAction & HitAction.Break) == HitAction.None;
+ if (breakpoint.Enabled) {
+ var status = DebuggingService.GetBreakpointStatus (breakpoint);
+ if (status == BreakEventStatus.Bound || status == BreakEventStatus.Disconnected) {
+ if (tracepoint)
+ yield return new TagSpan<TracepointGlyphTag> (span, new TracepointGlyphTag (breakpoint));
+ else
+ yield return new TagSpan<BreakpointGlyphTag> (span, new BreakpointGlyphTag (breakpoint));
+ } else {
+ if (tracepoint)
+ yield return new TagSpan<TracepointInvalidGlyphTag> (span, new TracepointInvalidGlyphTag (breakpoint));
+ else
+ yield return new TagSpan<BreakpointInvalidGlyphTag> (span, new BreakpointInvalidGlyphTag (breakpoint));
+ }
+ } else {
+ if (tracepoint)
+ yield return new TagSpan<TracepointDisabledGlyphTag> (span, new TracepointDisabledGlyphTag (breakpoint));
+ else
+ yield return new TagSpan<BreakpointDisabledGlyphTag> (span, new BreakpointDisabledGlyphTag (breakpoint));
+ }
+ }
+ }
+ }
+
+ public event System.EventHandler<SnapshotSpanEventArgs> TagsChanged;
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTaggerProvider.cs
new file mode 100644
index 0000000000..a3dfff7262
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/BreakpointGlyphTaggerProvider.cs
@@ -0,0 +1,27 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("code")]
+ [TagType (typeof (BreakpointGlyphTag))]
+ [TagType (typeof (BreakpointDisabledGlyphTag))]
+ [TagType (typeof (BreakpointInvalidGlyphTag))]
+ [TagType (typeof (TracepointGlyphTag))]
+ [TagType (typeof (TracepointDisabledGlyphTag))]
+ [TagType (typeof (TracepointInvalidGlyphTag))]
+ internal class BreakpointGlyphTaggerProvider : IViewTaggerProvider
+ {
+ [Import]
+ public ITextDocumentFactoryService TextDocumentFactoryService { get; set; }
+
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new BreakpointGlyphTagger (TextDocumentFactoryService, textView, BreakpointManagerService.GetBreakpointManager (textView)) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphFactoryProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphFactoryProvider.cs
new file mode 100644
index 0000000000..20468fd6ae
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphFactoryProvider.cs
@@ -0,0 +1,25 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Core.Imaging;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name ("CurrentStatementGlyph")]
+ [Order (After = "BreakpointGlyph")]
+ [ContentType ("code")]
+ [TagType (typeof (CurrentStatementGlyphTag))]
+ internal class CurrentStatementGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 807);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<CurrentStatementGlyphTag> (imageId, imageService);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTag.cs
new file mode 100644
index 0000000000..58d596e087
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTag.cs
@@ -0,0 +1,9 @@
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Debugger
+{
+ internal class CurrentStatementGlyphTag : IGlyphTag
+ {
+ public static readonly CurrentStatementGlyphTag Instance = new CurrentStatementGlyphTag ();
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTagger.cs
new file mode 100644
index 0000000000..9f0874cbea
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTagger.cs
@@ -0,0 +1,12 @@
+using Microsoft.VisualStudio.Text;
+
+namespace MonoDevelop.Debugger
+{
+ internal class CurrentStatementGlyphTagger : AbstractCurrentStatementTagger<CurrentStatementGlyphTag>
+ {
+ public CurrentStatementGlyphTagger (ITextBuffer textBuffer)
+ : base (CurrentStatementGlyphTag.Instance, textBuffer, isGreen: false)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTaggerProvider.cs
new file mode 100644
index 0000000000..bfa1425db7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/CurrentStatementGlyphTaggerProvider.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("code")]
+ [TagType (typeof (CurrentStatementGlyphTag))]
+ internal class CurrentStatementGlyphTaggerProvider : IViewTaggerProvider
+ {
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new CurrentStatementGlyphTagger (buffer) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/GlyphCommandType.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/GlyphCommandType.cs
new file mode 100644
index 0000000000..6dd9dd8095
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/GlyphCommandType.cs
@@ -0,0 +1,8 @@
+namespace MonoDevelop.Debugger
+{
+ public enum GlyphCommandType
+ {
+ SingleClick,
+ RightClick
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IActiveGlyphDropHandler.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IActiveGlyphDropHandler.cs
new file mode 100644
index 0000000000..1d97a3f43e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IActiveGlyphDropHandler.cs
@@ -0,0 +1,8 @@
+namespace MonoDevelop.Debugger
+{
+ interface IActiveGlyphDropHandler
+ {
+ bool CanDrop (int line, int column);
+ void DropAtLocation (int line, int column);
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IInteractiveGlyph.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IInteractiveGlyph.cs
new file mode 100644
index 0000000000..b92f7eb799
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/IInteractiveGlyph.cs
@@ -0,0 +1,11 @@
+namespace MonoDevelop.Debugger
+{
+ interface IInteractiveGlyph
+ {
+ object HoverCursor { get; }
+ IActiveGlyphDropHandler DropHandler { get; }
+ bool IsEnabled { get; }
+ bool ExecuteCommand (GlyphCommandType markerCommand);
+ string TooltipText { get; }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ImageSourceGlyphFactory.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ImageSourceGlyphFactory.cs
new file mode 100644
index 0000000000..6ad790b390
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ImageSourceGlyphFactory.cs
@@ -0,0 +1,39 @@
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Formatting;
+using Microsoft.VisualStudio.Core.Imaging;
+using MonoDevelop.Ide;
+using System;
+
+namespace MonoDevelop.Debugger
+{
+ class ImageSourceGlyphFactory<T> : IGlyphFactory
+ where T : IGlyphTag
+ {
+ private readonly ImageId imageId;
+ readonly IImageService imageService;
+#if MAC
+ private AppKit.NSImage nsImageCache;
+#endif
+ public ImageSourceGlyphFactory (ImageId imageId, IImageService imageService)
+ {
+ this.imageId = imageId;
+ this.imageService = imageService;
+ }
+
+ public object GenerateGlyph (ITextViewLine line, IGlyphTag tag)
+ {
+ if (!(tag is T)) {
+ return null;
+ }
+#if MAC
+ if (nsImageCache == null)
+ nsImageCache = (AppKit.NSImage)imageService.GetImage (imageId);
+ var imageView = AppKit.NSImageView.FromImage (nsImageCache);
+ imageView.SetFrameSize (imageView.FittingSize);
+ return imageView;
+#else
+ throw new NotImplementedException ();
+#endif
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphFactoryProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphFactoryProvider.cs
new file mode 100644
index 0000000000..ea8ed82664
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphFactoryProvider.cs
@@ -0,0 +1,25 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Core.Imaging;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IGlyphFactoryProvider))]
+ [Name ("ReturnStatementGlyph")]
+ [Order (After = "CurrentStatementGlyph")]
+ [ContentType ("code")]
+ [TagType (typeof (ReturnStatementGlyphTag))]
+ internal class ReturnStatementGlyphFactoryProvider : IGlyphFactoryProvider
+ {
+ [Import]
+ private IImageService imageService = null;
+ private readonly ImageId imageId = new ImageId (new System.Guid ("{ae27a6b0-e345-4288-96df-5eaf394ee369}"), 386);
+
+ public IGlyphFactory GetGlyphFactory (ICocoaTextView view, ICocoaTextViewMargin margin)
+ {
+ return new ImageSourceGlyphFactory<ReturnStatementGlyphTag> (imageId, imageService);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTag.cs
new file mode 100644
index 0000000000..796d6e6341
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTag.cs
@@ -0,0 +1,9 @@
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Debugger
+{
+ internal class ReturnStatementGlyphTag : IGlyphTag
+ {
+ public static readonly ReturnStatementGlyphTag Instance = new ReturnStatementGlyphTag ();
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTagger.cs
new file mode 100644
index 0000000000..14a8782866
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTagger.cs
@@ -0,0 +1,12 @@
+using Microsoft.VisualStudio.Text;
+
+namespace MonoDevelop.Debugger
+{
+ internal class ReturnStatementGlyphTagger : AbstractCurrentStatementTagger<ReturnStatementGlyphTag>
+ {
+ public ReturnStatementGlyphTagger (ITextBuffer textBuffer)
+ : base (ReturnStatementGlyphTag.Instance, textBuffer, isGreen: true)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTaggerProvider.cs
new file mode 100644
index 0000000000..7ce5db1223
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Glyphs/ReturnStatementGlyphTaggerProvider.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("code")]
+ [TagType (typeof (ReturnStatementGlyphTag))]
+ internal class ReturnStatementGlyphTaggerProvider : IViewTaggerProvider
+ {
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new ReturnStatementGlyphTagger (buffer) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSource.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSource.cs
new file mode 100644
index 0000000000..d490f25922
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSource.cs
@@ -0,0 +1,175 @@
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Language.Intellisense;
+using Microsoft.VisualStudio.Text;
+using MonoDevelop.Core;
+using Microsoft.VisualStudio.Text.Editor;
+using Gtk;
+
+namespace MonoDevelop.Debugger.VSTextView.QuickInfo
+{
+ class DebuggerQuickInfoSource : IAsyncQuickInfoSource
+ {
+ readonly DebuggerQuickInfoSourceProvider provider;
+ readonly ITextBuffer textBuffer;
+ DebugValueWindow window;
+ ITextView lastView;
+
+ public DebuggerQuickInfoSource (DebuggerQuickInfoSourceProvider provider, ITextBuffer textBuffer)
+ {
+ this.provider = provider;
+ this.textBuffer = textBuffer;
+ DebuggingService.CurrentFrameChanged += CurrentFrameChanged;
+ DebuggingService.StoppedEvent += TargetProcessExited;
+
+ }
+
+ void CurrentFrameChanged (object sender, EventArgs e)
+ {
+ if (window != null) {
+ window.Destroy ();
+ window = null;
+ }
+ }
+
+ void TargetProcessExited (object sender, EventArgs e)
+ {
+ if (window == null)
+ return;
+ var debuggerSession = window.Tree.Frame?.DebuggerSession;
+ if (debuggerSession == null || debuggerSession == sender) {
+ window.Destroy ();
+ window = null;
+ }
+ }
+
+ public void Dispose ()
+ {
+ DebuggingService.CurrentFrameChanged -= CurrentFrameChanged;
+ DebuggingService.StoppedEvent -= TargetProcessExited;
+ Runtime.RunInMainThread (DestroyWindow).Ignore ();
+ }
+
+ static async Task<bool> WaitOneAsync (WaitHandle handle, CancellationToken cancellationToken)
+ {
+ RegisteredWaitHandle registeredHandle = null;
+ var tokenRegistration = default (CancellationTokenRegistration);
+ try {
+ var tcs = new TaskCompletionSource<bool> ();
+ registeredHandle = ThreadPool.RegisterWaitForSingleObject (
+ handle,
+ (state, timedOut) => ((TaskCompletionSource<bool>)state).TrySetResult (!timedOut),
+ tcs,
+ int.MaxValue,
+ true);
+ tokenRegistration = cancellationToken.Register (
+ state => ((TaskCompletionSource<bool>)state).TrySetCanceled (),
+ tcs);
+ return await tcs.Task;
+ } finally {
+ if (registeredHandle != null)
+ registeredHandle.Unregister (null);
+ tokenRegistration.Dispose ();
+ }
+ }
+
+ public async Task<QuickInfoItem> GetQuickInfoItemAsync (IAsyncQuickInfoSession session, CancellationToken cancellationToken)
+ {
+ if (DebuggingService.CurrentFrame == null)
+ return null;
+ if (window != null)
+ await Runtime.RunInMainThread (DestroyWindow);
+ var view = session.TextView;
+
+ var textViewLines = view.TextViewLines;
+ var snapshot = textViewLines.FormattedSpan.Snapshot;
+ var triggerPoint = session.GetTriggerPoint (textBuffer);
+ var point = triggerPoint.GetPoint (snapshot);
+
+ foreach (var debugInfoProvider in provider.debugInfoProviders) {
+ var debugInfo = await debugInfoProvider.Value.GetDebugInfoAsync (point, cancellationToken);
+ if (debugInfo.Text == null) {
+ continue;
+ }
+
+ var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ options.AllowMethodEvaluation = true;
+ options.AllowTargetInvoke = true;
+
+ var val = DebuggingService.CurrentFrame.GetExpressionValue (debugInfo.Text, options);
+
+ if (val.IsEvaluating)
+ await WaitOneAsync (val.WaitHandle, cancellationToken);
+ if (cancellationToken.IsCancellationRequested)
+ return null;
+ if (val == null || val.IsUnknown || val.IsNotSupported || val.IsError)
+ return null;
+
+ if (!view.Properties.TryGetProperty (typeof (Gtk.Widget), out Gtk.Widget gtkParent))
+ return null;
+ provider.textDocumentFactoryService.TryGetTextDocument (textBuffer, out var textDocument);
+
+ // This is a bit hacky, since AsyncQuickInfo is designed to display multiple elements if multiple sources
+ // return value, we don't want that for debugger value hovering, hence we dismiss AsyncQuickInfo
+ // and do our own thing, notice VS does same thing
+ await session.DismissAsync ();
+ await provider.joinableTaskContext.Factory.SwitchToMainThreadAsync ();
+ this.lastView = view;
+ val.Name = debugInfo.Text;
+ window = new DebugValueWindow ((Gtk.Window)gtkParent.Toplevel, textDocument?.FilePath, textBuffer.CurrentSnapshot.GetLineNumberFromPosition (debugInfo.Span.GetStartPoint (textBuffer.CurrentSnapshot)), DebuggingService.CurrentFrame, val, null);
+ Ide.IdeApp.CommandService.RegisterTopWindow (window);
+ var bounds = view.TextViewLines.GetCharacterBounds (point);
+ view.LostAggregateFocus += DestroyWindow;
+ view.LayoutChanged += LayoutChanged;
+ window.LeaveNotifyEvent += LeaveNotifyEvent;
+#if MAC
+ var cocoaView = ((ICocoaTextView)view);
+ var cgPoint = cocoaView.VisualElement.ConvertPointToView (new CoreGraphics.CGPoint (bounds.Left - view.ViewportLeft, bounds.Top - view.ViewportTop), cocoaView.VisualElement.Superview);
+ cgPoint.Y = cocoaView.VisualElement.Superview.Frame.Height - cgPoint.Y;
+ window.ShowPopup (gtkParent, new Gdk.Rectangle ((int)cgPoint.X, (int)cgPoint.Y, (int)bounds.Width, (int)bounds.Height), Components.PopupPosition.TopLeft);
+#else
+ throw new NotImplementedException ();
+#endif
+ return null;
+ }
+ return null;
+ }
+
+ private void LayoutChanged (object sender, TextViewLayoutChangedEventArgs e)
+ {
+ if (e.OldViewState.ViewportLeft != e.NewViewState.ViewportLeft ||
+ e.OldViewState.ViewportWidth != e.NewViewState.ViewportWidth ||
+ e.OldViewState.ViewportTop != e.NewViewState.ViewportTop ||
+ e.OldViewState.ViewportHeight != e.NewViewState.ViewportHeight)
+ DestroyWindow ();
+ }
+
+ private void LeaveNotifyEvent (object o, LeaveNotifyEventArgs args)
+ {
+ if(args.Event.Detail != Gdk.NotifyType.Nonlinear)
+ return;
+ DestroyWindow ();
+ }
+
+ void DestroyWindow(object sender, EventArgs args)
+ {
+ DestroyWindow ();
+ }
+
+ void DestroyWindow ()
+ {
+ Runtime.AssertMainThread ();
+ if (window != null) {
+ window.Destroy ();
+ window.LeaveNotifyEvent -= LeaveNotifyEvent;
+ window = null;
+ }
+ if (lastView != null) {
+ lastView.LayoutChanged -= LayoutChanged;
+ lastView.LostAggregateFocus -= DestroyWindow;
+ lastView = null;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSourceProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSourceProvider.cs
new file mode 100644
index 0000000000..4eb135299f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/DebuggerQuickInfoSourceProvider.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Language.Intellisense;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Threading;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger.VSTextView.QuickInfo
+{
+ [Export (typeof (IAsyncQuickInfoSourceProvider))]
+ [Name ("MonodevelopDebugger")]
+ [Order]
+ [ContentType ("any")]
+ class DebuggerQuickInfoSourceProvider : IAsyncQuickInfoSourceProvider
+ {
+ [ImportMany]
+ internal IEnumerable<Lazy<IDebugInfoProvider>> debugInfoProviders = null;
+
+ [Import]
+ internal ITextDocumentFactoryService textDocumentFactoryService { get; set; }
+
+ [Import]
+ internal JoinableTaskContext joinableTaskContext;
+
+ public IAsyncQuickInfoSource TryCreateQuickInfoSource (ITextBuffer textBuffer)
+ {
+ return new DebuggerQuickInfoSource (this, textBuffer);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/IDebugInfoProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/IDebugInfoProvider.cs
new file mode 100644
index 0000000000..308225e4d0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/QuickInfo/IDebugInfoProvider.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Text;
+using System.Threading;
+
+namespace MonoDevelop.Debugger.VSTextView.QuickInfo
+{
+ public interface IDebugInfoProvider
+ {
+ Task<DataTipInfo> GetDebugInfoAsync (SnapshotPoint snapshotPoint, CancellationToken cancellationToken);
+ }
+
+ public struct DataTipInfo
+ {
+ public readonly ITrackingSpan Span;
+ public readonly string Text;
+
+ public DataTipInfo (ITrackingSpan span, string text)
+ {
+ this.Span = span;
+ this.Text = text;
+ }
+
+ public bool IsDefault {
+ get { return Span == null && Text == null; }
+ }
+
+ public override string ToString () => $"{Span} {Text}";
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractBreakpointTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractBreakpointTagger.cs
new file mode 100644
index 0000000000..98e3506731
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractBreakpointTagger.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Mono.Debugging.Client;
+using MonoDevelop.Debugger;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.Debugger
+{
+ internal abstract class AbstractBreakpointTagger<T> : ITagger<T> where T : ITag
+ {
+ private readonly ITextView textView;
+ private readonly T tag;
+ private readonly T disabled;
+ private readonly T invalid;
+ readonly BreakpointManager breakpointManager;
+
+ public AbstractBreakpointTagger (
+ T tag, T disabled, T invalid, ITextView textView, BreakpointManager breakpointManager)
+ {
+ this.breakpointManager = breakpointManager;
+ this.textView = textView;
+ this.tag = tag;
+ this.disabled = disabled;
+ this.invalid = invalid;
+ breakpointManager.BreakpointsChanged += BreakpointManager_BreakpointsChanged;
+ this.textView.Closed += (s, e) => this.breakpointManager.BreakpointsChanged -= BreakpointManager_BreakpointsChanged;
+ }
+
+ void BreakpointManager_BreakpointsChanged (object sender, SnapshotSpanEventArgs e)
+ {
+ TagsChanged?.Invoke (this, e);
+ }
+
+
+
+ public IEnumerable<ITagSpan<T>> GetTags (NormalizedSnapshotSpanCollection spans)
+ {
+ foreach (var breakpointTag in breakpointManager.GetBreakpoints(spans[0].Snapshot)) {
+ var span = breakpointTag.Span;
+ if (spans.IntersectsWith (span)) {
+ var breakpoint = breakpointTag.Breakpoint;
+ var status = DebuggingService.GetBreakpointStatus (breakpoint);
+ if (breakpoint.Enabled)
+ if (status == BreakEventStatus.Bound || status == BreakEventStatus.Disconnected)
+ yield return new TagSpan<T> (span, tag);
+ else
+ yield return new TagSpan<T> (span, invalid);
+ else
+ yield return new TagSpan<T> (span, disabled);
+
+ }
+
+ }
+ }
+
+ public event System.EventHandler<SnapshotSpanEventArgs> TagsChanged;
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs
new file mode 100644
index 0000000000..db3cc43c7c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/AbstractCurrentStatementTagger.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Tagging;
+using MonoDevelop.Debugger;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide;
+using Mono.Debugging.Client;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Debugger
+{
+ internal class AbstractCurrentStatementTagger<T> : ITagger<T>, IDisposable
+ where T : ITag
+ {
+ private readonly ITextBuffer textBuffer;
+ private readonly T tag;
+ private readonly string filePath;
+ private readonly bool isGreen;
+ private ITextSnapshot snapshotAtStartOfDebugging;
+
+ public AbstractCurrentStatementTagger (T tag, ITextBuffer textBuffer, bool isGreen)
+ {
+ this.textBuffer = textBuffer;
+ this.snapshotAtStartOfDebugging = textBuffer.CurrentSnapshot;
+ this.filePath = textBuffer.GetFilePathOrNull ();
+ this.tag = tag;
+ this.isGreen = isGreen;
+ DebuggingService.CurrentFrameChanged += OnDebuggerCurrentStatementChanged;
+ DebuggingService.ExecutionLocationChanged += OnDebuggerCurrentStatementChanged;
+ DebuggingService.DebugSessionStarted += OnDebugSessionStarted;
+ }
+
+ private void OnDebugSessionStarted (object sender, EventArgs e)
+ {
+ snapshotAtStartOfDebugging = textBuffer.CurrentSnapshot;
+ }
+
+ private void OnDebuggerCurrentStatementChanged (object sender, EventArgs eventArgs)
+ {
+ var handler = TagsChanged;
+ if (handler != null) {
+ var snapshot = textBuffer.CurrentSnapshot;
+ var snapshotSpan = new SnapshotSpan (snapshot, 0, snapshot.Length);
+ var args = new SnapshotSpanEventArgs (snapshotSpan);
+ handler (this, args);
+ }
+ }
+
+ public IEnumerable<ITagSpan<T>> GetTags (NormalizedSnapshotSpanCollection spans)
+ {
+ if (!DebuggingService.IsPaused)
+ yield break;
+ if (isGreen) {
+ if (DebuggingService.CurrentFrameIndex > 0) {
+ var newTag = CreateTag ();
+ if (newTag != null && spans.IntersectsWith (newTag.Span))
+ yield return newTag;
+ }
+ } else {
+ if (DebuggingService.CurrentFrameIndex == 0) {
+ var newTag = CreateTag ();
+ if (newTag != null && spans.IntersectsWith (newTag.Span))
+ yield return newTag;
+ }
+ }
+ }
+
+ SourceLocation CheckLocationIsInFile (SourceLocation location)
+ {
+ if (!string.IsNullOrEmpty (filePath) && location != null && !string.IsNullOrEmpty (location.FileName)
+ && ((FilePath)location.FileName).FullPath == ((FilePath)filePath).FullPath)
+ return location;
+ return null;
+ }
+
+ private TagSpan<T> CreateTag ()
+ {
+ var sourceLocation = CheckLocationIsInFile (DebuggingService.NextStatementLocation)
+ ?? CheckLocationIsInFile (DebuggingService.CurrentFrame?.SourceLocation)
+ ?? CheckLocationIsInFile (DebuggingService.GetCurrentVisibleFrame ()?.SourceLocation);
+ if (sourceLocation == null)
+ return null;
+ var span = snapshotAtStartOfDebugging.SpanFromMDColumnAndLine (sourceLocation.Line, sourceLocation.Column, sourceLocation.EndLine, sourceLocation.EndColumn);
+ var translatedSpan = span.TranslateTo (textBuffer.CurrentSnapshot, SpanTrackingMode.EdgeExclusive);
+ return new TagSpan<T> (translatedSpan, tag);
+ }
+
+ public void Dispose ()
+ {
+ DebuggingService.CurrentFrameChanged -= OnDebuggerCurrentStatementChanged;
+ DebuggingService.ExecutionLocationChanged -= OnDebuggerCurrentStatementChanged;
+ DebuggingService.DebugSessionStarted -= OnDebugSessionStarted;
+ }
+
+ public event System.EventHandler<SnapshotSpanEventArgs> TagsChanged;
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTagger.cs
new file mode 100644
index 0000000000..a2ff5de855
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTagger.cs
@@ -0,0 +1,18 @@
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ internal class BreakpointForegroundTagger : AbstractBreakpointTagger<ClassificationTag>
+ {
+ public BreakpointForegroundTagger (
+ ClassificationTag tag,
+ ClassificationTag disabled,
+ ClassificationTag invalid,
+ ITextView textView,
+ BreakpointManager breakpointManager)
+ : base (tag, disabled, invalid, textView, breakpointManager)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTaggerProvider.cs
new file mode 100644
index 0000000000..801da2bdff
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointForegroundTaggerProvider.cs
@@ -0,0 +1,32 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [TagType (typeof (IClassificationTag))]
+ [ContentType ("text")]
+ class BreakpointForegroundTaggerProvider : IViewTaggerProvider
+ {
+ private readonly ClassificationTag tag;
+ private readonly ClassificationTag disabled;
+ private readonly ClassificationTag invalid;
+
+ [ImportingConstructor]
+ public BreakpointForegroundTaggerProvider (IClassificationTypeRegistryService classificationTypeRegistryService)
+ {
+ tag = new ClassificationTag (classificationTypeRegistryService.GetClassificationType (ClassificationTypes.BreakpointForegroundTypeName));
+ disabled = new ClassificationTag (classificationTypeRegistryService.GetClassificationType (ClassificationTypes.BreakpointDisabledForegroundTypeName));
+ invalid = new ClassificationTag (classificationTypeRegistryService.GetClassificationType (ClassificationTypes.BreakpointInvalidForegroundTypeName));
+ }
+
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new BreakpointForegroundTagger (tag, disabled, invalid, textView, BreakpointManagerService.GetBreakpointManager(textView)) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointMarkerDefinition.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointMarkerDefinition.cs
new file mode 100644
index 0000000000..21176ceefb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointMarkerDefinition.cs
@@ -0,0 +1,21 @@
+using System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (EditorFormatDefinition))]
+ [Name (BreakpointTag.TagId)]
+ [UserVisible (true)]
+ [Priority (1)] // necessary to override the standard one from TextMarkerProviderFactory.cs
+ internal class BreakpointMarkerDefinition : MarkerFormatDefinition
+ {
+ public BreakpointMarkerDefinition ()
+ {
+ this.ZOrder = 2;
+ this.Fill = new SolidColorBrush (Color.FromArgb (204, 150, 58, 70));
+ this.Fill.Freeze ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTag.cs
new file mode 100644
index 0000000000..ea29de1367
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTag.cs
@@ -0,0 +1,40 @@
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ class BreakpointTag : TextMarkerTag
+ {
+ internal const string TagId = "breakpoint";
+
+ public static readonly BreakpointTag Instance = new BreakpointTag ();
+
+ private BreakpointTag ()
+ : base (TagId)
+ {
+ }
+ }
+
+ class BreakpointDisabledTag : TextMarkerTag
+ {
+ internal const string TagId = "breakpoint-disabled";
+
+ public static readonly BreakpointDisabledTag Instance = new BreakpointDisabledTag ();
+
+ private BreakpointDisabledTag ()
+ : base (TagId)
+ {
+ }
+ }
+
+ class BreakpointInvalidTag : TextMarkerTag
+ {
+ internal const string TagId = "breakpoint-invalid";
+
+ public static readonly BreakpointInvalidTag Instance = new BreakpointInvalidTag ();
+
+ private BreakpointInvalidTag ()
+ : base (TagId)
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTagger.cs
new file mode 100644
index 0000000000..2e55b6d37c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTagger.cs
@@ -0,0 +1,13 @@
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ internal class BreakpointTagger : AbstractBreakpointTagger<TextMarkerTag>
+ {
+ public BreakpointTagger (ITextView textView, BreakpointManager breakpointManager)
+ : base (BreakpointTag.Instance, BreakpointDisabledTag.Instance, BreakpointInvalidTag.Instance, textView, breakpointManager)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTaggerProvider.cs
new file mode 100644
index 0000000000..55658cf342
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/BreakpointTaggerProvider.cs
@@ -0,0 +1,21 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("text")]
+ [TagType (typeof (BreakpointTag))]
+ [TagType (typeof (BreakpointDisabledTag))]
+ [TagType (typeof (BreakpointInvalidTag))]
+ internal class BreakpointTaggerProvider : IViewTaggerProvider
+ {
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new BreakpointTagger (textView, BreakpointManagerService.GetBreakpointManager (textView)) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ClassificationTypes.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ClassificationTypes.cs
new file mode 100644
index 0000000000..6dfd94f867
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ClassificationTypes.cs
@@ -0,0 +1,118 @@
+using System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Language.StandardClassification;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ class ClassificationTypes
+ {
+ public const string BreakpointForegroundTypeName = "BreakpointForeground";
+ public const string BreakpointDisabledForegroundTypeName = "BreakpointDisabledForeground";
+ public const string BreakpointInvalidForegroundTypeName = "BreakpointInvalidForeground";
+ public const string CurrentStatementForegroundTypeName = "CurrentStatementForeground";
+ public const string ReturnStatementForegroundTypeName = "ReturnStatementForeground";
+
+ [Export]
+ [Name (BreakpointForegroundTypeName)]
+ [BaseDefinition (PredefinedClassificationTypeNames.FormalLanguage)]
+ internal readonly ClassificationTypeDefinition BreakpointForegroundTypeDefinition = null;
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = BreakpointForegroundTypeName)]
+ [Name (BreakpointForegroundTypeName + "Format")]
+ [Order (After = LanguagePriority.FormalLanguage, Before = Priority.High)]
+ [UserVisible (true)]
+ private sealed class BreakpointForegroundClassificationFormat
+ : ClassificationFormatDefinition
+ {
+ private BreakpointForegroundClassificationFormat ()
+ {
+ this.DisplayName = BreakpointForegroundTypeName;
+ this.ForegroundColor = Colors.White;
+ }
+ }
+
+
+ [Export]
+ [Name (BreakpointDisabledForegroundTypeName)]
+ [BaseDefinition (PredefinedClassificationTypeNames.FormalLanguage)]
+ internal readonly ClassificationTypeDefinition BreakpointDisabledForegroundTypeDefinition = null;
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = BreakpointDisabledForegroundTypeName)]
+ [Name (BreakpointDisabledForegroundTypeName + "Format")]
+ [Order (After = LanguagePriority.FormalLanguage, Before = Priority.High)]
+ [UserVisible (true)]
+ private sealed class BreakpointDisabledForegroundClassificationFormat
+ : ClassificationFormatDefinition
+ {
+ private BreakpointDisabledForegroundClassificationFormat ()
+ {
+ this.DisplayName = BreakpointDisabledForegroundTypeName;
+ this.ForegroundColor = Colors.White;
+ }
+ }
+
+ [Export]
+ [Name (BreakpointInvalidForegroundTypeName)]
+ [BaseDefinition (PredefinedClassificationTypeNames.FormalLanguage)]
+ internal readonly ClassificationTypeDefinition BreakpointInvalidForegroundTypeDefinition = null;
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = BreakpointInvalidForegroundTypeName)]
+ [Name (BreakpointInvalidForegroundTypeName + "Format")]
+ [Order (After = LanguagePriority.FormalLanguage, Before = Priority.High)]
+ [UserVisible (true)]
+ private sealed class BreakpointInvalidForegroundClassificationFormat
+ : ClassificationFormatDefinition
+ {
+ private BreakpointInvalidForegroundClassificationFormat ()
+ {
+ this.DisplayName = BreakpointInvalidForegroundTypeName;
+ this.ForegroundColor = Colors.White;
+ }
+ }
+
+ [Export]
+ [Name (CurrentStatementForegroundTypeName)]
+ [BaseDefinition (PredefinedClassificationTypeNames.FormalLanguage)]
+ internal readonly ClassificationTypeDefinition CurrentStatementForegroundTypeDefinition = null;
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = CurrentStatementForegroundTypeName)]
+ [Name (CurrentStatementForegroundTypeName + "Format")]
+ [Order (After = LanguagePriority.FormalLanguage, Before = Priority.High)]
+ [UserVisible (true)]
+ private sealed class CurrentStatementForegroundClassificationFormat
+ : ClassificationFormatDefinition
+ {
+ private CurrentStatementForegroundClassificationFormat ()
+ {
+ this.DisplayName = CurrentStatementForegroundTypeName;
+ this.ForegroundColor = Colors.Black;
+ }
+ }
+
+ [Export]
+ [Name (ReturnStatementForegroundTypeName)]
+ [BaseDefinition (PredefinedClassificationTypeNames.FormalLanguage)]
+ internal readonly ClassificationTypeDefinition ReturnStatementForegroundTypeDefinition = null;
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = ReturnStatementForegroundTypeName)]
+ [Name (ReturnStatementForegroundTypeName + "Format")]
+ [Order (After = LanguagePriority.FormalLanguage, Before = Priority.High)]
+ [UserVisible (true)]
+ private sealed class ReturnStatementForegroundClassificationFormat
+ : ClassificationFormatDefinition
+ {
+ private ReturnStatementForegroundClassificationFormat ()
+ {
+ this.DisplayName = ReturnStatementForegroundTypeName;
+ this.ForegroundColor = Colors.Black;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTagger.cs
new file mode 100644
index 0000000000..124b48f806
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTagger.cs
@@ -0,0 +1,16 @@
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ internal class CurrentStatementForegroundTagger : AbstractCurrentStatementTagger<ClassificationTag>
+ {
+ public CurrentStatementForegroundTagger (
+ ClassificationTag tag,
+ ITextBuffer textBuffer,
+ bool isGreen)
+ : base (tag, textBuffer, isGreen)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTaggerProvider.cs
new file mode 100644
index 0000000000..ae65b6287c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementForegroundTaggerProvider.cs
@@ -0,0 +1,31 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (ITaggerProvider))]
+ [TagType (typeof (IClassificationTag))]
+ [ContentType ("text")]
+ class CurrentStatementForegroundTaggerProvider : ITaggerProvider
+ {
+ private readonly IClassificationTypeRegistryService classificationTypeRegistryService;
+ private readonly IClassificationType classificationType;
+ private readonly ClassificationTag tag;
+
+ [ImportingConstructor]
+ public CurrentStatementForegroundTaggerProvider (IClassificationTypeRegistryService classificationTypeRegistryService)
+ {
+ this.classificationTypeRegistryService = classificationTypeRegistryService;
+ this.classificationType = classificationTypeRegistryService.GetClassificationType (ClassificationTypes.CurrentStatementForegroundTypeName);
+ this.tag = new ClassificationTag (classificationType);
+ }
+
+ public ITagger<T> CreateTagger<T> (ITextBuffer buffer) where T : ITag
+ {
+ return new CurrentStatementForegroundTagger (tag, buffer, isGreen: false) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementMarkerDefinition.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementMarkerDefinition.cs
new file mode 100644
index 0000000000..f0adbc69bc
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementMarkerDefinition.cs
@@ -0,0 +1,21 @@
+using System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (EditorFormatDefinition))]
+ [Name (CurrentStatementTag.TagId)]
+ [UserVisible (true)]
+ [Priority (1)]
+ internal class CurrentStatementMarkerDefinition : MarkerFormatDefinition
+ {
+ public CurrentStatementMarkerDefinition ()
+ {
+ this.ZOrder = 3;
+ this.Fill = new SolidColorBrush (Color.FromArgb (255, 255, 238, 98));
+ this.Fill.Freeze ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTag.cs
new file mode 100644
index 0000000000..857b89c678
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTag.cs
@@ -0,0 +1,16 @@
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ internal class CurrentStatementTag : TextMarkerTag
+ {
+ internal const string TagId = "currentstatement";
+
+ public static readonly CurrentStatementTag Instance = new CurrentStatementTag ();
+
+ private CurrentStatementTag ()
+ : base (TagId)
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTagger.cs
new file mode 100644
index 0000000000..bab3493fe9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTagger.cs
@@ -0,0 +1,12 @@
+using Microsoft.VisualStudio.Text;
+
+namespace MonoDevelop.Debugger
+{
+ internal class CurrentStatementTagger : AbstractCurrentStatementTagger<CurrentStatementTag>
+ {
+ public CurrentStatementTagger (ITextBuffer textBuffer)
+ : base (CurrentStatementTag.Instance, textBuffer, isGreen: false)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTaggerProvider.cs
new file mode 100644
index 0000000000..ad385fa208
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/CurrentStatementTaggerProvider.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("text")]
+ [TagType (typeof (CurrentStatementTag))]
+ internal class CurrentStatementTaggerProvider : IViewTaggerProvider
+ {
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new CurrentStatementTagger (buffer) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementForegroundTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementForegroundTaggerProvider.cs
new file mode 100644
index 0000000000..08442ce995
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementForegroundTaggerProvider.cs
@@ -0,0 +1,31 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (ITaggerProvider))]
+ [TagType (typeof (IClassificationTag))]
+ [ContentType ("text")]
+ class ReturnStatementForegroundTaggerProvider : ITaggerProvider
+ {
+ private readonly IClassificationTypeRegistryService classificationTypeRegistryService;
+ private readonly IClassificationType classificationType;
+ private readonly ClassificationTag tag;
+
+ [ImportingConstructor]
+ public ReturnStatementForegroundTaggerProvider (IClassificationTypeRegistryService classificationTypeRegistryService)
+ {
+ this.classificationTypeRegistryService = classificationTypeRegistryService;
+ this.classificationType = classificationTypeRegistryService.GetClassificationType (ClassificationTypes.ReturnStatementForegroundTypeName);
+ this.tag = new ClassificationTag (classificationType);
+ }
+
+ public ITagger<T> CreateTagger<T> (ITextBuffer buffer) where T : ITag
+ {
+ return new CurrentStatementForegroundTagger (tag, buffer, isGreen: true) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementMarkerDefinition.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementMarkerDefinition.cs
new file mode 100644
index 0000000000..f978353661
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementMarkerDefinition.cs
@@ -0,0 +1,21 @@
+using System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (EditorFormatDefinition))]
+ [Name (ReturnStatementTag.TagId)]
+ [UserVisible (true)]
+ [Priority (1)]
+ internal class ReturnStatementMarkerDefinition : MarkerFormatDefinition
+ {
+ public ReturnStatementMarkerDefinition ()
+ {
+ this.ZOrder = 4;
+ this.Fill = new SolidColorBrush (Color.FromArgb (255, 180, 228, 180));
+ this.Fill.Freeze ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTag.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTag.cs
new file mode 100644
index 0000000000..ca2ac54eb9
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTag.cs
@@ -0,0 +1,16 @@
+using Microsoft.VisualStudio.Text.Tagging;
+
+namespace MonoDevelop.Debugger
+{
+ internal class ReturnStatementTag : TextMarkerTag
+ {
+ internal const string TagId = "returnstatement";
+
+ public static readonly ReturnStatementTag Instance = new ReturnStatementTag ();
+
+ private ReturnStatementTag ()
+ : base (TagId)
+ {
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTagger.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTagger.cs
new file mode 100644
index 0000000000..f2d1e94149
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTagger.cs
@@ -0,0 +1,12 @@
+using Microsoft.VisualStudio.Text;
+
+namespace MonoDevelop.Debugger
+{
+ internal class ReturnStatementTagger : AbstractCurrentStatementTagger<ReturnStatementTag>
+ {
+ public ReturnStatementTagger (ITextBuffer textBuffer)
+ : base (ReturnStatementTag.Instance, textBuffer, isGreen: true)
+ {
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTaggerProvider.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTaggerProvider.cs
new file mode 100644
index 0000000000..e5ac8feb86
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.VSTextView/Tags/ReturnStatementTaggerProvider.cs
@@ -0,0 +1,19 @@
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Tagging;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Debugger
+{
+ [Export (typeof (IViewTaggerProvider))]
+ [ContentType ("text")]
+ [TagType (typeof (ReturnStatementTag))]
+ internal class ReturnStatementTaggerProvider : IViewTaggerProvider
+ {
+ public ITagger<T> CreateTagger<T> (ITextView textView, ITextBuffer buffer) where T : ITag
+ {
+ return new ReturnStatementTagger (buffer) as ITagger<T>;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
index 14ce427929..4701419458 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
@@ -231,12 +231,22 @@
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.DebugEntry" insertafter="MonoDevelop.Ide.Commands.ProjectCommands.RunEntry" />
</Condition>
</Extension>
+
+ <Extension path = "/MonoDevelop/TextEditor/ContextMenu/Editor">
+ <SeparatorItem id = "DebuggerSectionStart" insertafter="Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.SetNextStatement" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowNextStatement" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.RunToCursor" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ExpressionEvaluator" />
+ <SeparatorItem id = "DebuggerSectionEnd" />
+ </Extension>
<Extension path = "/MonoDevelop/Core/ExecutionModes/Debug">
<ModeSetType id="MonoDevelop.Debugger" class="MonoDevelop.Debugger.DebugExecutionModeSet"/>
</Extension>
<Extension path = "/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid = "md-exception-caught-template" resource = "exception-caught-template-16.png" size = "Menu"/>
<StockIcon stockid = "md-continue-debug" resource = "continue-16.png" size = "Menu"/>
<StockIcon stockid = "md-pause-debug" resource = "pause-16.png" size = "Menu"/>
<StockIcon stockid = "md-step-into-debug" resource = "step-in-16.png" size = "Menu"/>
@@ -250,6 +260,11 @@
<StockIcon stockid = "md-view-debug-immediate" resource = "pad-immediate-16.png" size="Menu" />
<StockIcon stockid = "md-prefs-debugger" resource = "prefs-debugger-16.png" size="Menu" />
<StockIcon stockid = "md-stack-pointer" resource = "stack-pointer-16.png" size="Menu" />
+ <StockIcon stockid = "md-gutter-execution" resource = "gutter-execution-15.png" size="Menu" imageid="807" />
+ <StockIcon stockid = "md-gutter-stack" resource = "gutter-stack-15.png" size="Menu" imageid="386" />
+ <StockIcon stockid = "md-gutter-tracepoint" resource = "gutter-tracepoint-15.png" size="Menu" imageid="3175" />
+ <StockIcon stockid = "md-gutter-tracepoint-disabled" resource = "gutter-tracepoint-disabled-15.png" size="Menu" imageid="3174" />
+ <StockIcon stockid = "md-gutter-tracepoint-invalid" resource = "gutter-tracepoint-invalid-15.png" size="Menu" imageid="3178" />
</Extension>
<Extension path = "/MonoDevelop/Ide/CommandBar">
@@ -280,5 +295,8 @@
</Condition>
</Condition>
</Extension>
+ <Extension path="/MonoDevelop/Ide/Composition">
+ <Assembly file="MonoDevelop.Debugger.dll"/>
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
index 06b8d55349..891e421ed9 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
@@ -8,41 +8,33 @@
<ProjectGuid>{2357AABD-08C7-4808-A495-8FF2D3CDFDB0}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\MonoDevelop.Debugger</OutputPath>
+ <DefineConstants Condition="$(OS) == 'Windows_NT'">$(DefineConstants);WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMac|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseMac|AnyCPU' " />
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>..\..\..\build\bin\MonoDevelop.exe</StartProgram>
+ <StartArguments>--no-redirect</StartArguments>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
+ <Reference Include="System.ComponentModel.Composition" />
+ <Reference Include="Xamarin.Mac" Condition=" '$(Configuration)' == 'DebugMac' OR '$(Configuration)' == 'ReleaseMac' ">
+ <HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
+ <ItemGroup Condition="$(OS) == 'Windows_NT'">
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="WindowsBase" />
+ </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
@@ -74,6 +66,10 @@
<Name>Mono.Debugging</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="../../../external/vs-editor-core/src/CocoaControls/CocoaControls.csproj" Condition=" '$(Configuration)' == 'DebugMac' OR '$(Configuration)' == 'ReleaseMac' ">
+ <Name>CocoaControls</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@@ -136,6 +132,55 @@
<Compile Include="Gui\MonoDevelop.Debugger.ExpressionEvaluatorDialog.cs" />
<Compile Include="Gui\MonoDevelop.Debugger.Viewers.ValueVisualizerDialog.cs" />
<Compile Include="MonoDevelop.Debugger\IDebuggerCompletionProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\ReturnStatementGlyphTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\ReturnStatementGlyphTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\ReturnStatementGlyphTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\IInteractiveGlyph.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\IActiveGlyphDropHandler.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\GlyphCommandType.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\CurrentStatementGlyphTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\CurrentStatementGlyphTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\CurrentStatementGlyphTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphMouseProcessorProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphMouseProcessor.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\AbstractCurrentStatementTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ReturnStatementTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ReturnStatementTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ReturnStatementTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ReturnStatementMarkerDefinition.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ReturnStatementForegroundTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementMarkerDefinition.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementForegroundTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\CurrentStatementForegroundTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\ClassificationTypes.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointTag.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointMarkerDefinition.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointForegroundTaggerProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\BreakpointForegroundTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Tags\AbstractBreakpointTagger.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\QuickInfo\DebuggerQuickInfoSourceProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\QuickInfo\DebuggerQuickInfoSource.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\QuickInfo\IDebugInfoProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger\DebugValueWindow.cs" />
+ <Compile Include="MonoDevelop.Debugger\TextViewExtensions.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\BreakpointManagerService.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\BreakpointManager.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\ExceptionCaught\ExceptionCaughtProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\ExceptionCaught\ExceptionCaughtAdornmentManager.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="$(OS) != 'Windows_NT'">
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\BreakpointGlyphFactoryProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\CurrentStatementGlyphFactoryProvider.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\ImageSourceGlyphFactory.cs" />
+ <Compile Include="MonoDevelop.Debugger.VSTextView\Glyphs\ReturnStatementGlyphFactoryProvider.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.Debugger.addin.xml" />
@@ -203,6 +248,8 @@
<EmbeddedResource Include="icons\lightning-16~disabled%402x.png" />
<EmbeddedResource Include="icons\lightning-16~dark~disabled.png" />
<EmbeddedResource Include="icons\lightning-16~dark~disabled%402x.png" />
+ <EmbeddedResource Include="icons\exception-caught-template-16.png" />
+ <EmbeddedResource Include="icons\exception-caught-template-16%402x.png" />
<EmbeddedResource Include="icons\exception-48~dark.png" />
<EmbeddedResource Include="icons\exception-48~dark%402x.png" />
<EmbeddedResource Include="icons\gutter-breakpoint-15.png" />
@@ -309,7 +356,14 @@
<EmbeddedResource Include="icons\mac\step-over-16~disabled~dark%402x.png" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
+ <Folder Include="MonoDevelop.Debugger.VSTextView\" />
+ <Folder Include="MonoDevelop.Debugger.VSTextView\Glyphs\" />
+ <Folder Include="MonoDevelop.Debugger.VSTextView\Tags\" />
+ <Folder Include="MonoDevelop.Debugger.VSTextView\QuickInfo\" />
+ <Folder Include="MonoDevelop.Debugger.VSTextView\ExceptionCaught\" />
+ </ItemGroup>
+ <ItemGroup>
+ <InternalsVisibleTo Include="MonoDevelop.SourceEditor" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
index c508b4c654..58027fff67 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
@@ -38,6 +38,8 @@ using System.Linq;
using System.IO;
using MonoDevelop.Core.Execution;
using MonoDevelop.Ide.Commands;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text;
namespace MonoDevelop.Debugger
{
@@ -334,21 +336,25 @@ namespace MonoDevelop.Debugger
var breakpoints = DebuggingService.Breakpoints;
Breakpoint bp;
+ var textView = IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ();
+ var (caretLine, caretColumn) = textView.MDCaretLineAndColumn ();
+ var point = textView.Caret.Position.BufferPosition;
+
lock (breakpoints)
- bp = breakpoints.Toggle (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.CaretLine, IdeApp.Workbench.ActiveDocument.Editor.CaretColumn);
-
+ bp = breakpoints.Toggle (IdeApp.Workbench.ActiveDocument.FileName, caretLine, caretColumn);
+
// If the breakpoint could not be inserted in the caret location, move the caret
// to the real line of the breakpoint, so that if the Toggle command is run again,
// this breakpoint will be removed
- if (bp != null && bp.Line != IdeApp.Workbench.ActiveDocument.Editor.CaretLine)
- IdeApp.Workbench.ActiveDocument.Editor.CaretLine = bp.Line;
+ if (bp != null && bp.Line != caretLine)
+ textView.Caret.MoveTo (point.Snapshot.GetLineFromLineNumber (bp.Line).Start);
}
-
+
protected override void Update (CommandInfo info)
{
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
- info.Enabled = IdeApp.Workbench.ActiveDocument != null &&
- IdeApp.Workbench.ActiveDocument.Editor != null &&
+ info.Enabled = IdeApp.Workbench.ActiveDocument != null &&
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> () != null &&
IdeApp.Workbench.ActiveDocument.FileName != FilePath.Null &&
!DebuggingService.Breakpoints.IsReadOnly;
}
@@ -361,7 +367,7 @@ namespace MonoDevelop.Debugger
var breakpoints = DebuggingService.Breakpoints;
lock (breakpoints) {
- foreach (var bp in breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.CaretLine))
+ foreach (var bp in breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine ()))
bp.Enabled = !bp.Enabled;
}
}
@@ -372,11 +378,11 @@ namespace MonoDevelop.Debugger
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
if (IdeApp.Workbench.ActiveDocument != null &&
- IdeApp.Workbench.ActiveDocument.Editor != null &&
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> () != null &&
IdeApp.Workbench.ActiveDocument.FileName != FilePath.Null &&
!breakpoints.IsReadOnly) {
lock (breakpoints) {
- var bpInLine = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.CaretLine);
+ var bpInLine = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine());
info.Enabled = bpInLine.Count > 0;
info.Text = GettextCatalog.GetString ("Disable Breakpoint");
foreach (var bp in bpInLine) {
@@ -457,7 +463,7 @@ namespace MonoDevelop.Debugger
lock (breakpoints) {
IEnumerable<Breakpoint> brs = breakpoints.GetBreakpointsAtFileLine (
IdeApp.Workbench.ActiveDocument.FileName,
- IdeApp.Workbench.ActiveDocument.Editor.CaretLine);
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine ());
List<Breakpoint> list = new List<Breakpoint> (brs);
foreach (Breakpoint bp in list)
@@ -471,11 +477,11 @@ namespace MonoDevelop.Debugger
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
if (IdeApp.Workbench.ActiveDocument != null &&
- IdeApp.Workbench.ActiveDocument.Editor != null &&
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> () != null &&
IdeApp.Workbench.ActiveDocument.FileName != FilePath.Null &&
!breakpoints.IsReadOnly) {
lock (breakpoints)
- info.Enabled = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.CaretLine).Count > 0;
+ info.Enabled = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine ()).Count > 0;
} else {
info.Enabled = false;
}
@@ -563,14 +569,15 @@ namespace MonoDevelop.Debugger
protected override void Run ()
{
var doc = IdeApp.Workbench.ActiveDocument;
-
+ var textView = doc.GetContent<ITextView> ();
+ var (caretLine, caretColumn) = textView.MDCaretLineAndColumn ();
if (DebuggingService.IsPaused) {
- DebuggingService.RunToCursor (doc.FileName, doc.Editor.CaretLine, doc.Editor.CaretColumn);
+ DebuggingService.RunToCursor (doc.FileName, caretLine, caretColumn);
return;
}
if (IdeApp.Workspace.IsOpen) {
- var bp = new RunToCursorBreakpoint (doc.FileName, doc.Editor.CaretLine, doc.Editor.CaretColumn);
+ var bp = new RunToCursorBreakpoint (doc.FileName, caretLine, caretColumn);
DebuggingService.Breakpoints.Add (bp);
var target = DebugHandler.GetRunTarget ();
if (target != null)
@@ -589,7 +596,7 @@ namespace MonoDevelop.Debugger
var doc = IdeApp.Workbench.ActiveDocument;
- if (doc?.Editor != null && doc.FileName != FilePath.Null) {
+ if (doc?.GetContent<ITextView> () != null && doc.FileName != FilePath.Null) {
var target = DebugHandler.GetRunTarget ();
if (target != null && IdeApp.ProjectOperations.CanDebug (target)) {
info.Enabled = true;
@@ -610,7 +617,7 @@ namespace MonoDevelop.Debugger
lock (breakpoints) {
brs = breakpoints.GetBreakpointsAtFileLine (
IdeApp.Workbench.ActiveDocument.FileName,
- IdeApp.Workbench.ActiveDocument.Editor.CaretLine);
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine ());
}
if (brs.Count > 0) {
@@ -625,11 +632,11 @@ namespace MonoDevelop.Debugger
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
if (IdeApp.Workbench.ActiveDocument != null &&
- IdeApp.Workbench.ActiveDocument.Editor != null &&
+ IdeApp.Workbench.ActiveDocument.GetContent<ITextView> () != null &&
IdeApp.Workbench.ActiveDocument.FileName != FilePath.Null &&
!breakpoints.IsReadOnly) {
lock (breakpoints)
- info.Enabled = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.CaretLine).Count > 0;
+ info.Enabled = breakpoints.GetBreakpointsAtFileLine (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ().MDCaretLine ()).Count > 0;
} else {
info.Enabled = false;
}
@@ -640,12 +647,30 @@ namespace MonoDevelop.Debugger
{
protected override void Run ()
{
+ var textView = IdeApp.Workbench.ActiveDocument.GetContent<ITextView> ();
+ if (textView != null) {
+ var viewPrimitives = MonoDevelop.Ide.Composition.CompositionManager.GetExport<IEditorPrimitivesFactoryService> ().Value.GetViewPrimitives (textView);
+ var selectedText = viewPrimitives.Selection.GetText ();
+ if (!string.IsNullOrWhiteSpace (selectedText)) {
+ DebuggingService.ShowExpressionEvaluator (selectedText);
+ return;
+ }
+
+ // GetCurrentWord() works correctly only in new editor
+ if (IdeApp.Workbench.ActiveDocument.Editor == null) {
+ var currentWordText = viewPrimitives.Caret.GetCurrentWord ().GetText ();
+ if (!string.IsNullOrWhiteSpace (currentWordText)) {
+ DebuggingService.ShowExpressionEvaluator (currentWordText);
+ return;
+ }
+ }
+ }
DebuggingService.ShowExpressionEvaluator (null);
}
protected override void Update (CommandInfo info)
{
- info.Visible = DebuggingService.IsDebuggingSupported;
+ info.Visible = DebuggingService.IsDebuggingSupported && DebuggingService.IsDebugging;
info.Enabled = DebuggingService.CurrentFrame != null;
}
}
@@ -683,7 +708,7 @@ namespace MonoDevelop.Debugger
{
var doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null && doc.FileName != FilePath.Null && doc.Editor != null && DebuggingService.IsDebuggingSupported) {
+ if (doc != null && doc.FileName != FilePath.Null && doc.GetContent<ITextView> () != null && DebuggingService.IsDebuggingSupported) {
info.Enabled = DebuggingService.IsPaused && DebuggingService.DebuggerSession.CanSetNextStatement;
info.Visible = DebuggingService.IsPaused;
} else {
@@ -697,7 +722,8 @@ namespace MonoDevelop.Debugger
var doc = IdeApp.Workbench.ActiveDocument;
try {
- DebuggingService.SetNextStatement (doc.FileName, doc.Editor.CaretLine, doc.Editor.CaretColumn);
+ var (caretLine, caretColumn) = doc.GetContent<ITextView> ().MDCaretLineAndColumn ();
+ DebuggingService.SetNextStatement (doc.FileName, caretLine, caretColumn);
} catch (Exception e) {
if (e is NotSupportedException || e.InnerException is NotSupportedException) {
string message;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugValueWindow.cs
index ab8eced2a9..6303475bb1 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugValueWindow.cs
@@ -26,21 +26,17 @@
//
using System;
-using System.Linq;
using Mono.Debugging.Client;
-using MonoDevelop.Debugger;
using MonoDevelop.Components;
using Gtk;
-using Mono.TextEditor;
using Gdk;
using MonoDevelop.Ide;
-using MonoDevelop.Ide.Editor;
-namespace MonoDevelop.SourceEditor
+namespace MonoDevelop.Debugger
{
class DebugValueWindow : PopoverWindow
{
- internal ObjectValueTreeView tree;
+ public ObjectValueTreeView Tree { get; }
ScrolledWindow sw;
static readonly string innerTreeName = "MonoDevelop.SourceEditor.DebugValueWindow.ObjectValueTreeView";
@@ -75,14 +71,14 @@ namespace MonoDevelop.SourceEditor
currentBgColor = bgColor;
}
- public DebugValueWindow (TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch) : base (Gtk.WindowType.Toplevel)
+ public DebugValueWindow (Gtk.Window transientFor, string pinnedWatchFileName, int pinnedWatchLine, StackFrame frame, ObjectValue value, PinnedWatch watch) : base (Gtk.WindowType.Toplevel)
{
this.TypeHint = WindowTypeHint.PopupMenu;
this.AllowShrink = false;
this.AllowGrow = false;
this.Decorated = false;
- TransientFor = (Gtk.Window) (editor.GetNativeWidget <Gtk.Widget> ()).Toplevel;
+ TransientFor = transientFor;
// Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window
AcceptFocus = false;
@@ -91,33 +87,32 @@ namespace MonoDevelop.SourceEditor
sw.VscrollbarPolicy = PolicyType.Never;
UpdateTreeStyle (Theme.BackgroundColor);
- tree = new ObjectValueTreeView ();
- tree.Name = innerTreeName;
+ Tree = new ObjectValueTreeView ();
+ Tree.Name = innerTreeName;
- sw.Add (tree);
+ sw.Add (Tree);
ContentBox.Add (sw);
- tree.Frame = frame;
- tree.CompactView = true;
- tree.AllowAdding = false;
- tree.AllowEditing = true;
- tree.HeadersVisible = false;
- tree.AllowPinning = true;
- tree.RootPinAlwaysVisible = true;
- tree.PinnedWatch = watch;
- var location = editor.OffsetToLocation (offset);
- tree.PinnedWatchLine = location.Line;
- tree.PinnedWatchFile = editor.FileName;
-
- tree.AddValue (value);
- tree.Selection.UnselectAll ();
- tree.SizeAllocated += OnTreeSizeChanged;
- tree.PinStatusChanged += OnPinStatusChanged;
+ Tree.Frame = frame;
+ Tree.CompactView = true;
+ Tree.AllowAdding = false;
+ Tree.AllowEditing = true;
+ Tree.HeadersVisible = false;
+ Tree.AllowPinning = true;
+ Tree.RootPinAlwaysVisible = true;
+ Tree.PinnedWatch = watch;
+ Tree.PinnedWatchLine = pinnedWatchLine;
+ Tree.PinnedWatchFile = pinnedWatchFileName;
+
+ Tree.AddValue (value);
+ Tree.Selection.UnselectAll ();
+ Tree.SizeAllocated += OnTreeSizeChanged;
+ Tree.PinStatusChanged += OnPinStatusChanged;
sw.ShowAll ();
- tree.StartEditing += OnStartEditing;
- tree.EndEditing += OnEndEditing;
+ Tree.StartEditing += OnStartEditing;
+ Tree.EndEditing += OnEndEditing;
ShowArrow = true;
Theme.CornerRadius = 3;
@@ -141,10 +136,10 @@ namespace MonoDevelop.SourceEditor
protected override void OnDestroyed ()
{
- tree.StartEditing -= OnStartEditing;
- tree.EndEditing -= OnEndEditing;
- tree.PinStatusChanged -= OnPinStatusChanged;
- tree.SizeAllocated -= OnTreeSizeChanged;
+ Tree.StartEditing -= OnStartEditing;
+ Tree.EndEditing -= OnEndEditing;
+ Tree.PinStatusChanged -= OnPinStatusChanged;
+ Tree.SizeAllocated -= OnTreeSizeChanged;
PreviewWindowManager.WindowClosed -= PreviewWindowManager_WindowClosed;
base.OnDestroyed ();
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index b4182ffadc..e1fae83fb1 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -50,6 +50,8 @@ using System.Collections.Concurrent;
using System.Threading;
using MonoDevelop.Core.Instrumentation;
using MonoDevelop.Components;
+using Microsoft.VisualStudio.Text;
+using Microsoft.CodeAnalysis.Text;
namespace MonoDevelop.Debugger
{
@@ -1366,24 +1368,65 @@ namespace MonoDevelop.Debugger
breakpoints.Clear ();
}
+ static Microsoft.CodeAnalysis.ISymbol GetLanguageItem (MonoDevelop.Ide.Gui.Document document, SourceLocation sourceLocation, string identifier)
+ {
+ var textBuffer = document.GetContent<ITextBuffer> ();
+ if (textBuffer == null)
+ return null;
+
+ var currentSnapshot = textBuffer.CurrentSnapshot;
+ var roslynDocument = currentSnapshot.GetOpenDocumentInCurrentContextWithChanges ();
+ if (roslynDocument == null)
+ return null;
+
+ var model = roslynDocument.GetSemanticModelAsync ().WaitAndGetResult ();
+ if (model == null)
+ return null;
+
+ int index = identifier.LastIndexOf ("`", System.StringComparison.Ordinal);
+ int arity = 0;
+ if (index != -1) {
+ try {
+ arity = int.Parse (identifier.Substring (index + 1));
+ } catch {
+ return null;
+ }
+ identifier = identifier.Remove (index);
+ }
+ var line = currentSnapshot.GetLineFromLineNumber (sourceLocation.Line - 1);
+ foreach (var symbol in model.LookupSymbols (line.Start.Position + sourceLocation.Column - 1, name: identifier)) {
+ var typeSymbol = symbol as Microsoft.CodeAnalysis.INamedTypeSymbol;
+ if (typeSymbol != null && (arity == 0 || arity == typeSymbol.Arity)) {
+ return symbol;
+ }
+ var namespaceSymbol = symbol as Microsoft.CodeAnalysis.INamespaceSymbol;
+ if (namespaceSymbol != null) {
+ return namespaceSymbol;
+ }
+ }
+ return null;
+ }
+
static string ResolveType (string identifier, SourceLocation location)
{
Document doc = IdeApp.Workbench.GetDocument (location.FileName);
if (doc != null) {
- ITextEditorResolver textEditorResolver = doc.GetContent<ITextEditorResolver> ();
- if (textEditorResolver != null) {
- var rr = textEditorResolver.GetLanguageItem (doc.Editor.LocationToOffset (location.Line, 1), identifier);
- var ns = rr as Microsoft.CodeAnalysis.INamespaceSymbol;
- if (ns != null)
- return ns.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat);
- var result = rr as Microsoft.CodeAnalysis.INamedTypeSymbol;
- if (result != null && !(result.TypeKind == Microsoft.CodeAnalysis.TypeKind.Dynamic && result.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat) == "dynamic")) {
- return result.ToDisplayString (new Microsoft.CodeAnalysis.SymbolDisplayFormat (
- typeQualificationStyle: Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
- miscellaneousOptions:
- Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
- Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions.UseSpecialTypes));
- }
+ Microsoft.CodeAnalysis.ISymbol rr = null;
+ if (doc.GetContent<ITextEditorResolver> () is ITextEditorResolver textEditorResolver) {
+ rr = textEditorResolver.GetLanguageItem (doc.Editor.LocationToOffset (location.Line, 1), identifier);
+ } else {
+ rr = GetLanguageItem (doc, location, identifier);
+ }
+ var ns = rr as Microsoft.CodeAnalysis.INamespaceSymbol;
+ if (ns != null)
+ return ns.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat);
+ var result = rr as Microsoft.CodeAnalysis.INamedTypeSymbol;
+ if (result != null && !(result.TypeKind == Microsoft.CodeAnalysis.TypeKind.Dynamic && result.ToDisplayString (Microsoft.CodeAnalysis.SymbolDisplayFormat.CSharpErrorMessageFormat) == "dynamic")) {
+ return result.ToDisplayString (new Microsoft.CodeAnalysis.SymbolDisplayFormat (
+ typeQualificationStyle: Microsoft.CodeAnalysis.SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces,
+ miscellaneousOptions:
+ Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers |
+ Microsoft.CodeAnalysis.SymbolDisplayMiscellaneousOptions.UseSpecialTypes));
}
}
return null;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
index 3435240002..dc769f0d3e 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
@@ -1005,8 +1005,8 @@ widget ""*.exception_dialog_expander"" style ""exception-dialog-expander""
{
readonly Xwt.Drawing.Image closeSelOverImage;
readonly Xwt.Drawing.Image closeSelImage;
- readonly ExceptionCaughtMessage dlg;
- readonly ExceptionInfo exception;
+ internal readonly ExceptionCaughtMessage dlg;
+ internal readonly ExceptionInfo exception;
Label messageLabel;
Label typeLabel;
@@ -1114,7 +1114,7 @@ widget ""*.exception_dialog_expander"" style ""exception-dialog-expander""
class ExceptionCaughtMiniButton : TopLevelWidgetExtension
{
- readonly ExceptionCaughtMessage dlg;
+ internal readonly ExceptionCaughtMessage dlg;
public ExceptionCaughtMiniButton (ExceptionCaughtMessage dlg, FilePath file, int line)
{
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/TextViewExtensions.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/TextViewExtensions.cs
new file mode 100644
index 0000000000..56a7ab80cf
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/TextViewExtensions.cs
@@ -0,0 +1,50 @@
+using System;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Debugger
+{
+ static class TextViewExtensions
+ {
+ public static int MDCaretLine (this ITextView view)
+ {
+ var position = view.Caret.Position.BufferPosition;
+ return position.Snapshot.GetLineNumberFromPosition (position.Position) + 1;// MonoDevelop starts with 1, ITextView with 0
+ }
+
+ public static (int caretLine, int caretColumn) MDCaretLineAndColumn (this ITextView view)
+ {
+ var point = view.Caret.Position.BufferPosition;
+ var textSnapshotLine = point.GetContainingLine ();
+ return (textSnapshotLine.LineNumber + 1, point - textSnapshotLine.Start + 1);
+ }
+
+ public static (int line, int column, int endLine, int endColumn) MDLineAndColumnFromSpan (this ITextSnapshot snapshot, Span span)
+ {
+ var startLine = snapshot.GetLineFromPosition (span.Start);
+ var endLine = snapshot.GetLineFromPosition (span.End);
+ return (startLine.LineNumber + 1, span.Start - startLine.Start + 1, endLine.LineNumber + 1, span.End - endLine.Start + 1);
+ }
+
+ public static SnapshotSpan SpanFromMDColumnAndLine (this ITextSnapshot snapshot, int line, int column, int endLine, int endColumn)
+ {
+ var startSnapLine = snapshot.GetLineFromLineNumber (line - 1);
+ if (line > 0 && column > 0 && endLine > 0 && endColumn > 0) {
+ var endSnapLine = line == endLine ? startSnapLine : snapshot.GetLineFromLineNumber (endLine - 1);
+ var startPos = startSnapLine.Start + column - 1;
+ return new SnapshotSpan (startPos, endSnapLine.Start + endColumn - 1 - startPos);
+ }
+ //if we don't have full info return whole line
+ return startSnapLine.Extent;
+ }
+
+ public static string GetFilePathOrNull (this ITextBuffer textBuffer)
+ {
+ if (textBuffer.Properties.TryGetProperty (typeof (Microsoft.VisualStudio.Text.ITextDocument), out Microsoft.VisualStudio.Text.ITextDocument textDocument)) {
+ return textDocument.FilePath;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16.png b/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16.png
new file mode 100644
index 0000000000..4d329b86de
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16@2x.png b/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16@2x.png
new file mode 100644
index 0000000000..6ee71a6ad6
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Debugger/icons/exception-caught-template-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.Debugger/packages.config b/main/src/addins/MonoDevelop.Debugger/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/MonoDevelop.Debugger/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/Makefile.am b/main/src/addins/MonoDevelop.DesignerSupport/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.DesignerSupport/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs
index 356dcaf632..55ab204776 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Projects/PropertyPadTextEditorExtension.cs
@@ -29,14 +29,16 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide;
using MonoDevelop.Ide.Editor.Extension;
-
+using System;
+
namespace MonoDevelop.DesignerSupport.Projects
{
// This class implements a text editor extension which provides an
// implementation of IPropertyPadProvider. Since text editor extensions
// are chained in the command route, the designer service will find this
// IPropertyPadProvider when the text editor has the focus.
-
+
+ [Obsolete ("Old editor")]
public class PropertyPadTextEditorExtension: TextEditorExtension, IPropertyPadProvider
{
public object GetActiveComponent ()
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CodeTemplateToolboxProvider.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CodeTemplateToolboxProvider.cs
index ee50ac79f5..cb226c3a63 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CodeTemplateToolboxProvider.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/CodeTemplateToolboxProvider.cs
@@ -44,12 +44,10 @@ namespace MonoDevelop.DesignerSupport.Toolbox
public System.Collections.Generic.IEnumerable<ItemToolboxNode> GetDynamicItems (IToolboxConsumer consumer)
{
// TOTEST
- var content = consumer as FileDocumentController;
- if (content == null)
- yield break;
- // Hack: Ensure that this category is only filled if the current page is a text editor.
- if (!(content is ITextEditorResolver))
- yield break;
+ if (!(consumer is FileDocumentController content) || !consumer.IsTextView ()) {
+ yield break;
+ }
+
foreach (CodeTemplate ct in CodeTemplateService.GetCodeTemplatesForFile (content.FilePath)) {
if (ct.CodeTemplateContext != CodeTemplateContext.Standard)
continue;
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
index ae7c3741ec..630049a212 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/TextToolboxNode.cs
@@ -30,6 +30,7 @@
using System;
using System.ComponentModel;
+using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui;
@@ -89,7 +90,11 @@ namespace MonoDevelop.DesignerSupport.Toolbox
public void InsertAtCaret (Document document)
{
- document.Editor.InsertAtCaret (text);
+ if (document.ActiveView.GetContent<ITextView> () is ITextView view) {
+ view.TextBuffer.Insert (view.Caret.Position.BufferPosition.Position, text);
+ } else if (document.ActiveView.GetContent<Ide.Editor.TextEditor> () is Ide.Editor.TextEditor textEditor) {
+ textEditor.InsertAtCaret (text);
+ }
}
}
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxExtensions.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxExtensions.cs
index 08fcb1f53d..56b5f9c24b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxExtensions.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/ToolboxExtensions.cs
@@ -1,28 +1,30 @@
-//
-// Copyright (C) 2018 Microsoft Corp
-//
-// This source code is licenced under The MIT License:
-//
-// 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.
-//
-
+//
+// Copyright (C) 2018 Microsoft Corp
+//
+// This source code is licenced under The MIT License:
+//
+// 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 System;
+using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Gui.Documents;
@@ -53,10 +55,23 @@ namespace MonoDevelop.DesignerSupport.Toolbox
/// <summary>
/// Returns true if the consumer is a text editor and can handle text toolbox nodes
/// </summary>
+ [Obsolete("Use IsTextView")]
public static bool IsTextEditor (this IToolboxConsumer consumer, out TextEditor editor)
{
editor = consumer.DefaultItemDomain == "Text" ? GetDocument (consumer)?.Editor : null;
return editor != null;
}
+
+ public static bool IsTextView (this IToolboxConsumer consumer, out ITextView view)
+ {
+ if (consumer.DefaultItemDomain != "Text") {
+ view = null;
+ return false;
+ }
+ view = GetDocument (consumer)?.ActiveView?.GetContent<ITextView> ();
+ return view != null;
+ }
+
+ public static bool IsTextView (this IToolboxConsumer consumer) => IsTextView (consumer, out _);
}
}
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
index 3888560b91..008c09cb4b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
@@ -1,5 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesVSEditor)" />
<Import Project="$(ReferencesGtk)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -39,34 +40,6 @@
<Reference Include="System.Web" />
<Reference Include="System.Drawing" />
<Reference Include="System.Core" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -201,14 +174,5 @@
<EmbeddedResource Include="icons\pad-document-outline-16~dark~sel.png" />
<EmbeddedResource Include="icons\pad-document-outline-16~dark~sel%402x.png" />
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="MonoDevelop.DesignerSupport.Toolbox\Helpers\" />
- <Folder Include="MonoDevelop.DesignerSupport.Toolbox\NativeViews\" />
- <Folder Include="MonoDevelop.DesignerSupport\NativePropertyEditors\" />
- <Folder Include="MonoDevelop.DesignerSupport\NativePropertyEditors\PropertyInfo\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
index 600eeafa53..c87af4a05b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/CodeBehindWriter.cs
@@ -37,7 +37,7 @@ using MonoDevelop.Ide;
namespace MonoDevelop.DesignerSupport
{
-
+ [Obsolete("Use Roslyn")]
public class CodeBehindWriter
{
List<string> openFiles;
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/packages.config b/main/src/addins/MonoDevelop.DesignerSupport/packages.config
deleted file mode 100644
index f9194282d2..0000000000
--- a/main/src/addins/MonoDevelop.DesignerSupport/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.DocFood/Makefile.am b/main/src/addins/MonoDevelop.DocFood/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.DocFood/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
index d9f05d204a..d8c2d993ec 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
@@ -7,6 +7,10 @@
<ProjectGuid>{875D389F-48D1-4D46-BFC6-998837DD6AE0}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\BackendBindings\</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many, many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -14,30 +18,6 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
diff --git a/main/src/addins/MonoDevelop.DotNetCore/Makefile.am b/main/src/addins/MonoDevelop.DotNetCore/Makefile.am
deleted file mode 100644
index 96b2dda016..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-SUBDIRS = \
- MonoDevelop.DotNetCore.Tests
-
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/Makefile.am b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
index 422690c417..4ca141ebf2 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
@@ -15,13 +15,6 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -46,6 +39,7 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
<Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
@@ -85,6 +79,7 @@
<ProjectReference Include="..\..\..\..\tests\IdeUnitTests\IdeUnitTests.csproj">
<Project>{F7B2B155-7CF4-42C4-B5AF-63C0667D2E4F}</Project>
<Name>IdeUnitTests</Name>
+ <Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectSupportedTargetFrameworksTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectSupportedTargetFrameworksTests.cs
index f9d8e6dafe..463e37ac74 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectSupportedTargetFrameworksTests.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectSupportedTargetFrameworksTests.cs
@@ -83,7 +83,9 @@ namespace MonoDevelop.DotNetCore.Tests
[Test]
public void GetNetCoreAppTargetFrameworks_NetCore30RuntimeInstalled ()
{
- DotNetCoreRuntimesInstalled ("3.0.0");
+ //NOTE: since we are now checking unsupported runtime version
+ // here we set the latest supported one
+ DotNetCoreRuntimesInstalled ("3.0.0-preview-27324-5");
var frameworks = DotNetCoreProjectSupportedTargetFrameworks.GetNetCoreAppTargetFrameworks ().ToList ();
@@ -112,5 +114,15 @@ namespace MonoDevelop.DotNetCore.Tests
Assert.AreEqual (".NETCoreApp,Version=v2.1", frameworks [0].Id.ToString ());
Assert.AreEqual (1, frameworks.Count);
}
+
+ [Test]
+ public void CheckNetCoreAppTargetFrameworks_NetCoreUnsupportedRuntimeInstalled_ReturnsNoFramework ()
+ {
+ DotNetCoreRuntimesInstalled (DotNetCoreVersion.UnSupportedRuntimeVersion.ToString());
+
+ var frameworks = DotNetCoreProjectSupportedTargetFrameworks.GetNetCoreAppTargetFrameworks ().ToList ();
+
+ Assert.AreEqual (0, frameworks.Count);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateWizardTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateWizardTests.cs
index b04a3d9a2d..7657434a34 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateWizardTests.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreProjectTemplateWizardTests.cs
@@ -434,7 +434,9 @@ namespace MonoDevelop.DotNetCore.Tests
public void NetCoreApp_NetCore30Installed ()
{
CreateWizard ();
- DotNetCoreRuntimesInstalled ("3.0.0");
+ //NOTE: since we are now checking unsupported runtime version
+ // here we set the latest supported one
+ DotNetCoreRuntimesInstalled ("3.0.0-preview-27324-5");
int pages = wizard.TotalPages;
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreVersionTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreVersionTests.cs
index d9ef14ee5d..e3e2823636 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreVersionTests.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/DotNetCoreVersionTests.cs
@@ -216,6 +216,8 @@ namespace MonoDevelop.DotNetCore.Tests
[TestCase ("1.0.0", "1.0.2", false)]
[TestCase ("1.0.2", "1.0.2-preview1-002912-00", true)]
[TestCase ("1.0.2-preview1-002912-00", "1.0.2", false)]
+ [TestCase ("3.0.100-preview3-010431", "3.0.100-preview-010184", true)]
+ [TestCase ("3.0.100-preview3-010431", "3.0.100-preview4-010763", false)]
public void GreaterThanOperator_Version (string x, string y, bool expected)
{
var versionX = DotNetCoreVersion.Parse (x);
@@ -228,6 +230,8 @@ namespace MonoDevelop.DotNetCore.Tests
[TestCase ("1.0.0", "1.0.2", false)]
[TestCase ("1.0.2", "1.0.2-preview1-002912-00", true)]
[TestCase ("1.0.2-preview1-002912-00", "1.0.2", false)]
+ [TestCase ("3.0.100-preview3-010431", "3.0.100-preview-010184", true)]
+ [TestCase ("3.0.100-preview3-010431", "3.0.100-preview4-010763", false)]
public void GreaterThanOrEqualtoOperator_Version (string x, string y, bool expected)
{
var versionX = DotNetCoreVersion.Parse (x);
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
index 6f0de3c1c1..30a5fe5ad9 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
@@ -15,20 +15,8 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -226,24 +214,10 @@
<InternalsVisibleTo Include="Xamarin.Forms.Addin" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
+ <DownloadNupkg Include="Microsoft.DotNet.Common.ProjectTemplates.1.x" Version="$(TemplatesVersion1x)" ExtensionDir="Templates" />
+ <DownloadNupkg Include="Microsoft.DotNet.Common.ProjectTemplates.2.0" Version="$(TemplatesVersion20)" ExtensionDir="Templates" />
+ <DownloadNupkg Include="Microsoft.DotNet.Test.ProjectTemplates.1.x" Version="$(TemplatesVersion1x)" ExtensionDir="Templates" />
+ <DownloadNupkg Include="Microsoft.DotNet.Test.ProjectTemplates.2.0" Version="$(TemplatesVersion20)" ExtensionDir="Templates" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Target Name="BeforeBuild">
- <ItemGroup>
- <NuGetPackage Include="Microsoft.DotNet.Common.ProjectTemplates.1.x">
- <Version>$(TemplatesVersion1x)</Version>
- </NuGetPackage>
- <NuGetPackage Include="Microsoft.DotNet.Common.ProjectTemplates.2.0">
- <Version>$(TemplatesVersion20)</Version>
- </NuGetPackage>
- <NuGetPackage Include="Microsoft.DotNet.Test.ProjectTemplates.1.x">
- <Version>$(TemplatesVersion1x)</Version>
- </NuGetPackage>
- <NuGetPackage Include="Microsoft.DotNet.Test.ProjectTemplates.2.0">
- <Version>$(TemplatesVersion20)</Version>
- </NuGetPackage>
- </ItemGroup>
- <Copy SourceFiles="..\..\..\packages\%(NuGetPackage.Identity).%(NuGetPackage.Version)\%(NuGetPackage.Identity).%(NuGetPackage.Version).nupkg" DestinationFolder="$(OutputPath)\Templates" SkipUnchangedFiles="true" />
- </Target>
</Project>
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreNotInstalledDialog.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreNotInstalledDialog.cs
index cb28b6edc9..d87327f1f4 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreNotInstalledDialog.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreNotInstalledDialog.cs
@@ -35,7 +35,6 @@ namespace MonoDevelop.DotNetCore
{
static readonly string DotNetCoreDownloadUrl = "https://aka.ms/vs/mac/install-netcore{0}";
- //FIXME: aka.ms is not available yet for netcore30 (https://dotnet.microsoft.com/download/dotnet-core/3.0)
public static string GetDotNetCoreDownloadUrl (string version = "")
{
if (string.IsNullOrEmpty (version))
@@ -49,11 +48,11 @@ namespace MonoDevelop.DotNetCore
}
static readonly string defaultMessage = GettextCatalog.GetString (".NET Core SDK is not installed. This is required to build and run .NET Core projects.");
- static readonly string unsupportedMessage = GettextCatalog.GetString ("The .NET Core SDK installed is not supported. Please install a more recent version.");
- public static string GetDotNetCoreMessage (string version = "")
+
+ public static string GetDotNetCoreMessage (string currentPath, string version = "")
{
if (string.IsNullOrEmpty (version))
- return unsupportedMessage;
+ return GettextCatalog.GetString ("The version of the .NET Core SDK currently installed ({0}) is not supported and continuing to use it may result in a broken tooling experience.", currentPath);
return GettextCatalog.GetString (".NET Core {0} SDK is not installed. This is required to build and run .NET Core {0} projects.", version);
}
@@ -96,9 +95,9 @@ namespace MonoDevelop.DotNetCore
public void Show ()
{
if (IsUnsupportedVersion || IsNetStandard) //for .net standard we'll show generic message
- Message = GetDotNetCoreMessage ();
+ Message = GetDotNetCoreMessage (CurrentDotNetCorePath);
else {
- Message = GetDotNetCoreMessage (RequiredDotNetCoreVersion.OriginalString);
+ Message = GetDotNetCoreMessage (CurrentDotNetCorePath, RequiredDotNetCoreVersion.OriginalString);
downloadUrl = GetDotNetCoreDownloadUrl (RequiredDotNetCoreVersion.OriginalString);
}
@@ -113,5 +112,6 @@ namespace MonoDevelop.DotNetCore
public bool IsUnsupportedVersion { get; set; }
public bool IsNetStandard { get; set; }
public DotNetCoreVersion RequiredDotNetCoreVersion { get; set; }
+ public string CurrentDotNetCorePath { get; set; }
}
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectExtension.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectExtension.cs
index d44a4f2ff9..cbc5f546da 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectExtension.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectExtension.cs
@@ -245,6 +245,7 @@ namespace MonoDevelop.DotNetCore
using (var dialog = new DotNetCoreNotInstalledDialog ()) {
dialog.IsUnsupportedVersion = unsupportedSdkVersion;
dialog.RequiredDotNetCoreVersion = DotNetCoreVersion.Parse (Project.TargetFramework.Id.Version);
+ dialog.CurrentDotNetCorePath = sdkPaths.MSBuildSDKsPath;
dialog.IsNetStandard = Project.TargetFramework.Id.IsNetStandard ();
dialog.Show ();
}
@@ -463,7 +464,7 @@ namespace MonoDevelop.DotNetCore
string downloadUrl;
if (isUnsupportedVersion) {
- message = DotNetCoreNotInstalledDialog.GetDotNetCoreMessage ();
+ message = DotNetCoreNotInstalledDialog.GetDotNetCoreMessage (sdkPaths.MSBuildSDKsPath);
downloadUrl = DotNetCoreNotInstalledDialog.GetDotNetCoreDownloadUrl ();
} else {
message = DotNetCoreNotInstalledDialog.GetDotNetCoreMessage (targetFramework.Id.Version);
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectSupportedTargetFrameworks.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectSupportedTargetFrameworks.cs
index 9863575fb1..66efd71bbd 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectSupportedTargetFrameworks.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreProjectSupportedTargetFrameworks.cs
@@ -93,20 +93,15 @@ namespace MonoDevelop.DotNetCore
public static IEnumerable<TargetFramework> GetNetCoreAppTargetFrameworks ()
{
- foreach (Version runtimeVersion in GetMajorRuntimeVersions ()) {
- if (runtimeVersion.Major > 3 || (runtimeVersion.Major == 3 && runtimeVersion.Minor > 0)) {
- // Skip versions > 3.0 since this is not currently supported.
- continue;
- }
-
- string version = runtimeVersion.ToString (2);
- yield return CreateTargetFramework (".NETCoreApp", version);
+ foreach (var runtimeVersion in GetMajorRuntimeVersions ()) {
+ yield return CreateTargetFramework (".NETCoreApp", runtimeVersion.ToString (2));
}
}
static IEnumerable<Version> GetMajorRuntimeVersions ()
{
return DotNetCoreRuntime.Versions
+ .Where (version => version < DotNetCoreVersion.UnSupportedRuntimeVersion)
.Select (version => new Version (version.Major, version.Minor))
.Distinct ();
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSdkPaths.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSdkPaths.cs
index b41d895b9c..58368fbc98 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSdkPaths.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreSdkPaths.cs
@@ -177,6 +177,10 @@ namespace MonoDevelop.DotNetCore
LoggingService.LogInfo ("Unsupported .NET Core SDK version installed '{0}'. Require at least 1.0.0. '{1}'", sdkVersion, sdkDirectory);
return false;
}
+ if (version >= DotNetCoreVersion.UnSupportedVersion) {
+ LoggingService.LogInfo ("Unsupported .NET Core SDK version installed '{0}'.", sdkVersion);
+ return false;
+ }
} else {
LoggingService.LogWarning ("Unable to get version information for .NET Core SDK. '{0}'", sdkDirectory);
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreVersion.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreVersion.cs
index 1cf4d179a1..38ab0656df 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreVersion.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore/DotNetCoreVersion.cs
@@ -33,6 +33,8 @@ namespace MonoDevelop.DotNetCore
class DotNetCoreVersion : IEquatable<DotNetCoreVersion>, IComparable, IComparable<DotNetCoreVersion>
{
public static readonly DotNetCoreVersion MinimumSupportedVersion = new DotNetCoreVersion (1, 0, 0);
+ public static readonly DotNetCoreVersion UnSupportedVersion = new DotNetCoreVersion (3, 0, 100) { ReleaseLabel = "preview3-010431" , IsPrerelease = true };
+ public static readonly DotNetCoreVersion UnSupportedRuntimeVersion = new DotNetCoreVersion (3, 0, 0) { ReleaseLabel = "preview3-27503-5", IsPrerelease = true };
DotNetCoreVersion (int major, int minor, int patch)
: this (new Version (major, minor, patch))
diff --git a/main/src/addins/MonoDevelop.DotNetCore/packages.config b/main/src/addins/MonoDevelop.DotNetCore/packages.config
deleted file mode 100644
index b2b17a922b..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/packages.config
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.DotNet.Common.ProjectTemplates.1.x" version="1.0.0-beta2-20170430-208" targetFramework="net46" />
- <package id="Microsoft.DotNet.Common.ProjectTemplates.2.0" version="1.0.0-beta2-20170727-301" targetFramework="net46" />
- <package id="Microsoft.DotNet.Test.ProjectTemplates.1.x" version="1.0.0-beta2-20170430-208" targetFramework="net46" />
- <package id="Microsoft.DotNet.Test.ProjectTemplates.2.0" version="1.0.0-beta2-20170727-301" targetFramework="net46" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net46" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Gettext/Makefile.am b/main/src/addins/MonoDevelop.Gettext/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Gettext/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
index b872fac144..8e29be5aa2 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
@@ -7,6 +7,10 @@
<ProjectGuid>{ADDC9D20-83C5-4245-9B46-2C5F6642CFBC}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\DisplayBindings\Gettext</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -14,18 +18,6 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
diff --git a/main/src/addins/MonoDevelop.GtkCore/Makefile.am b/main/src/addins/MonoDevelop.GtkCore/Makefile.am
deleted file mode 100644
index bf3218efd0..0000000000
--- a/main/src/addins/MonoDevelop.GtkCore/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = libstetic libsteticui
-
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
index c07e34f3b0..2e73602ef8 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
@@ -7,6 +7,10 @@
<ProjectGuid>{7FCDB0D9-AA7D-44E4-BE74-55312B432389}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\MonoDevelop.GtkCore</OutputPath>
+ <!--
+ This needs to be ported to Roslyn, and currently makes use of many, many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -16,42 +20,6 @@
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -113,7 +81,6 @@
<ItemGroup>
<None Include="icons\window.png" />
<None Include="icons\dialog.png" />
- <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.GtkCore.addin.xml" />
diff --git a/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am b/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.GtkCore/libstetic/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/Makefile.am b/main/src/addins/MonoDevelop.GtkCore/libsteticui/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/libsteticui.csproj b/main/src/addins/MonoDevelop.GtkCore/libsteticui/libsteticui.csproj
index 25ff77b60d..0583de188d 100644
--- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/libsteticui.csproj
+++ b/main/src/addins/MonoDevelop.GtkCore/libsteticui/libsteticui.csproj
@@ -16,22 +16,11 @@
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\..\packages\Mono.Cecil.0.10.0-beta6\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- <Private>False</Private>
- </Reference>
+ <PackageReference Include="Mono.Cecil" Version="0.10.1" />
+ <SuppressCopyLocal Include="Mono.Cecil.Mdb.dll" />
+ <SuppressCopyLocal Include="Mono.Cecil.Pdb.dll" />
+ <SuppressCopyLocal Include="Mono.Cecil.Rocks.dll" />
+ <SuppressCopyLocal Include="Mono.Cecil.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libstetic\libstetic.csproj">
@@ -108,7 +97,6 @@
<None Include="libsteticui.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/packages.config b/main/src/addins/MonoDevelop.GtkCore/libsteticui/packages.config
deleted file mode 100644
index 8b1b9ad8d7..0000000000
--- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net40" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.GtkCore/packages.config b/main/src/addins/MonoDevelop.GtkCore/packages.config
deleted file mode 100644
index f9194282d2..0000000000
--- a/main/src/addins/MonoDevelop.GtkCore/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.Cecil" version="0.10.0-beta6" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.HexEditor/Makefile.am b/main/src/addins/MonoDevelop.HexEditor/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.HexEditor/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.PackageManagement/Makefile.am b/main/src/addins/MonoDevelop.PackageManagement/Makefile.am
deleted file mode 100644
index a7095a0737..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = . MonoDevelop.PackageManagement.Tests
-
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs
index 9ddeec6eb8..dede056437 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Refactoring/NuGetPackageServicesProxy.cs
@@ -60,19 +60,23 @@ namespace MonoDevelop.PackageManagement.Refactoring
}
}
+ /// <summary>
+ /// Get package sources.
+ ///
+ /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
+ /// Therefore, it must be thread-safe and not defer to and then block other threads.
+ /// </summary>
public IEnumerable<KeyValuePair<string, string>> GetSources (bool includeUnOfficial, bool includeDisabled)
{
- return Runtime.RunInMainThread (() => {
- var result = new List<KeyValuePair<string, string>> ();
+ var result = new List<KeyValuePair<string, string>> ();
- foreach (var repository in GetSourceRepositories ().ToList ()) {
- result.Add (new KeyValuePair<string, string> (
- repository.PackageSource.Name,
- repository.PackageSource.Source
- ));
- }
- return result;
- }).WaitAndGetResult (default (CancellationToken));
+ foreach (var repository in GetSourceRepositories ().ToList ()) {
+ result.Add (new KeyValuePair<string, string> (
+ repository.PackageSource.Name,
+ repository.PackageSource.Source
+ ));
+ }
+ return result;
}
public void InstallLatestPackage (string source, Project project, string packageId, bool includePrerelease, bool ignoreDependencies)
@@ -179,6 +183,12 @@ namespace MonoDevelop.PackageManagement.Refactoring
});
}
+ /// <summary>
+ /// Get package source repositories.
+ ///
+ /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
+ /// Therefore, it must be thread-safe and not defer to and then block other threads.
+ /// </summary>
IEnumerable<SourceRepository> GetSourceRepositories ()
{
var solutionManager = PackageManagementServices.Workspace.GetSolutionManager (IdeApp.ProjectOperations.CurrentSelectedSolution);
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/Makefile.am b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
index 96549a13d4..fb76d9f138 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/MonoDevelop.PackageManagement.Tests.csproj
@@ -18,69 +18,18 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="Microsoft.Web.XmlTransform">
- <HintPath>..\..\..\..\packages\Microsoft.Web.Xdt.2.1.2\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Frameworks">
- <HintPath>..\..\..\..\packages\NuGet.Frameworks.4.8.0\lib\net46\NuGet.Frameworks.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Packaging.Core">
- <HintPath>..\..\..\..\packages\NuGet.Packaging.Core.4.8.0\lib\net46\NuGet.Packaging.Core.dll</HintPath>
- </Reference>
<Reference Include="System.Xml.Linq" />
- <Reference Include="System.IO.Compression">
- <HintPath>..\..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Packaging">
- <HintPath>..\..\..\..\packages\NuGet.Packaging.4.8.0\lib\net46\NuGet.Packaging.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Configuration">
- <HintPath>..\..\..\..\packages\NuGet.Configuration.4.8.0\lib\net46\NuGet.Configuration.dll</HintPath>
- </Reference>
+ <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Security" />
- <Reference Include="NuGet.PackageManagement">
- <HintPath>..\..\..\..\packages\NuGet.PackageManagement.4.8.0\lib\net46\NuGet.PackageManagement.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Protocol">
- <HintPath>..\..\..\..\packages\NuGet.Protocol.4.8.0\lib\net46\NuGet.Protocol.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Common">
- <HintPath>..\..\..\..\packages\NuGet.Common.4.8.0\lib\net46\NuGet.Common.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Resolver">
- <HintPath>..\..\..\..\packages\NuGet.Resolver.4.8.0\lib\net46\NuGet.Resolver.dll</HintPath>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.ProjectModel">
- <HintPath>..\..\..\..\packages\NuGet.ProjectModel.4.8.0\lib\net46\NuGet.ProjectModel.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.LibraryModel">
- <HintPath>..\..\..\..\packages\NuGet.LibraryModel.4.8.0\lib\net46\NuGet.LibraryModel.dll</HintPath>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Commands">
- <HintPath>..\..\..\..\packages\NuGet.Commands.4.8.0\lib\net46\NuGet.Commands.dll</HintPath>
- </Reference>
- <Reference Include="Castle.Core">
- <HintPath>..\..\..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
- </Reference>
<Reference Include="System.Configuration" />
- <Reference Include="Moq">
- <HintPath>..\..\..\..\packages\Moq.4.7.145\lib\net45\Moq.dll</HintPath>
- </Reference>
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup>
+ <PackageReference Include="NuGet.PackageManagement" Version="4.8.2-rtm.5835" PrivateAssets="runtime" />
+ <PackageReference Include="Castle.Core" Version="4.2.1" PrivateAssets="runtime" />
+ <PackageReference Include="Moq" Version="4.7.145" PrivateAssets="runtime" />
+ </ItemGroup>
+ <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MonoDevelop.PackageManagement.Tests\MSBuildProjectExtensionsTests.cs" />
<Compile Include="MonoDevelop.PackageManagement.Tests\DelegateCommandTests.cs" />
@@ -215,6 +164,7 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
@@ -236,8 +186,5 @@
<Name>IdeUnitTests</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/packages.config b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/packages.config
deleted file mode 100644
index b6e3ec09f6..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.Tests/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Castle.Core" version="4.2.1" targetFramework="net471" />
- <package id="Moq" version="4.7.145" targetFramework="net471" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
index 7f4c1ef0f4..814770b14d 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.addin.xml
@@ -9,6 +9,10 @@
<Import assembly="NuGet.Commands.dll" />
<Import assembly="NuGet.LibraryModel.dll" />
<Import assembly="NuGet.Common.dll" />
+ <Import assembly="NuGet.Protocol.dll" />
+ <Import assembly="NuGet.Configuration.dll" />
+ <Import assembly="NuGet.Packaging.Core.dll" />
+ <Import assembly="NuGet.ProjectModel.dll" />
</Runtime>
<Extension path = "/MonoDevelop/Ide/Commands">
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
index e57d75fab5..863d8ea7b1 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.csproj
@@ -17,82 +17,34 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Security" />
- <Reference Include="Microsoft.Web.XmlTransform">
- <HintPath>..\..\..\packages\Microsoft.Web.Xdt.2.1.2\lib\net40\Microsoft.Web.XmlTransform.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- </Reference>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="NuGet.LibraryModel">
- <HintPath>..\..\..\packages\NuGet.LibraryModel.4.8.0\lib\net46\NuGet.LibraryModel.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Frameworks">
- <HintPath>..\..\..\packages\NuGet.Frameworks.4.8.0\lib\net46\NuGet.Frameworks.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Packaging.Core">
- <HintPath>..\..\..\packages\NuGet.Packaging.Core.4.8.0\lib\net46\NuGet.Packaging.Core.dll</HintPath>
- </Reference>
<Reference Include="System.Xml.Linq" />
- <Reference Include="System.IO.Compression">
- <HintPath>..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Packaging">
- <HintPath>..\..\..\packages\NuGet.Packaging.4.8.0\lib\net46\NuGet.Packaging.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Configuration">
- <HintPath>..\..\..\packages\NuGet.Configuration.4.8.0\lib\net46\NuGet.Configuration.dll</HintPath>
- </Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.ServiceModel" />
- <Reference Include="NuGet.DependencyResolver.Core">
- <HintPath>..\..\..\packages\NuGet.DependencyResolver.Core.4.8.0\lib\net46\NuGet.DependencyResolver.Core.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.ProjectModel">
- <HintPath>..\..\..\packages\NuGet.ProjectModel.4.8.0\lib\net46\NuGet.ProjectModel.dll</HintPath>
- </Reference>
<Reference Include="System.ComponentModel.Composition" />
- <Reference Include="NuGet.Commands">
- <HintPath>..\..\..\packages\NuGet.Commands.4.8.0\lib\net46\NuGet.Commands.dll</HintPath>
- </Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="WindowsBase" />
- <Reference Include="NuGet.Resolver">
- <HintPath>..\..\..\packages\NuGet.Resolver.4.8.0\lib\net46\NuGet.Resolver.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.PackageManagement">
- <HintPath>..\..\..\packages\NuGet.PackageManagement.4.8.0\lib\net46\NuGet.PackageManagement.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Common">
- <HintPath>..\..\..\packages\NuGet.Common.4.8.0\lib\net46\NuGet.Common.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Protocol">
- <HintPath>..\..\..\packages\NuGet.Protocol.4.8.0\lib\net46\NuGet.Protocol.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Indexing">
- <HintPath>..\..\..\packages\NuGet.Indexing.4.8.0\lib\net46\NuGet.Indexing.dll</HintPath>
- </Reference>
- <Reference Include="NuGet.Credentials">
- <HintPath>..\..\..\packages\NuGet.Credentials.4.8.0\lib\net46\NuGet.Credentials.dll</HintPath>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Lucene.Net">
- <HintPath>..\..\..\packages\Lucene.Net.3.0.3\lib\NET40\Lucene.Net.dll</HintPath>
- </Reference>
+ <PackageReference Include="NuGet.PackageManagement" Version="4.8.2-rtm.5835" PrivateAssets="runtime" />
+ <PackageReference Include="NuGet.Indexing" Version="4.8.2-rtm.5835" PrivateAssets="runtime" />
+ <IncludeCopyLocal Include="Lucene.Net.dll" />
+ <IncludeCopyLocal Include="Microsoft.Web.XmlTransform.dll" />
+ <IncludeCopyLocal Include="NuGet.Commands.dll" />
+ <IncludeCopyLocal Include="NuGet.Common.dll" />
+ <IncludeCopyLocal Include="NuGet.Configuration.dll" />
+ <IncludeCopyLocal Include="NuGet.Credentials.dll" />
+ <IncludeCopyLocal Include="NuGet.DependencyResolver.Core.dll" />
+ <IncludeCopyLocal Include="NuGet.Frameworks.dll" />
+ <IncludeCopyLocal Include="NuGet.Indexing.dll" />
+ <IncludeCopyLocal Include="NuGet.LibraryModel.dll" />
+ <IncludeCopyLocal Include="NuGet.PackageManagement.dll" />
+ <IncludeCopyLocal Include="NuGet.Packaging.dll" />
+ <IncludeCopyLocal Include="NuGet.Packaging.Core.dll" />
+ <IncludeCopyLocal Include="NuGet.ProjectModel.dll" />
+ <IncludeCopyLocal Include="NuGet.Protocol.dll" />
+ <IncludeCopyLocal Include="NuGet.Resolver.dll" />
+ <IncludeCopyLocal Include="NuGet.Versioning.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
diff --git a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs
index 4469d45473..abfd7fb0e0 100644
--- a/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs
+++ b/main/src/addins/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement/PackageManagementWorkspace.cs
@@ -25,7 +25,7 @@
// THE SOFTWARE.
using System;
-using System.Collections.Generic;
+using System.Collections.Immutable;
using System.Linq;
using MonoDevelop.Core;
using MonoDevelop.Ide;
@@ -35,7 +35,7 @@ namespace MonoDevelop.PackageManagement
{
internal class PackageManagementWorkspace
{
- List<MonoDevelopSolutionManager> solutionManagers = new List<MonoDevelopSolutionManager> ();
+ ImmutableList<MonoDevelopSolutionManager> solutionManagers = ImmutableList<MonoDevelopSolutionManager>.Empty;
public PackageManagementWorkspace ()
{
@@ -84,25 +84,33 @@ namespace MonoDevelop.PackageManagement
void AddSolution (Solution solution)
{
var solutionManager = new MonoDevelopSolutionManager (solution);
- solutionManagers.Add (solutionManager);
+ solutionManagers = solutionManagers.Add (solutionManager);
}
void RemoveSolution (Solution solution)
{
- solutionManagers.RemoveAll (manager => manager.Solution == solution);
- }
+ solutionManagers = solutionManagers.RemoveAll (manager => manager.Solution == solution);
+ }
+ /// <summary>
+ /// Get the solution manager.
+ ///
+ /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
+ /// Therefore, it must be thread-safe and not defer to and then block other threads.
+ /// </summary>
public IMonoDevelopSolutionManager GetSolutionManager (Solution solution)
{
- Runtime.AssertMainThread ();
-
return GetSolutionManager (new SolutionProxy (solution));
- }
-
+ }
+
+ /// <summary>
+ /// Get the solution manager.
+ ///
+ /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
+ /// Therefore, it must be thread-safe and not defer to and then block other threads.
+ /// </summary>
public IMonoDevelopSolutionManager GetSolutionManager (ISolution solution)
{
- Runtime.AssertMainThread ();
-
var solutionManager = solutionManagers.FirstOrDefault (manager => manager.Solution == solution.Solution);
if (solutionManager != null) {
return solutionManager;
diff --git a/main/src/addins/MonoDevelop.PackageManagement/packages.config b/main/src/addins/MonoDevelop.PackageManagement/packages.config
deleted file mode 100644
index 841f14de7a..0000000000
--- a/main/src/addins/MonoDevelop.PackageManagement/packages.config
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Lucene.Net" version="3.0.3" targetFramework="net461" />
- <package id="Microsoft.Web.Xdt" version="2.1.2" targetFramework="net461" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
- <package id="NuGet.Commands" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Common" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Configuration" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Credentials" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.DependencyResolver.Core" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Frameworks" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Indexing" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.LibraryModel" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.PackageManagement" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Packaging" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Packaging.Core" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.ProjectModel" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Protocol" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Resolver" version="4.8.0" targetFramework="net461" />
- <package id="NuGet.Versioning" version="4.8.0" targetFramework="net461" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Packaging/Makefile.am b/main/src/addins/MonoDevelop.Packaging/Makefile.am
deleted file mode 100644
index 55e630e362..0000000000
--- a/main/src/addins/MonoDevelop.Packaging/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-SUBDIRS = \
- MonoDevelop.Packaging.Tests
-
-EXTRA_DIST += \
- PostBuild.proj
diff --git a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/Makefile.am b/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/Makefile.am
deleted file mode 100644
index c93d6852fa..0000000000
--- a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
diff --git a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/MonoDevelop.Packaging.Tests.csproj b/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/MonoDevelop.Packaging.Tests.csproj
index 4faec323bc..93d03b862e 100644
--- a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/MonoDevelop.Packaging.Tests.csproj
+++ b/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.Tests/MonoDevelop.Packaging.Tests.csproj
@@ -14,10 +14,6 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -46,6 +42,7 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\tests\UnitTests\UnitTests.csproj">
<Project>{1497D0A8-AFF1-4938-BC22-BE79B358BA5B}</Project>
@@ -60,6 +57,7 @@
<ProjectReference Include="..\..\MonoDevelop.PackageManagement\MonoDevelop.PackageManagement.Tests\MonoDevelop.PackageManagement.Tests.csproj">
<Project>{2645C9F3-9ED5-4806-AB09-DAD9BE90C67B}</Project>
<Name>MonoDevelop.PackageManagement.Tests</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\external\xwt\Xwt\Xwt.csproj">
<Project>{92494904-35FA-4DC9-BDE9-3A3E87AC49D3}</Project>
diff --git a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.csproj b/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.csproj
index e0fa05576c..d1da520ca1 100644
--- a/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.csproj
+++ b/main/src/addins/MonoDevelop.Packaging/MonoDevelop.Packaging.csproj
@@ -7,37 +7,13 @@
<ProjectGuid>{443311BF-766D-4863-B5A1-AFAA7F41DBDA}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\MonoDevelop.Packaging</OutputPath>
+ <_BuildPackagingVersion>0.2.0</_BuildPackagingVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="NuGet.Protocol">
- <HintPath>..\..\..\packages\NuGet.Protocol.4.8.0\lib\net46\NuGet.Protocol.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Packaging">
- <HintPath>..\..\..\packages\NuGet.Packaging.4.8.0\lib\net46\NuGet.Packaging.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Packaging.Core">
- <HintPath>..\..\..\packages\NuGet.Packaging.Core.4.8.0\lib\net46\NuGet.Packaging.Core.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Frameworks">
- <HintPath>..\..\..\packages\NuGet.Frameworks.4.8.0\lib\net46\NuGet.Frameworks.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="NuGet.Versioning">
- <HintPath>..\..\..\packages\NuGet.Versioning.4.8.0\lib\net46\NuGet.Versioning.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
- <Reference Include="NuGet.PackageManagement">
- <HintPath>..\..\..\packages\NuGet.PackageManagement.4.8.0\lib\net46\NuGet.PackageManagement.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -139,19 +115,11 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
- <None Include="Targets\NuGet.Packaging.Authoring.props">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Targets\NuGet.Packaging.Authoring.targets">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\CrossPlatformLibrary.xpt.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\PackagingProject.xpt.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
+ <ExtensionContent Include="Targets\NuGet.Packaging.Authoring.props" />
+ <ExtensionContent Include="Targets\NuGet.Packaging.Authoring.targets" />
+ <ExtensionContent Include="Templates\CrossPlatformLibrary.xpt.xml" />
+ <ExtensionContent Include="Templates\PackagingProject.xpt.xml" />
+ <DownloadNupkg Include="NuGet.Build.Packaging" Version="$(_BuildPackagingVersion)" ExtensionDir="packages" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <Import Project="PostBuild.proj" />
</Project>
diff --git a/main/src/addins/MonoDevelop.Packaging/PostBuild.proj b/main/src/addins/MonoDevelop.Packaging/PostBuild.proj
deleted file mode 100644
index a4cf027077..0000000000
--- a/main/src/addins/MonoDevelop.Packaging/PostBuild.proj
+++ /dev/null
@@ -1,12 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <PrepareForRunDependsOn>$(PrepareForRunDependsOn);_MyPostBuildTarget</PrepareForRunDependsOn>
- <_BuildPackagingVersion>0.2.0</_BuildPackagingVersion>
- </PropertyGroup>
- <ItemGroup>
- <_MyNuGetPackage Include="$(MSBuildProjectDirectory)\..\..\..\packages\NuGet.Build.Packaging.$(_BuildPackagingVersion)\NuGet.Build.Packaging.$(_BuildPackagingVersion).nupkg" />
- </ItemGroup>
- <Target Name="_MyPostBuildTarget">
- <Copy SourceFiles="@(_MyNuGetPackage)" DestinationFolder="$(OutputPath)\packages" SkipUnchangedFiles="true" />
- </Target>
-</Project>
diff --git a/main/src/addins/MonoDevelop.Packaging/packages.config b/main/src/addins/MonoDevelop.Packaging/packages.config
deleted file mode 100644
index 637655fbb5..0000000000
--- a/main/src/addins/MonoDevelop.Packaging/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="NuGet.Build.Packaging" version="0.2.0" targetFramework="net45" />
-</packages>
diff --git a/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs b/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
index 82feeebed9..dd2f65ac3e 100644
--- a/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/AddinInfo.cs
@@ -15,4 +15,5 @@ using Mono.Addins.Description;
[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("SourceEditor2", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("RegexToolkit", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.Refactoring/Makefile.am b/main/src/addins/MonoDevelop.Refactoring/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.Refactoring/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.FloatingQuickFixIconWidget.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.FloatingQuickFixIconWidget.cs
index 270a1ca5a6..da38d852b2 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.FloatingQuickFixIconWidget.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.FloatingQuickFixIconWidget.cs
@@ -47,7 +47,12 @@ namespace MonoDevelop.AnalysisCore.Gui
readonly Cairo.Point point;
uint destroyTimeout;
- public FloatingQuickFixIconWidget (CodeActionEditorExtension codeActionEditorExtension, LanguageItemWindow window, SourceEditorView sourceEditorView, CodeActionContainer fixes, Cairo.Point point) : base (Gtk.WindowType.Popup)
+ public FloatingQuickFixIconWidget (
+ CodeActionEditorExtension codeActionEditorExtension,
+ LanguageItemWindow window,
+ SourceEditorView sourceEditorView,
+ CodeActionContainer fixes,
+ Cairo.Point point) : base (Gtk.WindowType.Popup)
{
this.ext = codeActionEditorExtension;
this.window = window;
@@ -94,7 +99,7 @@ namespace MonoDevelop.AnalysisCore.Gui
ext.CancelSmartTagPopupTimeout ();
ext.smartTagPopupTimeoutId = GLib.Timeout.Add (150, delegate {
ext.PopupQuickFixMenu (null, fixes, menu => { }, new Xwt.Point (
- point.X,
+ point.X,
point.Y + Allocation.Height + 10));
ext.smartTagPopupTimeoutId = 0;
return false;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
index e72923f9c3..58bcf884e6 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultTooltipProvider.cs
@@ -49,10 +49,11 @@ using MonoDevelop.Ide;
namespace MonoDevelop.AnalysisCore.Gui
{
+ [Obsolete ("Old editor")]
partial class ResultTooltipProvider : TooltipProvider
{
#region ITooltipProvider implementation
- public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default (CancellationToken))
+ public override async Task<TooltipItem> GetItem (Ide.Editor.TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default (CancellationToken))
{
var results = new List<Result> ();
int markerOffset = -1, markerEndOffset = -1;
@@ -149,7 +150,7 @@ namespace MonoDevelop.AnalysisCore.Gui
return new TooltipItem (tooltipInfo, markerOffset, markerEndOffset - markerOffset);
}
- public override Window CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
+ public override Window CreateTooltipWindow (Ide.Editor.TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
var result = item.Item as TooltipInformation;
if (result == null)
@@ -165,9 +166,9 @@ namespace MonoDevelop.AnalysisCore.Gui
return window;
}
- public override void GetRequiredPosition (TextEditor editor, Window tipWindow, out int requiredWidth, out double xalign)
+ public override void GetRequiredPosition (Ide.Editor.TextEditor editor, Window tipWindow, out int requiredWidth, out double xalign)
{
- var win = (LanguageItemWindow) tipWindow;
+ var win = (LanguageItemWindow)tipWindow;
requiredWidth = win.SetMaxWidth (win.Screen.Width / 4);
xalign = 0.5;
}
@@ -176,7 +177,7 @@ namespace MonoDevelop.AnalysisCore.Gui
const int xPadding = 4;
const int windowSize = 36;
- protected override Xwt.Point CalculateWindowLocation (TextEditor editor, TooltipItem item, Xwt.WindowFrame xwtWindow, int mouseX, int mouseY, Xwt.Point origin)
+ protected override Xwt.Point CalculateWindowLocation (Ide.Editor.TextEditor editor, TooltipItem item, Xwt.WindowFrame xwtWindow, int mouseX, int mouseY, Xwt.Point origin)
{
int w;
double xalign;
@@ -212,7 +213,7 @@ namespace MonoDevelop.AnalysisCore.Gui
return new Xwt.Point (x, y);
}
- public override void ShowTooltipWindow (TextEditor editor, Components.Window tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
+ public override void ShowTooltipWindow (Ide.Editor.TextEditor editor, Components.Window tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
{
base.ShowTooltipWindow (editor, tipWindow, item, modifierState, mouseX, mouseY);
var info = (TaggedTooltipInformation<CodeActions.CodeActionContainer>)item.Item;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
index b2768902cb..3db1c4740a 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/Gui/ResultsEditorExtension.cs
@@ -52,13 +52,14 @@ using MonoDevelop.Ide.Gui;
namespace MonoDevelop.AnalysisCore.Gui
{
+ [Obsolete ("Old editor")]
class AnalysisDocument
{
- public TextEditor Editor { get; private set; }
+ public Ide.Editor.TextEditor Editor { get; private set; }
public DocumentLocation CaretLocation { get; private set; }
public DocumentContext DocumentContext { get; private set; }
- public AnalysisDocument (TextEditor editor, DocumentContext documentContext)
+ public AnalysisDocument (Ide.Editor.TextEditor editor, DocumentContext documentContext)
{
this.Editor = editor;
this.CaretLocation = editor.CaretLocation;
@@ -66,6 +67,7 @@ namespace MonoDevelop.AnalysisCore.Gui
}
}
+ [Obsolete ("Old editor")]
public class ResultsEditorExtension : TextEditorExtension, IQuickTaskProvider
{
bool disposed;
@@ -320,7 +322,7 @@ namespace MonoDevelop.AnalysisCore.Gui
GLib.Idle.Add (IdleHandler);
}
- static Cairo.Color GetColor (TextEditor editor, Result result)
+ static Cairo.Color GetColor (Ide.Editor.TextEditor editor, Result result)
{
switch (result.Level) {
case DiagnosticSeverity.Hidden:
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
index 6fb4d6c177..38dd1c42a4 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs
@@ -54,6 +54,7 @@ using Gdk;
namespace MonoDevelop.CodeActions
{
+ [Obsolete ("Old editor")]
class CodeActionEditorExtension : TextEditorExtension
{
const int menuTimeout = 150;
@@ -425,8 +426,10 @@ namespace MonoDevelop.CodeActions
[CommandHandler (RefactoryCommands.QuickFix)]
void OnQuickFixCommand ()
{
- if (!AnalysisOptions.EnableFancyFeatures || smartTagMarginMarker == null) {
- //Fixes = RefactoringService.GetValidActions (Editor, DocumentContext, Editor.CaretLocation).Result;
+ if (!AnalysisOptions.EnableFancyFeatures
+ || smartTagMarginMarker == null
+ ) {
+ // Fixes = RefactoringService.GetValidActions (Editor, DocumentContext, Editor.CaretLocation).Result;
PopupQuickFixMenu (null, null);
return;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeFixMenuService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeFixMenuService.cs
index bb43e7b75f..c211e4d2a7 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeFixMenuService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeFixMenuService.cs
@@ -53,9 +53,10 @@ using MonoDevelop.AnalysisCore;
namespace MonoDevelop.CodeActions
{
+ [Obsolete ("Old editor")]
internal static class CodeFixMenuService
{
- public static CodeFixMenu CreateFixMenu (TextEditor editor, CodeActionContainer fixes, CancellationToken cancellationToken = default(CancellationToken))
+ public static CodeFixMenu CreateFixMenu (Ide.Editor.TextEditor editor, CodeActionContainer fixes, CancellationToken cancellationToken = default(CancellationToken))
{
var menu = new CodeFixMenu ();
@@ -155,7 +156,7 @@ namespace MonoDevelop.CodeActions
return desc.CustomTags.Any (c => CultureInfo.InvariantCulture.CompareInfo.Compare (c, tag) == 0);
}
- static CodeFixMenuEntry CreateFixMenuEntry (TextEditor editor, CodeAction fix, ref int mnemonic)
+ static CodeFixMenuEntry CreateFixMenuEntry (Ide.Editor.TextEditor editor, CodeAction fix, ref int mnemonic)
{
var label = mnemonic < 0 ? fix.Title : CreateLabel (fix.Title, ref mnemonic);
var item = new CodeFixMenuEntry (label, async delegate {
@@ -169,7 +170,7 @@ namespace MonoDevelop.CodeActions
return item;
}
- static CodeFixMenuEntry CreateFixAllMenuEntry (TextEditor editor, FixAllState fixState, ref int mnemonic, CancellationToken token)
+ static CodeFixMenuEntry CreateFixAllMenuEntry (Ide.Editor.TextEditor editor, FixAllState fixState, ref int mnemonic, CancellationToken token)
{
var provider = fixState?.FixAllProvider;
if (provider == null)
@@ -214,7 +215,7 @@ namespace MonoDevelop.CodeActions
return item;
}
- static void AddFixMenuItem (TextEditor editor, CodeFixMenu menu, CodeFixMenu fixAllMenu, ref int mnemonic, CodeAction fix, FixAllState fixState, CancellationToken token)
+ static void AddFixMenuItem (Ide.Editor.TextEditor editor, CodeFixMenu menu, CodeFixMenu fixAllMenu, ref int mnemonic, CodeAction fix, FixAllState fixState, CancellationToken token)
{
if (fix is CodeAction.CodeActionWithNestedActions nested) {
// Inline code actions if they are, otherwise add a nested fix menu
@@ -244,7 +245,7 @@ namespace MonoDevelop.CodeActions
}
}
- static void AddNestedFixMenu (TextEditor editor, CodeFixMenu menu, CodeFixMenu fixAllMenu, CodeAction.CodeActionWithNestedActions fixes, FixAllState fixState, CancellationToken token)
+ static void AddNestedFixMenu (Ide.Editor.TextEditor editor, CodeFixMenu menu, CodeFixMenu fixAllMenu, CodeAction.CodeActionWithNestedActions fixes, FixAllState fixState, CancellationToken token)
{
int subMnemonic = 0;
var subMenu = new CodeFixMenu (fixes.Title);
@@ -267,10 +268,10 @@ namespace MonoDevelop.CodeActions
internal class ContextActionRunner
{
readonly CodeAction act;
- readonly TextEditor editor;
+ readonly Ide.Editor.TextEditor editor;
DocumentContext documentContext;
- public ContextActionRunner (TextEditor editor, CodeAction act)
+ public ContextActionRunner (Ide.Editor.TextEditor editor, CodeAction act)
{
this.editor = editor;
this.act = act;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/FixAllPreviewDialog.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/FixAllPreviewDialog.cs
index c2dc09c9c7..857a319027 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/FixAllPreviewDialog.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/FixAllPreviewDialog.cs
@@ -57,11 +57,11 @@ namespace MonoDevelop.CodeActions
readonly DataField<int> nodeOffset = new DataField<int> ();
readonly TreeView treeView;
readonly TreeStore store;
- readonly TextEditor baseEditor, changedEditor;
+ readonly Ide.Editor.TextEditor baseEditor, changedEditor;
readonly ImmutableArray<CodeActionOperation> operations;
CheckBoxCellView checkBox;
- public FixAllPreviewDialog (string diagnosticId, string scopeLabel, FixAllScope scope, ImmutableArray<CodeActionOperation> operations, TextEditor baseEditor)
+ public FixAllPreviewDialog (string diagnosticId, string scopeLabel, FixAllScope scope, ImmutableArray<CodeActionOperation> operations, Ide.Editor.TextEditor baseEditor)
{
Width = 800;
Height = 600;
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticRunner.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticRunner.cs
index 0eab63ff83..120e57762c 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticRunner.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeDiagnosticRunner.cs
@@ -46,6 +46,7 @@ using System.Globalization;
namespace MonoDevelop.CodeIssues
{
+ [Obsolete ("Old editor")]
static class CodeDiagnosticRunner
{
public static async Task<IEnumerable<Result>> Check (AnalysisDocument analysisDocument, CancellationToken cancellationToken, ImmutableArray<DiagnosticData> results)
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeRulePanel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeRulePanel.cs
index ae23d4bfec..bc23b96d2b 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeRulePanel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/CodeRulePanel.cs
@@ -57,7 +57,7 @@ namespace MonoDevelop.CodeIssues
readonly Encoding encoding;
readonly bool loadingError;
- public TextEditor TextEditor { get; private set; }
+ public Ide.Editor.TextEditor TextEditor { get; private set; }
public CodeRulePanelWidget ()
{
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceDialog.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceDialog.cs
index aa10121561..2c9032febf 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceDialog.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceDialog.cs
@@ -23,18 +23,18 @@
// 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 System;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Notification;
-using Microsoft.CodeAnalysis.LanguageServices;
using System.Collections.Generic;
-using Xwt;
-using MonoDevelop.Ide;
-using MonoDevelop.Components;
using System.Linq;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.LanguageServices;
+using Microsoft.CodeAnalysis.Notification;
+using MonoDevelop.Components.AtkCocoaHelper;
using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using Xwt;
using Xwt.Drawing;
-using MonoDevelop.Components.AtkCocoaHelper;
namespace MonoDevelop.Refactoring.ExtractInterface
{
@@ -83,9 +83,16 @@ namespace MonoDevelop.Refactoring.ExtractInterface
}
}
+ public bool UseSameFile {
+ get {
+ return sameFileRadio.Active;
+ }
+ }
+
TextEntry entryFileName = new TextEntry ();
TextEntry entryName = new TextEntry ();
ListView listViewPublicMembers = new ListView ();
+ RadioButton sameFileRadio, newFileRadio;
public ExtractInterfaceDialog ()
{
@@ -144,14 +151,34 @@ namespace MonoDevelop.Refactoring.ExtractInterface
entryName.Changed += delegate {
UpdateOkButton ();
};
- box.PackStart (new Label {
- Markup = GettextCatalog.GetString ("File name:")
- });
- box.PackStart (entryFileName);
+ sameFileRadio = new RadioButton (GettextCatalog.GetString ("Add to current file")) {
+ Name = "sameFileRadio.Name"
+ };
+ sameFileRadio.Accessible.Description = GettextCatalog.GetString ("Add the new interface to the current file");
+
+ newFileRadio = new RadioButton (GettextCatalog.GetString ("File name:")) {
+ Group = sameFileRadio.Group,
+ Name = "newFileRadio.Name"
+ };
+ newFileRadio.Accessible.Description = GettextCatalog.GetString ("Add the new interface to a new file");
+ newFileRadio.Active = true;
+ newFileRadio.ActiveChanged += (sender, e) => entryFileName.Sensitive = newFileRadio.Active;
+
+ var fileNameBox = new HBox ();
+ fileNameBox.PackStart (newFileRadio);
+ fileNameBox.PackStart (entryFileName, true, true);
+
+ box.PackStart (new Label { Markup = GettextCatalog.GetString ("Select destination") });
+ var radioBox = new VBox { Margin = new WidgetSpacing (12, 4, 4, 4) };
+ radioBox.PackStart (sameFileRadio);
+ radioBox.PackStart (fileNameBox);
+
entryFileName.Name = "entryFileName.Name";
- entryFileName.SetCommonAccessibilityAttributes (entryFileName.Name, GettextCatalog.GetString ("Name of the new file"),
- GettextCatalog.GetString ("The name of the file for the new interface"));
+ entryFileName.SetCommonAccessibilityAttributes (
+ entryFileName.Name,
+ GettextCatalog.GetString ("Name of the new file"),
+ GettextCatalog.GetString ("The name of the file for the new interface"));
entryFileName.Changed += delegate {
UpdateOkButton ();
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceOptionService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceOptionService.cs
index dff9b26458..c12bf94ebe 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceOptionService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.ExtractInterface/ExtractInterfaceOptionService.cs
@@ -23,38 +23,67 @@
// 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 System;
+
+using System.Collections.Generic;
+using System.Composition;
+using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ExtractInterface;
-using Microsoft.CodeAnalysis.Notification;
using Microsoft.CodeAnalysis.Host.Mef;
-using System.Composition;
-using MonoDevelop.Core;
using Microsoft.CodeAnalysis.LanguageServices;
-using System.Collections.Generic;
+using Microsoft.CodeAnalysis.Notification;
namespace MonoDevelop.Refactoring.ExtractInterface
{
[ExportWorkspaceService (typeof (IExtractInterfaceOptionsService), ServiceLayer.Default), Shared]
class ExtractInterfaceOptionsService : IExtractInterfaceOptionsService
{
- public ExtractInterfaceOptionsResult GetExtractInterfaceOptions (ISyntaxFactsService syntaxFactsService, INotificationService notificationService, List<ISymbol> extractableMembers, string defaultInterfaceName, List<string> conflictingTypeNames, string defaultNamespace, string generatedNameTypeParameterSuffix, string languageName)
+ readonly IThreadingContext threadingContext;
+
+ [ImportingConstructor]
+ public ExtractInterfaceOptionsService (IThreadingContext threadingContext)
+ {
+ this.threadingContext = threadingContext;
+ }
+
+ public async Task<ExtractInterfaceOptionsResult> GetExtractInterfaceOptionsAsync (
+ ISyntaxFactsService syntaxFactsService,
+ INotificationService notificationService,
+ List<ISymbol> extractableMembers,
+ string defaultInterfaceName,
+ List<string> conflictingTypeNames,
+ string defaultNamespace,
+ string generatedNameTypeParameterSuffix,
+ string languageName)
{
+ await threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync ();
var dialog = new ExtractInterfaceDialog ();
- try {
- dialog.Init (syntaxFactsService, notificationService, extractableMembers, defaultInterfaceName, conflictingTypeNames, defaultNamespace, generatedNameTypeParameterSuffix, languageName);
- bool performChange = dialog.Run () == Xwt.Command.Ok;
- if (!performChange)
- return ExtractInterfaceOptionsResult.Cancelled;
-
- return new ExtractInterfaceOptionsResult (false, dialog.IncludedMembers, dialog.InterfaceName, dialog.FileName);
- } catch (Exception ex) {
- LoggingService.LogError ("Error while signature changing.", ex);
+
+ dialog.Init (
+ syntaxFactsService,
+ notificationService,
+ extractableMembers,
+ defaultInterfaceName,
+ conflictingTypeNames,
+ defaultNamespace,
+ generatedNameTypeParameterSuffix,
+ languageName);
+
+ bool performChange = dialog.Run () == Xwt.Command.Ok;
+ if (!performChange)
return ExtractInterfaceOptionsResult.Cancelled;
- } finally {
- dialog.Dispose ();
- }
+
+ return new ExtractInterfaceOptionsResult (
+ false,
+ dialog.IncludedMembers.AsImmutable (),
+ dialog.InterfaceName,
+ dialog.FileName,
+ dialog.UseSameFile
+ ? ExtractInterfaceOptionsResult.ExtractLocation.SameFile
+ : ExtractInterfaceOptionsResult.ExtractLocation.NewFile
+ );
}
}
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/AbstractOptionPreviewViewModel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/AbstractOptionPreviewViewModel.cs
index 43817ec03d..a014ea9992 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/AbstractOptionPreviewViewModel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/AbstractOptionPreviewViewModel.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractOptionPreviewViewModel.cs
//
// Author:
@@ -49,7 +49,7 @@ namespace MonoDevelop.Refactoring.Options
{
internal abstract class AbstractOptionPreviewViewModel : AbstractNotifyPropertyChanged, IDisposable
{
- private TextEditor _textViewHost;
+ private Ide.Editor.TextEditor _textViewHost;
private PreviewWorkspace curWorkspace;
private Microsoft.CodeAnalysis.Project project;
@@ -100,7 +100,7 @@ namespace MonoDevelop.Refactoring.Options
UpdateDocument (preview);
}
- public TextEditor TextViewHost {
+ public Ide.Editor.TextEditor TextViewHost {
get {
return _textViewHost;
}
@@ -179,8 +179,10 @@ namespace MonoDevelop.Refactoring.Options
public override MonoDevelop.Projects.Project Project => null;
+ [Obsolete]
public override Document AnalysisDocument => document;
+ [Obsolete]
public override ParsedDocument ParsedDocument => null;
public override void AttachToProject (MonoDevelop.Projects.Project project)
@@ -192,10 +194,12 @@ namespace MonoDevelop.Refactoring.Options
return null;
}
+ [Obsolete]
public override void ReparseDocument ()
{
}
+ [Obsolete]
public override Task<ParsedDocument> UpdateParseDocument ()
{
return new Task<ParsedDocument> (null);
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/CheckBoxWithComboOptionViewModel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/CheckBoxWithComboOptionViewModel.cs
index 6c74fd5b07..a673902234 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/CheckBoxWithComboOptionViewModel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/CheckBoxWithComboOptionViewModel.cs
@@ -1,4 +1,4 @@
-//
+//
// CheckBoxWithComboOptionViewModel.cs
//
// Author:
@@ -56,7 +56,7 @@ namespace MonoDevelop.Refactoring.Options
var codeStyleOption = ((CodeStyleOption<bool>)options.GetOption (new OptionKey (option, option.IsPerLanguage ? info.Language : null)));
SetProperty (ref _isChecked, codeStyleOption.Value);
- var notificationViewModel = items.Where (i => i.Notification.Value == codeStyleOption.Notification.Value).Single ();
+ var notificationViewModel = items.Where (i => i.Notification.Severity == codeStyleOption.Notification.Severity).Single ();
SetProperty (ref _selectedNotificationOption, notificationViewModel);
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/AbstractCodeStyleOptionViewModel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/AbstractCodeStyleOptionViewModel.cs
index a0191337f3..0d02d605c1 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/AbstractCodeStyleOptionViewModel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/AbstractCodeStyleOptionViewModel.cs
@@ -92,7 +92,8 @@ namespace MonoDevelop.Refactoring.Options
new NotificationOptionViewModel(NotificationOption.None, "issues-hide"),
new NotificationOptionViewModel(NotificationOption.Suggestion, "issues-suggestion"),
new NotificationOptionViewModel(NotificationOption.Warning, "issues-warning"),
- new NotificationOptionViewModel(NotificationOption.Error, "issues-error")
+ new NotificationOptionViewModel(NotificationOption.Error, "issues-error"),
+ new NotificationOptionViewModel(NotificationOption.Silent, "issues-hide")
};
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/BooleanCodeStyleOptionViewModel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/BooleanCodeStyleOptionViewModel.cs
index 6d17a84268..a45c931394 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/BooleanCodeStyleOptionViewModel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/BooleanCodeStyleOptionViewModel.cs
@@ -1,4 +1,4 @@
-//
+//
// BooleanCodeStyleOptionViewModel.cs
//
// Author:
@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.CodeStyle;
using Microsoft.CodeAnalysis.Options;
+using System;
namespace MonoDevelop.Refactoring.Options
{
@@ -58,11 +59,13 @@ namespace MonoDevelop.Refactoring.Options
_truePreview = truePreview;
_falsePreview = falsePreview;
- var codeStyleOption = ((CodeStyleOption<bool>)options.GetOption (new OptionKey (option, option.IsPerLanguage ? info.Language : null)));
+ var optionValue = options.GetOption (new OptionKey (option, option.IsPerLanguage ? info.Language : null));
+ if (!(optionValue is CodeStyleOption<bool> codeStyleOption))
+ throw new InvalidOperationException (optionValue + " is no CodeStyleOption<bool>. Queried option: " + option);
_selectedPreference = Preferences.Single (c => c.IsChecked == codeStyleOption.Value);
- var notificationViewModel = NotificationPreferences.Single (i => i.Notification.Value == codeStyleOption.Notification.Value);
- _selectedNotificationPreference = NotificationPreferences.Single (p => p.Notification.Value == notificationViewModel.Notification.Value);
+ var notificationViewModel = NotificationPreferences.Single (i => i.Notification.Severity == codeStyleOption.Notification.Severity);
+ _selectedNotificationPreference = NotificationPreferences.Single (p => p.Notification.Severity == notificationViewModel.Notification.Severity);
NotifyPropertyChanged (nameof (SelectedPreference));
NotifyPropertyChanged (nameof (SelectedNotificationPreference));
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/EnumCodeStyleOptionViewModel.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/EnumCodeStyleOptionViewModel.cs
index a7a51b92d2..bfd129309f 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/EnumCodeStyleOptionViewModel.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Options/Style/EnumCodeStyleOptionViewModel.cs
@@ -1,4 +1,4 @@
-//
+//
// EnumCodeStyleOptionViewModel.cs
//
// Author:
@@ -114,8 +114,8 @@ namespace MonoDevelop.Refactoring.Options
_selectedPreference = Preferences [enumIndex];
- var notificationViewModel = NotificationPreferences.Single (i => i.Notification.Value == codeStyleOption.Notification.Value);
- _selectedNotificationPreference = NotificationPreferences.Single (p => p.Notification.Value == notificationViewModel.Notification.Value);
+ var notificationViewModel = NotificationPreferences.Single (i => i.Notification.Severity == codeStyleOption.Notification.Severity);
+ _selectedNotificationPreference = NotificationPreferences.Single (p => p.Notification.Severity == notificationViewModel.Notification.Severity);
NotifyPropertyChanged (nameof (SelectedPreference));
NotifyPropertyChanged (nameof (SelectedNotificationPreference));
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs
index ea499f5c42..cbcc70072a 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.PackageInstaller/PackageInstallerService.cs
@@ -96,6 +96,12 @@ namespace MonoDevelop.Refactoring.PackageInstaller
{
readonly ConcurrentDictionary<ProjectId, Dictionary<string, string>> _projectToInstalledPackageAndVersion = new ConcurrentDictionary<ProjectId, Dictionary<string, string>> ();
+ /// <summary>
+ /// Get package sources.
+ ///
+ /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
+ /// Therefore, it must be thread-safe and not defer to and then block other threads.
+ /// </summary>
public ImmutableArray<PackageSource> PackageSources {
get {
return PackageServices.GetSources (false, false).Select (kv => new PackageSource (kv.Key, kv.Value)) .ToImmutableArray ();
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
index 4b88f7f965..bea7f9866d 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.Rename/RenameRefactoring.cs
@@ -69,7 +69,7 @@ namespace MonoDevelop.Refactoring.Rename
}
}
- static void Rollback (TextEditor editor, List<MonoDevelop.Core.Text.TextChangeEventArgs> textChanges)
+ static void Rollback (Ide.Editor.TextEditor editor, List<MonoDevelop.Core.Text.TextChangeEventArgs> textChanges)
{
for (int i = textChanges.Count - 1; i >= 0; i--) {
for (int j = 0; j < textChanges [i].TextChanges.Count; ++j) {
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.SignatureChange/SignatureChangeDialog.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.SignatureChange/SignatureChangeDialog.cs
index a97aa2097e..726848a419 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.SignatureChange/SignatureChangeDialog.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.SignatureChange/SignatureChangeDialog.cs
@@ -1,4 +1,4 @@
-//
+//
// SignatureChangeDialog.cs
//
// Author:
@@ -39,7 +39,7 @@ namespace MonoDevelop.Refactoring.SignatureChange
{
partial class SignatureChangeDialog : Gtk.Dialog
{
- TextEditor previewEditor;
+ Ide.Editor.TextEditor previewEditor;
ISymbol symbol;
ParameterConfiguration parameters;
ListStore store = new ListStore (typeof (IParameterSymbol));
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
index 7799c98405..48ee77a37a 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml
@@ -1,4 +1,4 @@
-<ExtensionModel>
+<ExtensionModel>
<Runtime>
<Import assembly="RefactoringEssentials.dll" />
</Runtime>
@@ -52,6 +52,16 @@
<Extension path = "/MonoDevelop/Ide/Commands">
<Category _name = "Code Navigation" id = "CodeNavigation">
+ <Command id = "MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration"
+ _label = "_Go to Declaration"
+ shortcut = "F12"
+ macShortcut = "Meta|D F12"/>
+
+ <Command id = "MonoDevelop.Refactoring.RefactoryCommands.GotoImplementation"
+ _label = "Go to Implementation"
+ shortcut="Ctrl|F12"
+ macShortcut=""/>
+
<Command id = "MonoDevelop.Refactoring.RefactoryCommands.FindReferences"
_label = "_Find References"
shortcut = "Shift|F12"
@@ -171,4 +181,32 @@
<Assembly file="Microsoft.CodeAnalysis.VisualBasic.Features" />
</Extension>
+ <Extension path = "/MonoDevelop/TextEditor/CommandMapping">
+ <Map id="MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.GoToDefinitionCommandArgs" />
+ <Map id="MonoDevelop.Refactoring.RefactoryCommands.FindReferences" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.FindReferencesCommandArgs" />
+ <Map id="MonoDevelop.Refactoring.RefactoryCommands.GotoImplementation" argsType="@MonoDevelop.Refactoring.CommandArgsFactories.CreateGoToImplementationCommandArgs" />
+
+ <!-- These mappings exist to ensure the new editor calls the new commands -->
+ <Map id="MonoDevelop.Refactoring.RefactoryCommands.FindAllReferences" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindReferencesOfOverloadsCommandArgs" />
+ <Map id="MonoDevelop.Refactoring.Navigation.FindBaseSymbols" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindBaseSymbolsCommandArgs" />
+ <Map id="MonoDevelop.Refactoring.Navigation.FindDerivedSymbols" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindDerivedSymbolsCommandArgs" />
+
+ <Map id="MonoDevelop.CSharp.Navigation.FindExtensionMethods" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindExtensionMethodsCommandArgs" />
+ <Map id="MonoDevelop.CSharp.Navigation.FindMemberOverloads" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindMemberOverloadsCommandArgs" />
+ <Map id="MonoDevelop.CSharp.Navigation.FindImplementingMembers" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.Navigation.FindImplementingMembersCommandArgs" />
+ </Extension>
+
+ <Extension path="/MonoDevelop/TextEditor/ContextMenu/Editor">
+ <Condition id="FileType" mimeTypes="text/x-csharp">
+ <ItemSet id="Navigate" _label="Navigate" insertbefore="Separator1">
+ <CommandItem id="MonoDevelop.Refactoring.RefactoryCommands.FindAllReferences" />
+ <CommandItem id="MonoDevelop.Refactoring.Navigation.FindBaseSymbols" />
+ <CommandItem id="MonoDevelop.Refactoring.Navigation.FindDerivedSymbols" />
+ <SeparatorItem id="SeparatorNavigate1" />
+ <CommandItem id="MonoDevelop.CSharp.Navigation.FindExtensionMethods" />
+ <CommandItem id="MonoDevelop.CSharp.Navigation.FindMemberOverloads" />
+ <CommandItem id="MonoDevelop.CSharp.Navigation.FindImplementingMembers" />
+ </ItemSet>
+ </Condition>
+ </Extension>
</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
index ec4728fa34..9dbaaeb982 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
@@ -1,7 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesGtk)" />
- <Import Project="$(ReferencesRoslyn)" />
<Import Project="$(ReferencesVSEditor)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -26,38 +25,7 @@
<HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="System.Composition.AttributedModel">
- <HintPath>..\..\..\build\bin\System.Composition.AttributedModel.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Composition.Runtime">
- <HintPath>..\..\..\build\bin\System.Composition.Runtime.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Composition.TypedParts">
- <HintPath>..\..\..\build\bin\System.Composition.TypedParts.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Composition.Hosting">
- <HintPath>..\..\..\build\bin\System.Composition.Hosting.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Threading.Tasks.Extensions">
- <HintPath>..\..\..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Composition">
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.Composition.dll</HintPath>
- <Private>False</Private>
- </Reference>
+ <IncludeCopyLocal Include="RefactoringEssentials.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
@@ -136,6 +104,8 @@
<Compile Include="MonoDevelop.CodeActions\FixAllPreviewDialog.cs" />
<Compile Include="MonoDevelop.AnalysisCore\Gui\ResultTooltipProvider.FloatingQuickFixIconWidget.cs" />
<Compile Include="MonoDevelop.AnalysisCore\Gui\ResultTooltipProvider.RectangleMarker.cs" />
+ <Compile Include="MonoDevelop.Refactoring\StreamingFindUsagesPresenter.cs" />
+ <Compile Include="MonoDevelop.Refactoring\CommandArgsFactories.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.Refactoring.addin.xml" />
@@ -210,6 +180,11 @@
<Name>RefactoringEssentials</Name>
<Private>True</Private>
</ProjectReference>
+ <ProjectReference Include="..\MonoDevelop.TextEditor\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj">
+ <Project>{3f5b5bda-69d5-441a-8142-aa25c998a997}</Project>
+ <Name>MonoDevelop.TextEditor</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="FSharpBinding" />
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs
index 61d74fbf85..41d35c70a5 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Change.cs
@@ -83,7 +83,7 @@ namespace MonoDevelop.Refactoring
set;
}
- static List<TextEditor> textEditorDatas = new List<TextEditor> ();
+ static List<Ide.Editor.TextEditor> textEditorDatas = new List<Ide.Editor.TextEditor> ();
static List<IDisposable> undoGroups = new List<IDisposable> ();
public static void FinishRefactoringOperation ()
@@ -93,7 +93,7 @@ namespace MonoDevelop.Refactoring
undoGroups.Clear ();
}
- internal static TextEditor GetTextEditorData (string fileName)
+ internal static Ide.Editor.TextEditor GetTextEditorData (string fileName)
{
if (IdeApp.Workbench == null)
return null;
@@ -113,7 +113,7 @@ namespace MonoDevelop.Refactoring
}
return null;
}
- protected virtual TextEditor TextEditorData {
+ protected virtual Ide.Editor.TextEditor TextEditorData {
get {
return GetTextEditorData (FileName);
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs
new file mode 100644
index 0000000000..d9b3915571
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/CommandArgsFactories.cs
@@ -0,0 +1,36 @@
+//
+// CommandArgsFactories.cs
+//
+//
+// Copyright (c) 2019 Microsoft
+//
+// 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 Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.CodeAnalysis.Editor.Commanding.Commands;
+
+namespace MonoDevelop.Refactoring
+{
+ static class CommandArgsFactories
+ {
+ public static GoToImplementationCommandArgs CreateGoToImplementationCommandArgs (ITextView v, ITextBuffer b)
+ => new GoToImplementationCommandArgs (v, b);
+ }
+}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs
index a07a27ec68..a8f7586837 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/Commands.cs
@@ -32,6 +32,8 @@ namespace MonoDevelop.Refactoring
{
CurrentRefactoryOperations,
GotoDeclaration, // in 'referenced' in IdeViMode.cs as string
+ GotoImplementation,
+ SortAndRemoveUnnecessaryImports,
FindReferences,
FindAllReferences,
FindDerivedClasses,
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
index 88df7bd27c..fb4fafba84 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/InsertionPointService.cs
@@ -1,4 +1,4 @@
-//
+//
// InsertionPointService.cs
//
// Author:
@@ -37,27 +37,9 @@ using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Refactoring
{
+ [Obsolete ("Not supported in new editor")]
public static class InsertionPointService
{
- [Obsolete ("Use overload that takes a SemanticModel")]
- public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, ParsedDocument parsedDocument, ITypeSymbol type, int position)
- {
- if (data == null)
- throw new ArgumentNullException (nameof (data));
- if (parsedDocument == null)
- throw new ArgumentNullException (nameof (parsedDocument));
- if (type == null)
- throw new ArgumentNullException (nameof (type));
- if (!type.IsDefinedInSource ())
- throw new ArgumentException ("The given type needs to be defined in source code.", nameof (type));
-
- // update type from parsed document, since this is always newer.
- //type = parsedDocument.GetInnermostTypeDefinition (type.GetLocation ()) ?? type;
- //var realStartLocation = data.OffsetToLocation (offset);
- var model = parsedDocument.GetAst<SemanticModel> ();
- return GetInsertionPoints (data, model, type, position);
- }
-
public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, SemanticModel model, ITypeSymbol type, Location location)
{
return GetInsertionPoints (data, model, type, location.SourceSpan.Start);
@@ -153,12 +135,6 @@ namespace MonoDevelop.Refactoring
return result;
}
- [Obsolete ("Use overload that takes a SemanticModel")]
- public static List<InsertionPoint> GetInsertionPoints (IReadonlyTextDocument data, ParsedDocument parsedDocument, ITypeSymbol type, Location location)
- {
- return GetInsertionPoints (data, parsedDocument, type, location.SourceSpan.Start);
- }
-
static void CheckEndPoint (IReadonlyTextDocument doc, InsertionPoint point, bool isStartPoint)
{
var line = doc.GetLine (point.Location.Line);
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
index d8dad6141f..a6c039dd19 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringOptions.cs
@@ -43,7 +43,7 @@ namespace MonoDevelop.Refactoring
{
public class RefactoringOptions
{
- public TextEditor Editor {
+ public Ide.Editor.TextEditor Editor {
get;
private set;
}
@@ -85,7 +85,7 @@ namespace MonoDevelop.Refactoring
{
}
- public RefactoringOptions (TextEditor editor, DocumentContext doc)
+ public RefactoringOptions (Ide.Editor.TextEditor editor, DocumentContext doc)
{
this.DocumentContext = doc;
this.Editor = editor;
@@ -98,12 +98,12 @@ namespace MonoDevelop.Refactoring
}*/
}
- public TextEditor GetTextEditorData ()
+ public Ide.Editor.TextEditor GetTextEditorData ()
{
return Editor;
}
- public static string GetWhitespaces (TextEditor editor, int insertionOffset)
+ public static string GetWhitespaces (Ide.Editor.TextEditor editor, int insertionOffset)
{
StringBuilder result = new StringBuilder ();
for (int i = insertionOffset; i < editor.Length; i++) {
@@ -117,7 +117,7 @@ namespace MonoDevelop.Refactoring
return result.ToString ();
}
- public static string GetIndent (TextEditor editor, Microsoft.CodeAnalysis.SyntaxNode member)
+ public static string GetIndent (Ide.Editor.TextEditor editor, Microsoft.CodeAnalysis.SyntaxNode member)
{
return GetWhitespaces (editor, member.SpanStart);
}
@@ -132,7 +132,7 @@ namespace MonoDevelop.Refactoring
return GetUsedNamespacesAsync (Editor, DocumentContext, Editor.LocationToOffset (Location));
}
- public static async Task<ImmutableArray<string>> GetUsedNamespacesAsync (TextEditor editor, DocumentContext doc, int offset, CancellationToken cancellationToken = default (CancellationToken))
+ public static async Task<ImmutableArray<string>> GetUsedNamespacesAsync (Ide.Editor.TextEditor editor, DocumentContext doc, int offset, CancellationToken cancellationToken = default (CancellationToken))
{
if (editor == null)
throw new System.ArgumentNullException (nameof (editor));
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewTooltipWindow.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewTooltipWindow.cs
index 705bb142ae..97248f635b 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewTooltipWindow.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringPreviewTooltipWindow.cs
@@ -1,4 +1,4 @@
-//
+//
// RefactoringPreviewTooltipWindow.cs
//
// Author:
@@ -45,7 +45,7 @@ namespace MonoDevelop.Refactoring
{
class RefactoringPreviewTooltipWindow : PopoverWindow
{
- TextEditor editor;
+ Ide.Editor.TextEditor editor;
CodeAction codeAction;
DocumentContext documentContext;
CancellationTokenSource popupSrc = new CancellationTokenSource ();
@@ -57,7 +57,7 @@ namespace MonoDevelop.Refactoring
static RefactoringPreviewTooltipWindow currentPreviewWindow;
- RefactoringPreviewTooltipWindow (TextEditor editor, CodeAction codeAction)
+ RefactoringPreviewTooltipWindow (Ide.Editor.TextEditor editor, CodeAction codeAction)
{
this.editor = editor;
this.documentContext = documentContext = editor.DocumentContext;
@@ -72,7 +72,7 @@ namespace MonoDevelop.Refactoring
}
}
- public static void ShowPreviewTooltip (TextEditor editor, CodeAction fix, Xwt.Rectangle rect)
+ public static void ShowPreviewTooltip (Ide.Editor.TextEditor editor, CodeAction fix, Xwt.Rectangle rect)
{
HidePreviewTooltip ();
currentPreviewWindow = new RefactoringPreviewTooltipWindow (editor, fix);
@@ -179,12 +179,12 @@ namespace MonoDevelop.Refactoring
class DiffProcessor
{
- readonly TextEditor baseDocument;
+ readonly Ide.Editor.TextEditor baseDocument;
readonly IReadonlyTextDocument changedTextDocument;
public int IndentLength { get; set; }
- public DiffProcessor (TextEditor baseDocument, IReadonlyTextDocument changedTextDocument)
+ public DiffProcessor (Ide.Editor.TextEditor baseDocument, IReadonlyTextDocument changedTextDocument)
{
this.baseDocument = baseDocument;
this.changedTextDocument = changedTextDocument;
@@ -277,7 +277,7 @@ namespace MonoDevelop.Refactoring
var length = Math.Max (0, line.Length - correctedIndentLength);
string text = null;
- if (lineKind != LineKind.Normal || !(document is TextEditor)) {
+ if (lineKind != LineKind.Normal || !(document is Ide.Editor.TextEditor)) {
text = Ambience.EscapeText (document.GetTextAt (offset, length));
} // Ignore markup items as the markup needs to be requested on the UI thread.
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
index e4c46c6b40..71db5068c8 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
@@ -52,7 +52,7 @@ namespace MonoDevelop.Refactoring
{
public static class RefactoringService
{
- internal static Func<TextEditor, DocumentContext, OptionSet> OptionSetCreation;
+ internal static Func<Ide.Editor.TextEditor, DocumentContext, OptionSet> OptionSetCreation;
static ImmutableList<FindReferencesProvider> findReferencesProvider = ImmutableList<FindReferencesProvider>.Empty;
static ImmutableList<FindReferenceUsagesProvider> findReferenceUsagesProviders = ImmutableList<FindReferenceUsagesProvider>.Empty;
static List<JumpToDeclarationHandler> jumpToDeclarationHandler = new List<JumpToDeclarationHandler> ();
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
index 2fef3d01d7..09180834e0 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringSymbolInfo.cs
@@ -37,34 +37,31 @@ using System.Threading;
using System;
using System.Linq;
using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.CodeAnalysis.Text;
namespace MonoDevelop.Refactoring
{
-
+ [Obsolete ("Old editor")]
class RefactoringSymbolInfo
{
public readonly static RefactoringSymbolInfo Empty = new RefactoringSymbolInfo (new SymbolInfo ());
SymbolInfo symbolInfo;
- public ISymbol Symbol
- {
- get
- {
+ public ISymbol Symbol {
+ get {
return symbolInfo.Symbol;
}
}
- public ImmutableArray<ISymbol> CandidateSymbols
- {
- get
- {
+ public ImmutableArray<ISymbol> CandidateSymbols {
+ get {
return symbolInfo.CandidateSymbols;
}
}
- public ISymbol DeclaredSymbol
- {
+ public ISymbol DeclaredSymbol {
get;
internal set;
}
@@ -91,11 +88,11 @@ namespace MonoDevelop.Refactoring
}
}
- public static Task<RefactoringSymbolInfo> GetSymbolInfoAsync (DocumentContext document, TextEditor editor, CancellationToken cancellationToken = default (CancellationToken))
+ public static Task<RefactoringSymbolInfo> GetSymbolInfoAsync (DocumentContext document, Ide.Editor.TextEditor editor, CancellationToken cancellationToken = default (CancellationToken))
{
if (editor.IsSomethingSelected) {
var selectionRange = editor.SelectionRange;
- if (editor.GetTextAt (selectionRange).Any (ch => !char.IsLetterOrDigit (ch) && ch !='_')) {
+ if (editor.GetTextAt (selectionRange).Any (ch => !char.IsLetterOrDigit (ch) && ch != '_')) {
return Task.FromResult (RefactoringSymbolInfo.Empty);
}
return GetSymbolInfoAsync (document, selectionRange.Offset, cancellationToken);
@@ -126,6 +123,40 @@ namespace MonoDevelop.Refactoring
}
return RefactoringSymbolInfo.Empty;
}
+
+ public static async Task<RefactoringSymbolInfo> GetSymbolInfoAsync (ITextView textView, CancellationToken cancellationToken = default)
+ {
+ int offset = 0;
+
+ if (!(textView.Selection?.IsEmpty).GetValueOrDefault (false)) {
+ var selectionSpan = textView.Selection.SelectedSpans.FirstOrDefault ();
+ var selectedText = textView.TextBuffer.CurrentSnapshot.GetText (selectionSpan);
+ if (selectedText.Any (ch => !char.IsLetterOrDigit (ch) && ch != '_')) {
+ return Empty;
+ }
+
+ offset = selectionSpan.Start.Position;
+ }
+
+ offset = textView.Caret.Position.BufferPosition.Position;
+
+ return await GetSymbolInfoAsync (textView, offset, cancellationToken);
+ }
+
+ private static async Task<RefactoringSymbolInfo> GetSymbolInfoAsync (ITextView textView, int offset, CancellationToken cancellationToken = default)
+ {
+ var analysisDocument = textView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges ();
+
+ if (analysisDocument == null)
+ return Empty;
+
+ if (Runtime.IsMainThread) {
+ //InternalGetSymbolInfoAsync can be CPU heavy, go to ThreadPool if we are on UI thread
+ return await Task.Run (() => InternalGetSymbolInfoAsync (analysisDocument, offset, cancellationToken));
+ }
+
+ return await InternalGetSymbolInfoAsync (analysisDocument, offset, cancellationToken);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/StreamingFindUsagesPresenter.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/StreamingFindUsagesPresenter.cs
new file mode 100644
index 0000000000..242de31148
--- /dev/null
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/StreamingFindUsagesPresenter.cs
@@ -0,0 +1,138 @@
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis.Editor.Host;
+using Microsoft.CodeAnalysis.FindUsages;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Instrumentation;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.FindInFiles;
+using MonoDevelop.Ide.TypeSystem;
+using Roslyn.Utilities;
+
+namespace MonoDevelop.Refactoring
+{
+ [Export (typeof (IStreamingFindUsagesPresenter))]
+ class StreamingFindUsagesPresenter : IStreamingFindUsagesPresenter
+ {
+ public void ClearAll ()
+ {
+ }
+
+ public FindUsagesContext StartSearch (string title, bool supportsReferences)
+ {
+ return new MonoDevelopFindUsagesContext ();
+ }
+ }
+
+ sealed class MonoDevelopFindUsagesContext : FindUsagesContext
+ {
+ ConcurrentSet<SearchResult> antiDuplicatesSet = new ConcurrentSet<SearchResult> (new SearchResultComparer ());
+ SearchProgressMonitor monitor;
+ int reportedProgress = 0;
+ ITimeTracker timer = null;
+ Counters.FindReferencesMetadata metadata;
+
+ public MonoDevelopFindUsagesContext ()
+ {
+ monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
+ monitor.BeginTask (GettextCatalog.GetString ("Searching..."), 100);
+ CancellationToken = monitor.CancellationToken;
+ CancellationToken.Register (Finished);
+ metadata = Counters.CreateFindReferencesMetadata ();
+ timer = Counters.FindReferences.BeginTiming (metadata);
+ }
+
+ public override CancellationToken CancellationToken { get; }
+
+ void Finished ()
+ {
+ if (!CancellationToken.IsCancellationRequested) {
+ monitor?.ReportResults (antiDuplicatesSet);
+ metadata.SetUserCancel ();
+ }
+ monitor?.Dispose ();
+ monitor = null;
+
+ timer?.Dispose ();
+ timer = null;
+ }
+
+ public override Task ReportMessageAsync (string message)
+ {
+ return base.ReportMessageAsync (message);
+ }
+
+ public override Task ReportProgressAsync (int current, int maximum)
+ {
+ int newProgress = current * 100 / maximum;
+ monitor?.Step (newProgress - reportedProgress);
+ return Task.CompletedTask;
+ }
+
+ public override Task OnDefinitionFoundAsync (DefinitionItem definition)
+ {
+ var locations = definition.SourceSpans;
+ foreach (var loc in locations) {
+ var fileName = loc.Document.FilePath;
+ var offset = loc.SourceSpan.Start;
+ string projectedName;
+ int projectedOffset;
+ var workspace = loc.Document.Project.Solution.Workspace as MonoDevelopWorkspace;
+ if (workspace != null && workspace.TryGetOriginalFileFromProjection (fileName, offset, out projectedName, out projectedOffset)) {
+ fileName = projectedName;
+ offset = projectedOffset;
+ }
+ var sr = new MemberReference (loc, fileName, offset, loc.SourceSpan.Length);
+ sr.ReferenceUsageType = ReferenceUsageType.Declaration;
+ antiDuplicatesSet.Add (sr);
+ }
+ return Task.CompletedTask;
+ }
+
+ public override Task OnReferenceFoundAsync (SourceReferenceItem reference)
+ {
+ var loc = reference.SourceSpan;
+ var fileName = loc.Document.FilePath;
+ var offset = loc.SourceSpan.Start;
+ string projectedName;
+ int projectedOffset;
+ var workspace = loc.Document.Project.Solution.Workspace as MonoDevelopWorkspace;
+ if (workspace != null && workspace.TryGetOriginalFileFromProjection (fileName, offset, out projectedName, out projectedOffset)) {
+ fileName = projectedName;
+ offset = projectedOffset;
+ }
+ var sr = new MemberReference (loc, fileName, offset, loc.SourceSpan.Length);
+ if (antiDuplicatesSet.Add (sr)) {
+ sr.ReferenceUsageType = reference.IsWrittenTo ? ReferenceUsageType.Write : ReferenceUsageType.Read;
+ }
+ return Task.CompletedTask;
+ }
+
+ public override Task OnCompletedAsync ()
+ {
+ Finished ();
+ return Task.CompletedTask;
+ }
+
+ class SearchResultComparer : IEqualityComparer<SearchResult>
+ {
+ public bool Equals (SearchResult x, SearchResult y)
+ {
+ return x.FileName == y.FileName &&
+ x.Offset == y.Offset &&
+ x.Length == y.Length;
+ }
+
+ public int GetHashCode (SearchResult obj)
+ {
+ int hash = 17;
+ hash = hash * 23 + obj.Offset.GetHashCode ();
+ hash = hash * 23 + obj.Length.GetHashCode ();
+ hash = hash * 23 + (obj.FileName ?? "").GetHashCode ();
+ return hash;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/Makefile.am b/main/src/addins/MonoDevelop.RegexToolkit/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.RegexToolkit/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
index 82cb273308..1078f0c129 100644
--- a/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
+++ b/main/src/addins/MonoDevelop.RegexToolkit/MonoDevelop.RegexToolkit.csproj
@@ -16,30 +16,6 @@
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml" />
- <Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Composition.AttributedModel">
- <HintPath>..\..\..\build\bin\System.Composition.AttributedModel.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
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 32e5661d41..318201ddb2 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
@@ -4,6 +4,33 @@ namespace MonoDevelop.SourceEditor.OptionPanels
{
internal partial class GeneralOptionsPanel
{
+ /*
+
+vbox1
+ GtkLabel13 "Coding"
+ alignment2
+ vbox4
+ hbox3
+ fixed2
+ hbox1
+ label1 Line ending conversion
+ comboboxLineEndings
+ GtkLabel14 "Code Folding"
+ alignment3
+ vbox5
+ foldingCheckbutton
+ foldregionsCheckbutton
+ foldCommentsCheckbutton
+ GtkLabel15 "Appearance"
+ alignment4
+ vbox6
+ wordWrapCheckbutton
+ antiAliasingCheckbutton
+ GtkLabel16 "Experimental"
+ alignment5
+ experimentalSection
+
+ */
private global::Gtk.VBox vbox1;
private global::Gtk.Label GtkLabel13;
@@ -40,10 +67,14 @@ namespace MonoDevelop.SourceEditor.OptionPanels
private global::Gtk.VBox vbox6;
- private global::Gtk.CheckButton wordWrapCheckbutton;
-
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);
@@ -205,18 +236,6 @@ namespace MonoDevelop.SourceEditor.OptionPanels
this.vbox6.Name = "vbox6";
this.vbox6.Spacing = 6;
// Container child vbox6.Gtk.Box+BoxChild
- this.wordWrapCheckbutton = new global::Gtk.CheckButton();
- this.wordWrapCheckbutton.CanFocus = true;
- this.wordWrapCheckbutton.Name = "wordWrapCheckbutton";
- this.wordWrapCheckbutton.Label = global::Mono.Unix.Catalog.GetString("_Word wrap");
- this.wordWrapCheckbutton.DrawIndicator = true;
- this.wordWrapCheckbutton.UseUnderline = true;
- this.vbox6.Add(this.wordWrapCheckbutton);
- global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox6[this.wordWrapCheckbutton]));
- w16.Position = 0;
- w16.Expand = false;
- w16.Fill = false;
- // Container child vbox6.Gtk.Box+BoxChild
this.antiAliasingCheckbutton = new global::Gtk.CheckButton();
this.antiAliasingCheckbutton.CanFocus = true;
this.antiAliasingCheckbutton.Name = "antiAliasingCheckbutton";
@@ -234,6 +253,36 @@ namespace MonoDevelop.SourceEditor.OptionPanels
w19.Position = 5;
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 Preview</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/Makefile.am b/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MdTextViewLineCollection.MdTextViewLine.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MdTextViewLineCollection.MdTextViewLine.cs
index df50904421..0e56dc6e81 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MdTextViewLineCollection.MdTextViewLine.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MdTextViewLineCollection.MdTextViewLine.cs
@@ -29,8 +29,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using Microsoft.VisualStudio.Language.Intellisense.Implementation;
using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Formatting;
-using Microsoft.VisualStudio.Text.Implementation;
+using Microsoft.VisualStudio.Text.Formatting;
using MonoDevelop.Core.Text;
using System.Threading;
using MonoDevelop.Ide;
@@ -76,11 +75,11 @@ namespace Mono.TextEditor
public SnapshotSpan Extent => new SnapshotSpan (Snapshot, line.Offset, line.Length);
- public IMappingSpan ExtentAsMappingSpan => new MappingSpan (Extent, SpanTrackingMode.EdgeInclusive, null);
+ public IMappingSpan ExtentAsMappingSpan => textEditor.BufferGraph.CreateMappingSpan (Extent, SpanTrackingMode.EdgeInclusive);
public SnapshotSpan ExtentIncludingLineBreak => new SnapshotSpan (Snapshot, line.Offset, line.LengthIncludingDelimiter);
- public IMappingSpan ExtentIncludingLineBreakAsMappingSpan => new MappingSpan (ExtentIncludingLineBreak, SpanTrackingMode.EdgeInclusive, null);
+ public IMappingSpan ExtentIncludingLineBreakAsMappingSpan => textEditor.BufferGraph.CreateMappingSpan (ExtentIncludingLineBreak, SpanTrackingMode.EdgeInclusive);
public SnapshotPoint Start => new SnapshotPoint (Snapshot, line.Offset);
@@ -259,6 +258,37 @@ namespace Mono.TextEditor
{
return new Span (line.Offset, line.LengthIncludingDelimiter).IntersectsWith (bufferSpan);
}
+#if MAC
+ public void SetChange (TextViewLineChange change)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetTop (double top)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetDeltaY (double deltaY)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetSnapshot (ITextSnapshot visualSnapshot, ITextSnapshot editSnapshot)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void SetLineTransform (LineTransform transform)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+#endif
}
}
} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs
index 207212ec87..b023ce67f4 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/MonoTextEditor.ITextView.cs
@@ -1,29 +1,29 @@
-//
-// MonoTextEditor.ITextView.cs
-//
-// Author:
-// Mike Krüger <mikkrg@microsoft.com>
-//
-// Copyright (c) 2018 Microsoft Corporation. All rights reserved.
-//
-// 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.
-
+//
+// MonoTextEditor.ITextView.cs
+//
+// Author:
+// Mike Krüger <mikkrg@microsoft.com>
+//
+// Copyright (c) 2018 Microsoft Corporation. All rights reserved.
+//
+// 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 System;
using System.Collections.Generic;
using System.Linq;
@@ -40,15 +40,15 @@ using System.Diagnostics;
using MonoDevelop.Ide;
using Microsoft.VisualStudio.Text.Classification;
using System.Threading;
-using Microsoft.VisualStudio.Text.Operations.Implementation;
-using Microsoft.VisualStudio.Text.Operations;
-
+using Microsoft.VisualStudio.Text.Operations;
+using MonoDevelop.SourceEditor;
+
namespace Mono.TextEditor
-{
- partial class MonoTextEditor : IMdTextView
- {
+{
+ partial class MonoTextEditor : IMdTextView
+ {
#region Private Members
-
+
public Gtk.Container VisualElement { get => textArea; }
ITextBuffer textBuffer;
@@ -58,14 +58,14 @@ namespace Mono.TextEditor
ConnectionManager connectionManager;
- TextEditorFactoryService factoryService;
- int queuedSpaceReservationStackRefresh = 0; //int so that it can be set via Interlocked.CompareExchange()
-
- // IEditorFormatMap _editorFormatMap;
-
+ TextEditorInitializationService factoryService;
+ int queuedSpaceReservationStackRefresh = 0; //int so that it can be set via Interlocked.CompareExchange()
+
+ // IEditorFormatMap _editorFormatMap;
+
bool hasInitializeBeenCalled = false;
- ITextSelection selection;
+ ITextSelection selection;
private IEditorOperations editorOperations;
internal IEditorOperations EditorOperations
@@ -79,8 +79,8 @@ namespace Mono.TextEditor
return editorOperations;
}
- }
-
+ }
+
bool hasAggregateFocus;
IEditorOptions editorOptions;
@@ -89,19 +89,19 @@ namespace Mono.TextEditor
bool isClosed = false;
- private PropertyCollection properties = new PropertyCollection ();
-
- //Only one view at a time will have aggregate focus, so keep track of it so that (when sending aggregate focus changed events)
- //we give a view that had focus the chance to send its lost focus message before we claim aggregate focus.
+ private PropertyCollection properties = new PropertyCollection ();
+
+ //Only one view at a time will have aggregate focus, so keep track of it so that (when sending aggregate focus changed events)
+ //we give a view that had focus the chance to send its lost focus message before we claim aggregate focus.
[ThreadStatic]
- static MonoTextEditor ViewWithAggregateFocus = null;
+ static MonoTextEditor ViewWithAggregateFocus = null;
#if DEBUG
[ThreadStatic]
- static bool SettingAggregateFocus = false;
+ static bool SettingAggregateFocus = false;
#endif
-
+
#endregion // Private Members
-
+
/// <summary>
/// Text View constructor.
/// </summary>
@@ -109,79 +109,79 @@ namespace Mono.TextEditor
/// <param name="roles">Roles for this view.</param>
/// <param name="parentOptions">Parent options for this view.</param>
/// <param name="factoryService">Our handy text editor factory service.</param>
- internal void Initialize (ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextEditorFactoryService factoryService, bool initialize = true)
+ internal void Initialize (ITextViewModel textViewModel, ITextViewRoleSet roles, IEditorOptions parentOptions, TextEditorInitializationService factoryService, bool initialize = true)
{
- this.roles = roles;
- this.factoryService = factoryService;
+ this.roles = roles;
+ this.factoryService = factoryService;
GuardedOperations = this.factoryService.GuardedOperations;
- _spaceReservationStack = new SpaceReservationStack(this.factoryService.OrderedSpaceReservationManagerDefinitions, this);
+ _spaceReservationStack = new MDSpaceReservationStack(this.factoryService.OrderedSpaceReservationManagerDefinitions, this);
this.TextDataModel = textViewModel.DataModel;
this.TextViewModel = textViewModel;
-
- this.textArea.TextViewLines = new MdTextViewLineCollection (this);
- textArea.LayoutChanged += TextAreaLayoutChanged;
-
- textBuffer = textViewModel.EditBuffer;
- // _visualBuffer = textViewModel.VisualBuffer;
-
- // _textSnapshot = _textBuffer.CurrentSnapshot;
- // _visualSnapshot = _visualBuffer.CurrentSnapshot;
+
+ this.textArea.TextViewLines = new MdTextViewLineCollection (this);
+ textArea.LayoutChanged += TextAreaLayoutChanged;
+
+ textBuffer = textViewModel.EditBuffer;
+ // _visualBuffer = textViewModel.VisualBuffer;
+
+ // _textSnapshot = _textBuffer.CurrentSnapshot;
+ // _visualSnapshot = _visualBuffer.CurrentSnapshot;
editorOptions = this.factoryService.EditorOptionsFactoryService.GetOptions (this);
editorOptions.Parent = parentOptions;
-
+
if (initialize)
this.Initialize ();
- }
+ }
- static List<ITextViewLine> emptyTextViewLineList = new List<ITextViewLine> (0);
- void TextAreaLayoutChanged(object sender, EventArgs args)
- {
- //TODO: Properly implement LayoutChanged with all data
- LayoutChanged?.Invoke (this, new TextViewLayoutChangedEventArgs (new ViewState (this), new ViewState (this), emptyTextViewLineList, emptyTextViewLineList));
- }
+ static List<ITextViewLine> emptyTextViewLineList = new List<ITextViewLine> (0);
+ void TextAreaLayoutChanged(object sender, EventArgs args)
+ {
+ //TODO: Properly implement LayoutChanged with all data
+ LayoutChanged?.Invoke (this, new TextViewLayoutChangedEventArgs (new ViewState (this), new ViewState (this), emptyTextViewLineList, emptyTextViewLineList));
+ }
- internal bool IsTextViewInitialized { get { return hasInitializeBeenCalled; } }
-
- // This method should only be called once (it is normally called from the ctor unless we're using
- // ITextEditorFactoryService2.CreateTextViewWithoutInitialization on the factory to delay initialization).
+ internal bool IsTextViewInitialized { get { return hasInitializeBeenCalled; } }
+
+ // This method should only be called once (it is normally called from the ctor unless we're using
+ // ITextEditorFactoryService2.CreateTextViewWithoutInitialization on the factory to delay initialization).
internal void Initialize ()
{
if (hasInitializeBeenCalled)
throw new InvalidOperationException ("Attempted to Initialize a WpfTextView twice");
- bufferGraph = factoryService.BufferGraphFactoryService.CreateBufferGraph (this.TextViewModel.VisualBuffer);
-
- //_editorFormatMap = _factoryService.EditorFormatMapService.GetEditorFormatMap(this);
-
+ bufferGraph = factoryService.BufferGraphFactoryService.CreateBufferGraph (this.TextViewModel.VisualBuffer);
+
+ //_editorFormatMap = _factoryService.EditorFormatMapService.GetEditorFormatMap(this);
+
selection = new TextSelection (this);
// this.Loaded += OnLoaded;
- // We need to instantiate EditorOperations, because it in turn will register the UndoHistory
- // for the buffer via:
- // https://github.com/KirillOsenkov/vs-editor-api/blob/d06adf1581eb8e16242c8b6eabc7ba13ceaf0d54/src/Text/Impl/EditorOperations/EditorOperations.cs#L108
- // Without Undo History Roslyn Completion bails via:
- // https://github.com/dotnet/roslyn/blob/a107b43dcad83cf79addd47a9919590c7366d130/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs#L66
- // See https://devdiv.visualstudio.com/DevDiv/_workitems/edit/669018 for details.
- var instantiateEditorOperations = EditorOperations;
-
+ // We need to instantiate EditorOperations, because it in turn will register the UndoHistory
+ // for the buffer via:
+ // https://github.com/KirillOsenkov/vs-editor-api/blob/d06adf1581eb8e16242c8b6eabc7ba13ceaf0d54/src/Text/Impl/EditorOperations/EditorOperations.cs#L108
+ // Without Undo History Roslyn Completion bails via:
+ // https://github.com/dotnet/roslyn/blob/a107b43dcad83cf79addd47a9919590c7366d130/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/Controller_Commit.cs#L66
+ // See https://devdiv.visualstudio.com/DevDiv/_workitems/edit/669018 for details.
+ var instantiateEditorOperations = EditorOperations;
+
connectionManager = new ConnectionManager (this, factoryService.TextViewConnectionListeners, factoryService.GuardedOperations);
- SubscribeToEvents ();
-
- // Binding content type specific assets includes calling out to content-type
- // specific view creation listeners. We need to do this as late as possible.
- this.BindContentTypeSpecificAssets (null, TextViewModel.DataModel.ContentType);
-
- //Subscribe now so that there is no chance that a layout could be forced by a text change.
- //_visualBuffer.ChangedLowPriority += OnVisualBufferChanged;
- //_visualBuffer.ContentTypeChanged += OnVisualBufferContentTypeChanged;
-
- // instantiate the MultiSelectionBroker
- var broker = MultiSelectionBroker;
-
+ SubscribeToEvents ();
+
+ // Binding content type specific assets includes calling out to content-type
+ // specific view creation listeners. We need to do this as late as possible.
+ this.BindContentTypeSpecificAssets (null, TextViewModel.DataModel.ContentType);
+
+ //Subscribe now so that there is no chance that a layout could be forced by a text change.
+ //_visualBuffer.ChangedLowPriority += OnVisualBufferChanged;
+ //_visualBuffer.ContentTypeChanged += OnVisualBufferContentTypeChanged;
+
+ // instantiate the MultiSelectionBroker
+ var broker = MultiSelectionBroker;
+
hasInitializeBeenCalled = true;
}
@@ -249,8 +249,8 @@ namespace Mono.TextEditor
get {
return roles;
}
- }
-
+ }
+
/// <summary>
/// Gets the text buffer whose text, this text editor renders
/// </summary>
@@ -267,23 +267,23 @@ namespace Mono.TextEditor
}
public ITextSnapshot TextSnapshot {
- get {
- // TODO: MONO: WpfTextView has a much more complex calculation of this
- return TextBuffer.CurrentSnapshot;
- // return _textSnapshot;
+ get {
+ // TODO: MONO: WpfTextView has a much more complex calculation of this
+ return TextBuffer.CurrentSnapshot;
+ // return _textSnapshot;
}
}
public ITextSnapshot VisualSnapshot {
get {
- return TextBuffer.CurrentSnapshot;
- // return _visualSnapshot;
+ return TextBuffer.CurrentSnapshot;
+ // return _visualSnapshot;
}
}
public ITextDataModel TextDataModel { get; private set; }
- public ITextViewModel TextViewModel { get; private set; }
-
+ public ITextViewModel TextViewModel { get; private set; }
+
public ITextViewLineCollection TextViewLines { get => textArea.TextViewLines; }
public double ViewportBottom {
@@ -315,7 +315,7 @@ namespace Mono.TextEditor
public double ViewportTop {
get {
- return TextViewMargin.RectInParent.Top;// + VAdjustment.Value;
+ return TextViewMargin.RectInParent.Top;// + VAdjustment.Value;
}
}
@@ -329,11 +329,11 @@ namespace Mono.TextEditor
get {
return this;
}
- }
-
+ }
+
public event EventHandler Closed;
public event EventHandler GotAggregateFocus;
- public event EventHandler LostAggregateFocus;
+ public event EventHandler LostAggregateFocus;
public event EventHandler<TextViewLayoutChangedEventArgs> LayoutChanged;
#pragma warning disable CS0067
public event EventHandler ViewportLeftChanged;
@@ -345,13 +345,13 @@ namespace Mono.TextEditor
public void Close ()
{
if (isClosed)
- throw new InvalidOperationException ();//Strings.TextViewClosed);
- isClosed = true;
-
- factoryService.GuardedOperations.RaiseEvent (this, this.Closed);
-
- if (hasAggregateFocus) {
- //Silently lose aggregate focus (to preserve Dev11 compatibility which did not raise a focus changed event when the view was closed).
+ throw new InvalidOperationException ();//Strings.TextViewClosed);
+ isClosed = true;
+
+ factoryService.GuardedOperations.RaiseEvent (this, this.Closed);
+
+ if (hasAggregateFocus) {
+ //Silently lose aggregate focus (to preserve Dev11 compatibility which did not raise a focus changed event when the view was closed).
Debug.Assert (ViewWithAggregateFocus == this);
ViewWithAggregateFocus = null;
hasAggregateFocus = false;
@@ -366,19 +366,19 @@ namespace Mono.TextEditor
}
public void DisplayTextLineContainingBufferPosition (SnapshotPoint bufferPosition, double verticalDistance, ViewRelativePosition relativeTo)
- {
- this.textArea.ScrollTo (bufferPosition.Position);
+ {
+ this.textArea.ScrollTo (bufferPosition.Position);
}
public void DisplayTextLineContainingBufferPosition (SnapshotPoint bufferPosition, double verticalDistance, ViewRelativePosition relativeTo, double? viewportWidthOverride, double? viewportHeightOverride)
{
- this.textArea.ScrollTo (bufferPosition.Position);
+ this.textArea.ScrollTo (bufferPosition.Position);
}
public SnapshotSpan GetTextElementSpan (SnapshotPoint point)
- {
- var line = this.GetTextViewLineContainingBufferPosition (point);
- return line.GetTextElementSpan (point);
+ {
+ var line = this.GetTextViewLineContainingBufferPosition (point);
+ return line.GetTextElementSpan (point);
}
public ITextViewLine GetTextViewLineContainingBufferPosition (SnapshotPoint bufferPosition)
@@ -397,8 +397,8 @@ namespace Mono.TextEditor
}
}));
}
- }
-
+ }
+
/// <remarks>
/// If you add an event subscription to this method, be sure to add the corresponding unsubscription to
/// UnsubscribeFromEvents()
@@ -420,9 +420,15 @@ namespace Mono.TextEditor
IdeApp.Workbench.ActiveDocumentChanged -= Workbench_ActiveDocumentChanged;
}
+ static readonly string[] allowedTextViewCreationListeners = {
+ "MonoDevelop.SourceEditor.Braces.BraceCompletionManagerFactory",
+ "MonoDevelop.SourceEditor.CurrentLineSpaceReservationAgent.CurrentLineSpaceReservationAgent_ViewCreationListener",
+ "Microsoft.VisualStudio.Text.AdornmentLibrary.Squiggles.Implementation.WebToolingErrorProviderFactory"
+ };
+
private void BindContentTypeSpecificAssets (IContentType beforeContentType, IContentType afterContentType)
- {
- // Notify the Text view creation listeners
+ {
+ // Notify the Text view creation listeners
var extensions = UIExtensionSelector.SelectMatchingExtensions (factoryService.TextViewCreationListeners, afterContentType, beforeContentType, roles);
foreach (var extension in extensions) {
string deferOptionName = extension.Metadata.OptionName;
@@ -440,98 +446,103 @@ namespace Mono.TextEditor
}
var instantiatedExtension = factoryService.GuardedOperations.InstantiateExtension (extension, extension);
- if (instantiatedExtension != null) {
+ if (instantiatedExtension != null && allowedTextViewCreationListeners.Contains(instantiatedExtension.ToString())) {
factoryService.GuardedOperations.CallExtensionPoint (instantiatedExtension,
() => instantiatedExtension.TextViewCreated (this));
}
}
- }
-
+ }
+
/// <summary>
/// Handles the Classification changed event that comes from the Classifier aggregator
/// </summary>
void OnClassificationChanged (object sender, ClassificationChangedEventArgs e)
{
- if (!isClosed) {
- // When classifications change, we just invalidate the lines. That invalidation will
- // create new lines based on the new classifications.
-
- // Map the classification change (from the edit buffer) to the visual buffer
+ if (!isClosed) {
+ // When classifications change, we just invalidate the lines. That invalidation will
+ // create new lines based on the new classifications.
+
+ // Map the classification change (from the edit buffer) to the visual buffer
Span span = Span.FromBounds (
TextViewModel.GetNearestPointInVisualSnapshot (e.ChangeSpan.Start, VisualSnapshot, PointTrackingMode.Negative),
- TextViewModel.GetNearestPointInVisualSnapshot (e.ChangeSpan.End, VisualSnapshot, PointTrackingMode.Positive));
-
- //Classifications changes invalidate only the characters contained in the span so a zero length change
- //will have no effect.
- if (span.Length > 0) {
- //IsLineInvalid will invalidate a line if it intersects the end. The result is that any call to InvalidateSpan() implicitly
- //invalidates any line that starts at the end of the invalidated span, which we do not want here. Reduce the length of the classification
- //change span one so -- if someone invalidated an entire line including the line break -- the next line will not be invalidated.
- span = new Span (span.Start, span.Length - 1);
-
- // MONO: TODO: this
-
- //lock (_invalidatedSpans)
- //{
- // if ((_attachedLineCache.Count > 0) || (_unattachedLineCache.Count > 0))
- // {
- // _reclassifiedSpans.Add(span);
- // this.QueueLayout();
- // }
- //}
+ TextViewModel.GetNearestPointInVisualSnapshot (e.ChangeSpan.End, VisualSnapshot, PointTrackingMode.Positive));
+
+ //Classifications changes invalidate only the characters contained in the span so a zero length change
+ //will have no effect.
+ if (span.Length > 0) {
+ //IsLineInvalid will invalidate a line if it intersects the end. The result is that any call to InvalidateSpan() implicitly
+ //invalidates any line that starts at the end of the invalidated span, which we do not want here. Reduce the length of the classification
+ //change span one so -- if someone invalidated an entire line including the line break -- the next line will not be invalidated.
+ span = new Span (span.Start, span.Length - 1);
+
+ // MONO: TODO: this
+
+ //lock (_invalidatedSpans)
+ //{
+ // if ((_attachedLineCache.Count > 0) || (_unattachedLineCache.Count > 0))
+ // {
+ // _reclassifiedSpans.Add(span);
+ // this.QueueLayout();
+ // }
+ //}
}
}
}
internal void QueueAggregateFocusCheck (bool checkForFocus = true)
- {
+ {
#if DEBUG
if (SettingAggregateFocus) {
Debug.Fail ("WpfTextView.SettingAggregateFocus");
- }
+ }
#endif
-
+
if (!isClosed) {
bool newHasAggregateFocus = ((IdeApp.Workbench.ActiveDocument?.Editor?.Implementation as MonoDevelop.SourceEditor.SourceEditorView)?.TextEditor == this);
if (newHasAggregateFocus != hasAggregateFocus) {
hasAggregateFocus = newHasAggregateFocus;
- if (hasAggregateFocus) {
- //Got focus so make sure that the view that had focus (which wasn't us since we didn't have focus before) raises its
- //lost focus event before we raise our got focus event. This will potentially do bad things if someone changes focus
- //if the lost aggregate focus handler.
+ if (hasAggregateFocus) {
+ //Got focus so make sure that the view that had focus (which wasn't us since we didn't have focus before) raises its
+ //lost focus event before we raise our got focus event. This will potentially do bad things if someone changes focus
+ //if the lost aggregate focus handler.
Debug.Assert (ViewWithAggregateFocus != this);
if (ViewWithAggregateFocus != null) {
ViewWithAggregateFocus.QueueAggregateFocusCheck (checkForFocus: false);
}
Debug.Assert (ViewWithAggregateFocus == null);
ViewWithAggregateFocus = this;
- } else {
- //Lost focus (which means we were the view with focus).
+ } else {
+ //Lost focus (which means we were the view with focus).
Debug.Assert (ViewWithAggregateFocus == this);
ViewWithAggregateFocus = null;
}
- EventHandler handler = hasAggregateFocus ? this.GotAggregateFocus : this.LostAggregateFocus;
-
+ EventHandler handler = hasAggregateFocus ? this.GotAggregateFocus : this.LostAggregateFocus;
+
#if DEBUG
try {
- SettingAggregateFocus = true;
+ SettingAggregateFocus = true;
#endif
- factoryService.GuardedOperations.RaiseEvent (this, handler);
+ factoryService.GuardedOperations.RaiseEvent (this, handler);
#if DEBUG
} finally {
SettingAggregateFocus = false;
- }
+ }
#endif
}
}
}
public IGuardedOperations GuardedOperations;
- internal SpaceReservationStack _spaceReservationStack;
+ internal MDSpaceReservationStack _spaceReservationStack;
- public ISpaceReservationManager GetSpaceReservationManager (string name)
+#if MAC
+ // on Mac ITextView has the extra member GetSpaceReservationManager that isn't there on Windows
+ ISpaceReservationManager ITextView.GetSpaceReservationManager (string name) => throw new NotImplementedException();
+#endif
+
+ public IMDSpaceReservationManager GetSpaceReservationManager (string name)
{
if (name == null)
throw new ArgumentNullException ("name");
@@ -539,12 +550,12 @@ namespace Mono.TextEditor
return _spaceReservationStack.GetOrCreateManager (name);
}
- internal TextEditorFactoryService ComponentContext {
+ internal TextEditorInitializationService ComponentContext {
get { return factoryService; }
}
- public bool InOuterLayout => false;
-
+ public bool InOuterLayout => false;
+
private IMultiSelectionBroker multiSelectionBroker;
public IMultiSelectionBroker MultiSelectionBroker {
get {
@@ -558,13 +569,53 @@ namespace Mono.TextEditor
}
private void OnMultiSelectionSessionChanged (object sender, EventArgs e)
- {
- // The MultiSelectionBroker API has been updated, but currently in VSMac we still have a separate Caret concept.
- // We need to manually synchronize our caret with what MultiSelectionBroker thinks the caret is.
- // The other direction happens when we move our caret.
- if (TextCaret.Position.VirtualBufferPosition != MultiSelectionBroker.PrimarySelection.InsertionPoint) {
- TextCaret.MoveTo (MultiSelectionBroker.PrimarySelection.InsertionPoint);
+ {
+ // The MultiSelectionBroker API has been updated, but currently in VSMac we still have a separate Caret concept.
+ // We need to manually synchronize our caret with what MultiSelectionBroker thinks the caret is.
+ // The other direction happens when we move our caret.
+ if (TextCaret.Position.VirtualBufferPosition != MultiSelectionBroker.PrimarySelection.InsertionPoint) {
+ TextCaret.MoveTo (MultiSelectionBroker.PrimarySelection.InsertionPoint);
}
}
+
+ public void QueuePostLayoutAction (Action action)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool TryGetTextViewLines (out ITextViewLineCollection textViewLines)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public bool TryGetTextViewLineContainingBufferPosition (SnapshotPoint bufferPosition, out ITextViewLine textViewLine)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void Focus ()
+ {
+ }
+
+#if MAC
+ public IXPlatAdornmentLayer GetXPlatAdornmentLayer (string name)
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Gets or sets the Zoom level for the <see cref="ITextView3"/> between 20% to 400%
+ /// </summary>
+ public double ZoomLevel {
+ get;
+ set;
+ }
+
+ public ITextViewLineSource FormattedLineSource { get; } = null;
+
+ public bool IsKeyboardFocused => HasFocus;
+
+ public event EventHandler IsKeyboardFocusedChanged;
+#endif
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs
index f6dafc25f0..2e8184cce7 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextArea.cs
@@ -529,12 +529,13 @@ namespace Mono.TextEditor
this.textEditorData.Document.CommitLineUpdate (preeditLine);
}
} else {
- if (preeditOffset < 0)
- return;
- preeditOffset = -1;
preeditString = null;
preeditAttrs = null;
preeditCursorCharIndex = 0;
+ if (preeditOffset < 0) {
+ return;
+ }
+ preeditOffset = -1;
if (UpdatePreeditLineHeight ()) {
QueueDraw ();
} else {
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
index 6cb5586a22..8318f4652e 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -1020,7 +1020,7 @@ namespace Mono.TextEditor
}
}
- public bool Equals (DocumentLine line, int offset, int length, int selectionStart, int selectionEnd)
+ public bool Equals (DocumentLine line, string lineText, int length, HighlightedLine cachedLine, int selectionStart, int selectionEnd)
{
int selStart = 0, selEnd = 0;
if (selectionEnd >= 0) {
@@ -1029,7 +1029,17 @@ namespace Mono.TextEditor
}
if (selStart != this.SelectionStart || selEnd != this.SelectionEnd || Length != length || MarkerLength != doc.GetMarkers (line).Count ())
return false;
- return doc.Version.MoveOffsetTo (version, offset) == Offset;
+
+ if (cachedLine.Segments.Count != Layout.Chunks.Count)
+ return false;
+ for (int i = 0; i < cachedLine.Segments.Count; i++) {
+ var seg1 = cachedLine.Segments [i];
+ var seg2 = Layout.Chunks [i];
+ if (seg1.Length != seg2.Length || seg1.ColorStyleKey != seg2.ColorStyleKey) {
+ return false;
+ }
+ }
+ return lineText == Layout.Text;
}
public override bool Equals (object obj)
@@ -1060,10 +1070,24 @@ namespace Mono.TextEditor
bool containsPreedit = textEditor.ContainsPreedit (offset, length);
LayoutDescriptor descriptor;
int lineNumber = line.LineNumber;
+ var lineOffset = line.Offset;
+
+ var cachedChunks = GetCachedChunks (Document, line, offset, length);
+ var textBuilder = StringBuilderCache.Allocate ();
+ foreach (var chunk in cachedChunks.Item1) {
+ try {
+ textBuilder.Append (Document.GetTextAt (lineOffset + chunk.Offset, chunk.Length));
+ } catch (Exception e) {
+ LoggingService.LogInternalError ("Error while getting chunk " + chunk, e);
+ }
+ }
+ string lineText = StringBuilderCache.ReturnAndFree (textBuilder);
+
if (!containsPreedit && layoutDict.TryGetValue (lineNumber, out descriptor)) {
- if (descriptor.Equals (line, offset, length, selectionStart, selectionEnd) && descriptor?.Layout?.Layout != null) {
+ if (descriptor.Equals (line, lineText, length, cachedChunks.Item3, selectionStart, selectionEnd) && descriptor.Layout?.Layout != null) {
return descriptor.Layout;
}
+
descriptor.Dispose ();
layoutDict.Remove (lineNumber);
}
@@ -1082,9 +1106,6 @@ namespace Mono.TextEditor
wrapper.Layout.Wrap = Pango.WrapMode.WordChar;
wrapper.Layout.Width = (int)((textEditor.Allocation.Width - XOffset - TextStartPosition) * Pango.Scale.PangoScale);
}
- StringBuilder textBuilder = StringBuilderCache.Allocate ();
- var cachedChunks = GetCachedChunks (Document, line, offset, length);
- var lineOffset = line.Offset;
var chunks = new List<ColoredSegment> (cachedChunks.Item1.Select (c => new ColoredSegment (c.Offset + lineOffset, c.Length, c.ScopeStack)));;
var markers = TextDocument.OrderTextSegmentMarkersByInsertion (Document.GetVisibleTextSegmentMarkersAt (line)).ToList ();
foreach (var marker in markers) {
@@ -1095,14 +1116,6 @@ namespace Mono.TextEditor
}
wrapper.HighlightedLine = cachedChunks.Item3;
wrapper.Chunks = chunks;
- foreach (var chunk in chunks) {
- try {
- textBuilder.Append (Document.GetTextAt (chunk));
- } catch {
- Console.WriteLine (chunk);
- }
- }
- string lineText = StringBuilderCache.ReturnAndFree (textBuilder);
uint preeditLength = 0;
if (containsPreedit) {
@@ -1501,11 +1514,10 @@ namespace Mono.TextEditor
if (textIndex < 0)
throw new ArgumentOutOfRangeException (nameof (textIndex));
+ if (textIndex > text.Length)
+ throw new ArgumentOutOfRangeException (nameof (textIndex));
if (textIndex < curIndex) {
- if (textIndex > text.Length)
- throw new ArgumentOutOfRangeException (nameof (textIndex));
-
unsafe {
fixed (char *p = text)
byteIndex = (uint)Encoding.UTF8.GetByteCount (p, (int)textIndex);
@@ -1567,11 +1579,13 @@ namespace Mono.TextEditor
internal HighlightedLine HighlightedLine { get; set; }
+ string text;
public string Text {
get {
- return Layout.Text;
+ return text;
}
set {
+ text = value;
Layout.SetText (value);
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionAggregatorFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionAggregatorFactory.cs
index 1d660f780c..da789cf769 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionAggregatorFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionAggregatorFactory.cs
@@ -27,7 +27,7 @@ namespace MonoDevelop.SourceEditor.Braces
internal IContentTypeRegistryService ContentTypeRegistryService { get; private set; }
internal ITextBufferUndoManagerProvider UndoManager { get; private set; }
internal IEditorOperationsFactoryService EditorOperationsFactoryService { get; private set; }
- internal GuardedOperations GuardedOperations { get; private set; }
+ internal IGuardedOperations GuardedOperations { get; private set; }
#endregion
@@ -41,7 +41,7 @@ namespace MonoDevelop.SourceEditor.Braces
IContentTypeRegistryService contentTypeRegistryService,
ITextBufferUndoManagerProvider undoManager,
IEditorOperationsFactoryService editorOperationsFactoryService,
- GuardedOperations guardedOperations)
+ IGuardedOperations guardedOperations)
{
SessionProviders = sessionProviders;
ContextProviders = contextProviders;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManager.cs
index c7ca6d2050..fc8e7a7bf7 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManager.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManager.cs
@@ -11,6 +11,7 @@ namespace MonoDevelop.SourceEditor.Braces
using Microsoft.VisualStudio.Text.BraceCompletion;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Utilities;
+ using Microsoft.VisualStudio.Utilities;
using MonoDevelop.Ide.Editor;
using System;
using System.Diagnostics;
@@ -27,7 +28,7 @@ namespace MonoDevelop.SourceEditor.Braces
private readonly IBraceCompletionAggregatorFactory _sessionFactory;
private readonly IBraceCompletionAggregator _sessionAggregator;
private readonly ITextView _textView;
- private readonly GuardedOperations _guardedOperations;
+ private readonly IGuardedOperations _guardedOperations;
private IBraceCompletionSession _postSession;
private IBraceCompletionSession _waitingSession;
@@ -37,7 +38,7 @@ namespace MonoDevelop.SourceEditor.Braces
#region Constructors
- internal BraceCompletionManager (ITextView textView, IBraceCompletionStack stack, IBraceCompletionAggregatorFactory sessionFactory, GuardedOperations guardedOperations)
+ internal BraceCompletionManager (ITextView textView, IBraceCompletionStack stack, IBraceCompletionAggregatorFactory sessionFactory, IGuardedOperations guardedOperations)
{
_textView = textView;
_stack = stack;
@@ -281,7 +282,6 @@ namespace MonoDevelop.SourceEditor.Braces
{
_textView.Closed += textView_Closed;
_textView.Options.OptionChanged += Options_OptionChanged;
- DefaultSourceEditorOptions.Instance.Changed += EditorOptions_OptionChanged;
}
private void textView_Closed (object sender, EventArgs e)
@@ -293,7 +293,6 @@ namespace MonoDevelop.SourceEditor.Braces
{
_textView.Closed -= textView_Closed;
_textView.Options.OptionChanged -= Options_OptionChanged;
- DefaultSourceEditorOptions.Instance.Changed -= EditorOptions_OptionChanged;
}
private void EditorOptions_OptionChanged (object sender, EventArgs args)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManagerFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManagerFactory.cs
index a6dae83506..4c88a68475 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManagerFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionManagerFactory.cs
@@ -27,7 +27,7 @@ namespace MonoDevelop.SourceEditor.Braces
private IBraceCompletionAggregatorFactory _aggregatorFactory = null;
[Import]
- private GuardedOperations _guardedOperations = null;
+ private IGuardedOperations _guardedOperations = null;
#endregion
@@ -35,6 +35,10 @@ namespace MonoDevelop.SourceEditor.Braces
public void TextViewCreated (ITextView textView)
{
+ if (!(textView is IMdTextView)) {
+ return;
+ }
+
textView.Properties.AddProperty ("BraceCompletionManagerMD",
new BraceCompletionManager (textView,
new BraceCompletionStack (textView, _adornmentServiceFactory, _guardedOperations), _aggregatorFactory, _guardedOperations));
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionStack.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionStack.cs
index fa3d13d9e9..00d552d4b2 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionStack.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Braces/BraceCompletionStack.cs
@@ -11,6 +11,7 @@ namespace MonoDevelop.SourceEditor.Braces
using Microsoft.VisualStudio.Text.BraceCompletion;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Utilities;
+ using Microsoft.VisualStudio.Utilities;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -31,11 +32,11 @@ namespace MonoDevelop.SourceEditor.Braces
private IBraceCompletionAdornmentServiceFactory _adornmentServiceFactory;
private IBraceCompletionAdornmentService _adornmentService;
- private GuardedOperations _guardedOperations;
+ private IGuardedOperations _guardedOperations;
#endregion
#region Constructors
- public BraceCompletionStack (ITextView textView, IBraceCompletionAdornmentServiceFactory adornmentFactory, GuardedOperations guardedOperations)
+ public BraceCompletionStack (ITextView textView, IBraceCompletionAdornmentServiceFactory adornmentFactory, IGuardedOperations guardedOperations)
{
_adornmentServiceFactory = adornmentFactory;
_stack = new Stack<IBraceCompletionSession> ();
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 887d48344e..da39144742 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/GeneralOptionsPanel.cs
@@ -24,17 +24,25 @@
// THE SOFTWARE.
using System;
+
+using Microsoft.VisualStudio.Text.Editor;
+
using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Components;
using MonoDevelop.Components.AtkCocoaHelper;
using MonoDevelop.Core;
-using MonoDevelop.Ide.Gui.Content;
-using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide;
+using MonoDevelop.Components.Extensions;
namespace MonoDevelop.SourceEditor.OptionPanels
{
partial class GeneralOptionsPanel : Gtk.Bin, IOptionsPanel
{
+ readonly Xwt.CheckBox newEditorCheckBox;
+ readonly Xwt.CheckBox wordWrapCheckBox;
+ readonly Xwt.CheckBox wordWrapVisualGlyphsCheckBox;
+
public GeneralOptionsPanel()
{
this.Build();
@@ -44,6 +52,40 @@ namespace MonoDevelop.SourceEditor.OptionPanels
this.comboboxLineEndings.AppendText (GettextCatalog.GetString ("Always convert line endings"));
this.comboboxLineEndings.Active = (int)DefaultSourceEditorOptions.Instance.LineEndingConversion;
+ var newEditorOptionsBox = new Xwt.VBox ();
+
+ var newEditorLearnMoreLink = new Xwt.LinkLabel {
+ MarginBottom = 6,
+ MarginTop = 6,
+ Text = GettextCatalog.GetString ("Learn more about the New Editor Preview"),
+ 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.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);
+ else
+ LoggingService.LogError ("GeneralOptionsPanel: Xwt.Toolkit.CurrentEngine.Type != Xwt.ToolkitType.Gtk - currently unsupported");
+
+ HandleNewEditorOptionToggled (this, EventArgs.Empty);
+
SetupAccessibility ();
}
@@ -57,6 +99,12 @@ 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"));
+ wordWrapVisualGlyphsCheckBox.SetCommonAccessibilityAttributes ("SourceEditorGeneral.newEditor.wordWrap.enableVisualGlyphs", "",
+ GettextCatalog.GetString ("Check to enable visual word wrap glyphs in the experimental new editor"));
}
public virtual Control CreatePanelWidget ()
@@ -64,10 +112,10 @@ namespace MonoDevelop.SourceEditor.OptionPanels
this.foldingCheckbutton.Active = DefaultSourceEditorOptions.Instance.ShowFoldMargin;
this.foldregionsCheckbutton.Active = DefaultSourceEditorOptions.Instance.DefaultRegionsFolding;
this.foldCommentsCheckbutton.Active = DefaultSourceEditorOptions.Instance.DefaultCommentFolding;
- // wordWrapCheckbutton.Active = DefaultSourceEditorOptions.Instance.WrapLines;
- wordWrapCheckbutton.Visible = false;
+
antiAliasingCheckbutton.Visible = false;
GtkLabel15.Visible = false;
+
return this;
}
@@ -75,12 +123,34 @@ namespace MonoDevelop.SourceEditor.OptionPanels
{
DefaultSourceEditorOptions.Instance.DefaultRegionsFolding = this.foldregionsCheckbutton.Active;
DefaultSourceEditorOptions.Instance.DefaultCommentFolding = this.foldCommentsCheckbutton.Active;
- DefaultSourceEditorOptions.Instance.LineEndingConversion = (MonoDevelop.Ide.Editor.LineEndingConversion)this.comboboxLineEndings.Active;
+ DefaultSourceEditorOptions.Instance.LineEndingConversion = (LineEndingConversion)this.comboboxLineEndings.Active;
+
if (DefaultSourceEditorOptions.Instance.ShowFoldMargin != this.foldingCheckbutton.Active) {
DefaultSourceEditorOptions.Instance.ShowFoldMargin = this.foldingCheckbutton.Active;
HighlightingPanel.UpdateActiveDocument ();
}
-// DefaultSourceEditorOptions.Instance.WrapLines = wordWrapCheckbutton.Active;
+
+ DefaultSourceEditorOptions.Instance.EnableNewEditor = this.newEditorCheckBox.Active;
+ }
+
+ void HandleNewEditorOptionToggled (object sender, EventArgs e)
+ {
+ wordWrapCheckBox.Sensitive = newEditorCheckBox.Active;
+ wordWrapVisualGlyphsCheckBox.Sensitive = newEditorCheckBox.Active && wordWrapCheckBox.Active;
+
+ var wrap = DefaultSourceEditorOptions.Instance.WordWrapStyle;
+
+ if (wordWrapCheckBox.Active)
+ wrap |= WordWrapStyles.WordWrap;
+ else
+ wrap &= ~WordWrapStyles.WordWrap;
+
+ if (wordWrapVisualGlyphsCheckBox.Active)
+ wrap |= WordWrapStyles.VisibleGlyphs;
+ else
+ wrap &= ~WordWrapStyles.VisibleGlyphs;
+
+ DefaultSourceEditorOptions.Instance.WordWrapStyle = wrap;
}
public void Initialize (OptionsDialog dialog, object dataObject)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
index 19f71f9a1e..6af63e47b2 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.QuickTasks/QuickTaskOverviewMode.cs
@@ -112,7 +112,6 @@ namespace MonoDevelop.SourceEditor.QuickTasks
readonly QuickTaskStrip parentStrip;
protected readonly Adjustment vadjustment;
TextViewMargin textViewMargin;
- int caretLine = -1;
public Mono.TextEditor.MonoTextEditor TextEditor {
get;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index 54902f8661..dc45edbac1 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -1,6 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\MonoDevelop.props" />
- <Import Project="$(ReferencesRoslyn)" />
<Import Project="$(ReferencesVSEditor)" />
<Import Project="$(ReferencesGtk)" />
<PropertyGroup>
@@ -10,6 +9,12 @@
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\DisplayBindings\SourceEditor</OutputPath>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <DefineConstants Condition="$(OS) == 'Windows_NT'">$(DefineConstants);WINDOWS</DefineConstants>
+ <!--
+ This entire assembly is obsolete, and uses many obsoleted APIs from Core/Ide
+ so disable deprecation warnings.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugMac|AnyCPU' " />
@@ -64,39 +69,23 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
- <Reference Include="Microsoft.VisualStudio.Threading, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.Threading.dll</HintPath>
- <Private>False</Private>
- </Reference>
+ <Reference Include="PresentationCore" Condition=" '$(OS)' == 'Windows_NT' " />
+ <Reference Include="PresentationFramework" Condition=" '$(OS)' == 'Windows_NT' " />
+ <Reference Include="WindowsBase" />
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\build\bin\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="Xamarin.Mac" Condition=" '$(Configuration)' == 'DebugMac' Or '$(Configuration)' == 'ReleaseMac' ">
<HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="Microsoft.VisualStudio.Composition">
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.Composition.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="..\..\..\external\vs-editor-core\src\Editor\Text\Impl\BaseViewImpl\VacuousTextDataModel.cs" Link="Util\VacuousTextDataModel.cs" />
+ <Compile Include="..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\VacuousTextViewModel.cs" Link="Util\VacuousTextViewModel.cs" />
<None Include="MonoDevelop.SourceEditor.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -120,7 +109,6 @@
<Compile Include="MonoDevelop.SourceEditor\SearchAndReplaceWidget.cs" />
<Compile Include="MonoDevelop.SourceEditor\GotoLineNumberWidget.cs" />
<Compile Include="MonoDevelop.SourceEditor\CompileErrorTooltipProvider.cs" />
- <Compile Include="MonoDevelop.SourceEditor\DebugValueWindow.cs" />
<Compile Include="MonoDevelop.SourceEditor\DebugValueTooltipProvider.cs" />
<Compile Include="MonoDevelop.SourceEditor\Counters.cs" />
<Compile Include="MonoDevelop.SourceEditor\PinnedWatchWidget.cs" />
@@ -193,7 +181,7 @@
<Compile Include="Mono.TextEditor.Theatrics\SingleActorStage.cs" />
<Compile Include="Mono.TextEditor.Theatrics\SmartScrolledWindow.cs" />
<Compile Include="Mono.TextEditor.Theatrics\Stage.cs" />
- <None Include="packages.config" />
+ <Compile Include="VSEditor\TextEditorInitializationService.cs" />
<Compile Include="MonoDevelop.SourceEditor\TextMarker\LineSeparatorMarker.cs" />
<Compile Include="MonoDevelop.SourceEditor.QuickTasks\QuickTaskOverviewMode.IndicatorDrawingCache.cs" />
<Compile Include="MonoDevelop.SourceEditor.QuickTasks\QuickTaskOverviewMode.IdleUpdater.cs" />
@@ -204,19 +192,14 @@
<Compile Include="VSEditor\MDUtils.cs" />
<Compile Include="VSEditor\SmartIndentationService.cs" />
<Compile Include="VSEditor\TagBasedSyntaxHighlighting.cs" />
- <Compile Include="VSEditor\TextEditorFactoryService.cs" />
<Compile Include="VSEditor\TextSelection.cs" />
<Compile Include="VSEditor\TextViewRoleSet.cs" />
- <Compile Include="VSEditor\VacuousTextDataModel.cs" />
- <Compile Include="VSEditor\FakeWpf\Geometry.cs" />
- <Compile Include="VSEditor\FakeWpf\Mouse.cs" />
<Compile Include="VSEditor\FakeWpf\SimulatingExtensions.cs" />
<Compile Include="VSEditor\Language\Def\Intellisense\IPopupIntellisensePresenter.cs" />
<Compile Include="VSEditor\Language\Impl\Helpers.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\BaseIntellisenseSession.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\CurrentLineSpaceReservationAgent.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\IMultiSessionIntellisensePresenter.cs" />
- <Compile Include="VSEditor\Language\Impl\Intellisense\IntellisenseManager.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\IntellisenseSession.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\IntellisenseSessionStack.cs" />
<Compile Include="VSEditor\Language\Impl\Intellisense\IntellisenseSessionStackMapService.cs" />
@@ -255,7 +238,6 @@
<Compile Include="VSEditor\Text\Impl\WpfView\SpaceReservationManager.cs" />
<Compile Include="VSEditor\Text\Impl\WpfView\SpaceReservationStack.cs" />
<Compile Include="VSEditor\Text\Util\TextDataUtil\MappingHelper.cs" />
- <Compile Include="VSEditor\VisualStudio\Impl\ViewAdapter\TipManager.cs" />
<Compile Include="Gui\MonoDevelop.SourceEditor.GotoLineNumberWidget.cs" />
<Compile Include="Gui\MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel.cs" />
<Compile Include="Gui\MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel.cs" />
@@ -292,6 +274,7 @@
<Compile Include="Mono.TextEditor\Gui\CodePreviewWindow.cs" />
<Compile Include="MonoDevelop.SourceEditor\TextMarker\SmartTagMarginMarker.cs" />
<Compile Include="Mono.TextEditor\Gui\QuickFixMargin.cs" />
+ <Compile Include="..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\UIExtensionSelector.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.SourceEditor.addin.xml" />
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
index d600daa60b..7258d4ed36 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueTooltipProvider.cs
@@ -61,7 +61,7 @@ namespace MonoDevelop.SourceEditor
{
if (tooltip == null)
return;
- var debuggerSession = tooltip.tree.Frame?.DebuggerSession;
+ var debuggerSession = tooltip.Tree.Frame?.DebuggerSession;
if (debuggerSession == null || debuggerSession == sender) {
tooltip.Destroy ();
tooltip = null;
@@ -130,7 +130,7 @@ namespace MonoDevelop.SourceEditor
public override Window CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
{
- var window = new DebugValueWindow (editor, offset, DebuggingService.CurrentFrame, (ObjectValue)item.Item, null);
+ var window = new DebugValueWindow ((Gtk.Window)(editor.GetNativeWidget<Gtk.Widget> ()).Toplevel, editor.FileName, editor.OffsetToLocation (offset).Line, DebuggingService.CurrentFrame, (ObjectValue)item.Item, null);
IdeApp.CommandService.RegisterTopWindow (window);
return window;
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
index 8c71157a14..bcc0972ace 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
@@ -2407,7 +2407,7 @@ namespace MonoDevelop.SourceEditor
return TextEditor.GetTextEditorData ();
if (type.Equals (typeof (IDocumentReloadPresenter)))
return widget;
- if (type.Equals (typeof (Microsoft.VisualStudio.Text.ITextDocument)))
+ if (type.Equals (typeof (ITextDocument)))
return Document.VsTextDocument;
return null;
}
@@ -3157,6 +3157,10 @@ namespace MonoDevelop.SourceEditor
public override void DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics, int startOffset, int endOffset)
{
try {
+ foreach (var fold in editor.Document.GetFoldingsFromOffset (Offset)) {
+ if (fold.IsCollapsed)
+ return;
+ }
double fromX, toX;
GetLineDrawingPosition (metrics, startOffset, out fromX, out toX);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarginMarker.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarginMarker.cs
index cd0a28b473..a225c0befc 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarginMarker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/TextMarker/SmartTagMarginMarker.cs
@@ -21,7 +21,6 @@ namespace MonoDevelop.SourceEditor
public IDocumentLine Line => base.LineSegment;
public event EventHandler ShowPopup;
- public event EventHandler CancelPopup;
public SmartTagSeverity SmartTagSeverity { get; set; }
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/ConnectionManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/ConnectionManager.cs
index 3d4b395614..b58eacc7fa 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/ConnectionManager.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/ConnectionManager.cs
@@ -15,6 +15,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
using Microsoft.VisualStudio.Utilities;
using Microsoft.VisualStudio.Text.Projection;
using Microsoft.VisualStudio.Text.Utilities;
+ using System.Linq;
internal class ConnectionManager
{
@@ -22,9 +23,9 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
{
private readonly Lazy<ITextViewConnectionListener, IContentTypeAndTextViewRoleMetadata> importInfo;
private ITextViewConnectionListener listener;
- private readonly GuardedOperations guardedOperations;
+ private readonly IGuardedOperations guardedOperations;
- public Listener(Lazy<ITextViewConnectionListener, IContentTypeAndTextViewRoleMetadata> importInfo, GuardedOperations guardedOperations)
+ public Listener(Lazy<ITextViewConnectionListener, IContentTypeAndTextViewRoleMetadata> importInfo, IGuardedOperations guardedOperations)
{
this.importInfo = importInfo;
this.guardedOperations = guardedOperations;
@@ -50,11 +51,23 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
ITextView _textView;
List<Listener> listeners = new List<Listener>();
- GuardedOperations _guardedOperations;
+ IGuardedOperations _guardedOperations;
+
+ static readonly string[] allowedTextViewConnectionListeners = {
+ "Microsoft.CodeAnalysis.Editor.TextBufferAssociatedViewService",
+ "Microsoft.CodeAnalysis.Editor.TypeScript.ScriptContexts.ScriptBlockConnectionListener",
+ "Microsoft.VisualStudio.JSON.Package.Commands.VsJSONTextViewConnectionListener",
+ "Microsoft.CodeAnalysis.Editor.TextBufferAssociatedViewService",
+ "Microsoft.VisualStudio.Editor.Razor.RazorTextViewConnectionListener",
+ "Microsoft.VisualStudio.Html.Package.Commands.Html.VsHtmlTextViewConnectionListener",
+ "Microsoft.VisualStudio.Html.Package.Commands.CSS.VsCssTextViewConnectionListener",
+ "WebToolingAddin.IntellisenseManagerConnectionListener"
+ //"Microsoft.VisualStudio.Language.Intellisense.Implementation.IntellisenseManagerConnectionListener"
+ };
public ConnectionManager(ITextView textView,
ICollection<Lazy<ITextViewConnectionListener, IContentTypeAndTextViewRoleMetadata>> textViewConnectionListeners,
- GuardedOperations guardedOperations)
+ IGuardedOperations guardedOperations)
{
if (textView == null)
{
@@ -79,6 +92,11 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
{
foreach (var listenerExport in filteredListeners)
{
+ if (!allowedTextViewConnectionListeners.Contains(listenerExport.Value.ToString()))
+ {
+ continue;
+ }
+
Listener listener = new Listener(listenerExport, guardedOperations);
this.listeners.Add(listener);
@@ -95,8 +113,12 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
}
}
}
- textView.BufferGraph.GraphBuffersChanged += OnGraphBuffersChanged;
- textView.BufferGraph.GraphBufferContentTypeChanged += OnGraphBufferContentTypeChanged;
+
+ if (listeners.Count > 0)
+ {
+ textView.BufferGraph.GraphBuffersChanged += OnGraphBuffersChanged;
+ textView.BufferGraph.GraphBufferContentTypeChanged += OnGraphBufferContentTypeChanged;
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Geometry.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Geometry.cs
deleted file mode 100644
index cea8d67b83..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Geometry.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xwt;
-
-namespace System.Windows.Media
-{
- public abstract class Geometry
- {
- public static Geometry Empty { get; } = new EmptyGeometry ();
- public abstract Rectangle Bounds { get; }
-
- public abstract bool IsEmpty ();
- }
-
- class EmptyGeometry : Geometry
- {
- public override Rectangle Bounds => Rectangle.Zero;
-
- public override bool IsEmpty ()
- {
- return true;
- }
- }
-
- public class GeometryGroup : Geometry
- {
- public List<Geometry> Children { get; } = new List<Geometry> ();
-
- public override Rectangle Bounds {
- get {
- Rectangle union = new Rectangle ();
- foreach (var c in Children)
- union = union.Union (c.Bounds);
- return union;
- }
- }
- public override bool IsEmpty ()
- {
- return !Children.Any (c => !c.IsEmpty ());
- }
- }
-
- public class RectangleGeometry : Geometry
- {
- public Rectangle Rectangle;
- public RectangleGeometry (Rectangle rectangle)
- {
- this.Rectangle = rectangle;
- }
-
- public override Rectangle Bounds => Rectangle;
-
- public override bool IsEmpty ()
- {
- return Rectangle.IsEmpty;
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Mouse.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Mouse.cs
deleted file mode 100644
index d854ea3934..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/FakeWpf/Mouse.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Mono.TextEditor;
-using Xwt;
-
-namespace System.Windows.Input
-{
- class Mouse
- {
- internal static Point GetPosition (Gtk.Widget widget)
- {
- widget.GetPointer (out int x, out int y);
- return new Point (x, y);
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs
index 55562abb41..7e49f15b5b 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/IMdTextView.cs
@@ -1,21 +1,19 @@
namespace Microsoft.VisualStudio.Text.Editor
{
- internal interface IMdTextView : ITextView2
- {
- /// <summary>
- /// Gets a named <see cref="ISpaceReservationManager"/>.
- /// </summary>
- /// <param name="name">The name of the manager.</param>
- /// <returns>An instance of the manager in this view. Not null.</returns>
- /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="name"/> is not registered via an <see cref="SpaceReservationManagerDefinition"/>.</exception>
- /// <remarks>
- /// <para>Managers must be exported using <see cref="SpaceReservationManagerDefinition"/> component parts.</para>
- /// </remarks>
- ISpaceReservationManager GetSpaceReservationManager (string name);
+ internal interface IMdTextView :
+#if WINDOWS
+ ITextView2
+#else
+ ITextView3
+#endif
+ {
+ MonoDevelop.SourceEditor.IMDSpaceReservationManager GetSpaceReservationManager(string name);
- Gtk.Container VisualElement
+ Gtk.Container VisualElement
{
get;
}
+
+ void Focus();
}
} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Helpers.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Helpers.cs
index c747a2cee0..08eeb348e0 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Helpers.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Helpers.cs
@@ -138,7 +138,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
internal static IEnumerable<TStyle> GetMatchingPresenterStyles<TSession, TStyle>
(TSession session,
IList<Lazy<TStyle, IOrderableContentTypeMetadata>> orderedPresenterStyles,
- GuardedOperations guardedOperations)
+ IGuardedOperations guardedOperations)
where TSession : IIntellisenseSession
{
List<TStyle> styles = new List<TStyle>();
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/BaseIntellisenseSession.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/BaseIntellisenseSession.cs
index c8d2849a4d..5b30575658 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/BaseIntellisenseSession.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/BaseIntellisenseSession.cs
@@ -88,7 +88,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
protected IIntellisensePresenter FindPresenter
(IIntellisenseSession session,
IList<Lazy<IIntellisensePresenterProvider, IOrderableContentTypeMetadata>> orderedPresenterProviders,
- GuardedOperations guardedOperations)
+ IGuardedOperations guardedOperations)
{
var buffers = Helpers.GetBuffersForTriggerPoint(session);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/CurrentLineSpaceReservationAgent.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/CurrentLineSpaceReservationAgent.cs
index f61e991312..eb0948e049 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/CurrentLineSpaceReservationAgent.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/CurrentLineSpaceReservationAgent.cs
@@ -9,6 +9,7 @@ using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
+using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Formatting;
using Microsoft.VisualStudio.Text.Utilities;
@@ -17,9 +18,9 @@ using MonoDevelop.Components;
using Rect = Xwt.Rectangle;
using Point = Xwt.Point;
-namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
+namespace MonoDevelop.SourceEditor
{
- internal class CurrentLineSpaceReservationAgent : ISpaceReservationAgent
+ internal class CurrentLineSpaceReservationAgent : IMDSpaceReservationAgent
{
internal const string CurrentLineSRManagerName = "currentline";
@@ -37,6 +38,11 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
public void TextViewCreated(ITextView textView)
{
+ if (!(textView is IMdTextView))
+ {
+ return;
+ }
+
var sessionStack = this.IntellisenseSessionStackMapService.GetStackForTextView(textView);
if (sessionStack != null)
{
@@ -122,7 +128,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
}
}
- private void OnSRManager_AgentChanged(object sender, SpaceReservationAgentChangedEventArgs e)
+ private void OnSRManager_AgentChanged(object sender, MDSpaceReservationAgentChangedEventArgs e)
{
if (_isAttached && (e.OldAgent == this))
{
@@ -188,7 +194,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
{
var topLeft = ((IMdTextView)_textView).VisualElement.GetScreenCoordinates
(new Gdk.Point((int)_textView.ViewportLeft, (int)(caretLine.TextTop - _textView.ViewportTop)));
- Rect screenRect = new Rect
+ var screenRect = new System.Windows.Rect
(topLeft.X,
topLeft.Y,
_textView.ViewportWidth,
@@ -203,8 +209,8 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
}
}
- private ISpaceReservationManager _currentLineSRManager;
- private ISpaceReservationManager CurrentLineSRManager
+ private IMDSpaceReservationManager _currentLineSRManager;
+ private IMDSpaceReservationManager CurrentLineSRManager
{
get
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseManager.cs
deleted file mode 100644
index c9b1847b37..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseManager.cs
+++ /dev/null
@@ -1,194 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright (c) Microsoft Corporation. All rights reserved.
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Projection;
-using Microsoft.VisualStudio.Text.Utilities;
-using Microsoft.VisualStudio.Utilities;
-
-namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
-{
- [PartCreationPolicy(CreationPolicy.NonShared)]
- [Export(typeof(ITextViewConnectionListener))]
- [ContentType("text")]
- [TextViewRole(PredefinedTextViewRoles.Editable)]
- [TextViewRole(PredefinedTextViewRoles.EmbeddedPeekTextView)]
- [TextViewRole(PredefinedTextViewRoles.CodeDefinitionView)]
- internal class IntellisenseManagerConnectionListener : ITextViewConnectionListener
- {
- [ImportMany]
- internal List<Lazy<IIntellisenseControllerProvider, IContentTypeMetadata>> IntellisenseControllerFactories { get; set; }
-
- [Import]
- internal IGuardedOperations GuardedOperations { get; set; }
-
- public void SubjectBuffersConnected(
- ITextView textView,
- ConnectionReason reason,
- IReadOnlyCollection<ITextBuffer> subjectBuffers)
- {
- IntellisenseManager manager = textView.Properties.GetOrCreateSingletonProperty(
- delegate { return new IntellisenseManager(this, textView); });
-
- // Create the appropriate Intellisense controllers for the content types in the buffer graph. It's important that we do
- // this after creating the brokers, as the controllers will most likely start using the brokers immediately.
-
- for (int f = 0; f < this.IntellisenseControllerFactories.Count; ++f)
- {
- var factory = this.IntellisenseControllerFactories[f];
-
- // filter subject buffers to get the ones that match the factory content types
- FrugalList<ITextBuffer> matchingSubjectBuffers = new FrugalList<ITextBuffer>();
- foreach (string factoryContentType in factory.Metadata.ContentTypes)
- {
- foreach (ITextBuffer subjectBuffer in subjectBuffers)
- {
- if (subjectBuffer.ContentType.IsOfType(factoryContentType) &&
- !matchingSubjectBuffers.Contains(subjectBuffer))
- {
- matchingSubjectBuffers.Add(subjectBuffer);
- }
- }
- }
-
- if (matchingSubjectBuffers.Count > 0)
- {
- // This controller factory is registered for the content type we understand. Go ahead and create
- // one. Note that this won't give us a handle to a controller object. We wouldn't be able to do anything
- // with such a reference anyway.
-
- if (manager.Controllers[f] == null)
- {
- manager.Controllers[f] = this.GuardedOperations.InstantiateExtension
- (factory, factory,
- provider => provider.TryCreateIntellisenseController(textView, matchingSubjectBuffers));
- }
- else
- {
- foreach (ITextBuffer matchingSubjectBuffer in matchingSubjectBuffers)
- {
- manager.Controllers[f].ConnectSubjectBuffer(matchingSubjectBuffer);
- }
- }
- }
- }
- }
-
- public void SubjectBuffersDisconnected(
- ITextView textView,
- ConnectionReason reason,
- IReadOnlyCollection<ITextBuffer> subjectBuffers)
- {
- // Notify controllers that subject buffer is no longer interesting. We let the controller figure out if the
- // buffer was interesting in the first place.
- IntellisenseManager manager = textView.Properties.GetProperty<IntellisenseManager>(typeof(IntellisenseManager));
-
- for (int f = 0; f < manager.Controllers.Length; ++f)
- {
- if (manager.Controllers[f] != null)
- {
- foreach (ITextBuffer subjectBuffer in subjectBuffers)
- {
- manager.Controllers[f].DisconnectSubjectBuffer(subjectBuffer);
- }
- }
- }
- }
- }
-
- internal class IntellisenseManager
- {
- private readonly IntellisenseManagerConnectionListener _componentContext;
- private readonly ITextView _associatedTextView;
- public IIntellisenseController[] Controllers { get; private set; }
-
- internal IntellisenseManager(IntellisenseManagerConnectionListener componentContext, ITextView associatedTextView)
- {
- _componentContext = componentContext;
- this.Controllers = new IIntellisenseController[_componentContext.IntellisenseControllerFactories.Count];
- _associatedTextView = associatedTextView;
-
- _associatedTextView.Closed += this.OnViewClosed;
- _associatedTextView.BufferGraph.GraphBufferContentTypeChanged += this.OnGraphBufferContentTypeChange;
- }
-
- private void OnViewClosed(object sender, EventArgs e)
- {
- // Detach each of the Intellisense controllers on the associated view. We won't need them anymore
- foreach (var controller in this.Controllers)
- {
- if (controller != null)
- {
- controller.Detach(_associatedTextView);
- }
- }
-
- // Stop listening to events
- _associatedTextView.Closed -= this.OnViewClosed;
- _associatedTextView.BufferGraph.GraphBufferContentTypeChanged -= this.OnGraphBufferContentTypeChange;
- }
-
- private void OnGraphBufferContentTypeChange(object sender, GraphBufferContentTypeChangedEventArgs args)
- {
- if (args.BeforeContentType.IsOfType("text") && args.AfterContentType.IsOfType("text"))
- {
- // We won't get subject buffers connected/disconnected calls when both the before & after content
- // types are "text", but we still need to manage intellisense controllers in this situation.
- // The broker associated with the subjectBuffer in question remains the same.
- ITextBuffer subjectBuffer = args.TextBuffer;
-
- for (int f = 0; f < _componentContext.IntellisenseControllerFactories.Count; ++f)
- {
- var factory = _componentContext.IntellisenseControllerFactories[f];
- bool beforeMatch = false;
- bool afterMatch = false;
- foreach (string factoryContentType in factory.Metadata.ContentTypes)
- {
- if (args.BeforeContentType.IsOfType(factoryContentType))
- {
- beforeMatch = true;
- }
- if (args.AfterContentType.IsOfType(factoryContentType))
- {
- afterMatch = true;
- }
- }
- if (beforeMatch != afterMatch)
- {
- if (beforeMatch)
- {
- if (this.Controllers[f] != null)
- {
- // the controller will be null if its creation failed
- this.Controllers[f].DisconnectSubjectBuffer(subjectBuffer);
- // should we destroy the controller if it has no more buffers?
- }
- }
-
- if (afterMatch)
- {
- if (this.Controllers[f] != null)
- {
- this.Controllers[f].ConnectSubjectBuffer(subjectBuffer);
- }
- else
- {
- this.Controllers[f] =
- this._componentContext.GuardedOperations.InstantiateExtension(
- factory,
- factory,
- provider => provider.TryCreateIntellisenseController
- (_associatedTextView, new FrugalList<ITextBuffer>() { subjectBuffer }));
- }
- }
- }
- }
- }
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStack.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStack.cs
index f53c921949..81045c5e5c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStack.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStack.cs
@@ -1,4 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Microsoft Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -8,6 +8,10 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Windows.Input;
using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.SourceEditor;
+
+// this conflicts with the new editor, but it's internal and will be removed
+#pragma warning disable CS0436 // Type conflicts with imported type
namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
{
@@ -51,10 +55,10 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
private IMdTextView _textView;
private StackList<IIntellisenseSession> _sessions = new StackList<IIntellisenseSession>();
private ReadOnlyObservableCollection<IIntellisenseSession> _readOnlySessions;
- private Dictionary<IIntellisenseSession, ISpaceReservationAgent> _reservationAgentIndex =
- new Dictionary<IIntellisenseSession, ISpaceReservationAgent>();
- private Dictionary<ISpaceReservationAgent, ISpaceReservationManager> _reservationManagerIndex =
- new Dictionary<ISpaceReservationAgent, ISpaceReservationManager>();
+ private Dictionary<IIntellisenseSession, IMDSpaceReservationAgent> _reservationAgentIndex =
+ new Dictionary<IIntellisenseSession, IMDSpaceReservationAgent>();
+ private Dictionary<IMDSpaceReservationAgent, IMDSpaceReservationManager> _reservationManagerIndex =
+ new Dictionary<IMDSpaceReservationAgent, IMDSpaceReservationManager>();
private IIntellisenseSession _keyboardSession;
private IIntellisenseSession _sessionBeingRehosted;
@@ -101,8 +105,9 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
// Subscribe to events on this new session
session.Dismissed += this.OnSessionDismissed;
- session.PresenterChanged += this.OnSessionPresenterChanged;
- IPopupIntellisensePresenter popupPresenter = session.Presenter as IPopupIntellisensePresenter;
+ session.PresenterChanged += this.OnSessionPresenterChanged;
+
+ IPopupIntellisensePresenter popupPresenter = session.Presenter as IPopupIntellisensePresenter;
if (popupPresenter != null)
{
popupPresenter.SurfaceElementChanged += this.OnPresenterSurfaceElementChanged;
@@ -205,7 +210,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
return false;
}
- private void OnSpaceReservationManager_AgentChanged(object sender, SpaceReservationAgentChangedEventArgs e)
+ private void OnSpaceReservationManager_AgentChanged(object sender, MDSpaceReservationAgentChangedEventArgs e)
{
if (e.NewAgent == null)
{
@@ -412,7 +417,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
if (popupPresenter.SurfaceElement == null)
{ return; }
- ISpaceReservationManager manager = _textView.GetSpaceReservationManager(popupPresenter.SpaceReservationManagerName);
+ IMDSpaceReservationManager manager = _textView.GetSpaceReservationManager(popupPresenter.SpaceReservationManagerName);
if (manager != null)
{
// If this is the first time we've seen this manager, subscribe to its AgentChanged event.
@@ -422,7 +427,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
manager.AgentChanged += this.OnSpaceReservationManager_AgentChanged;
}
- ISpaceReservationAgent agent = manager.CreatePopupAgent(popupPresenter.PresentationSpan,
+ IMDSpaceReservationAgent agent = manager.CreatePopupAgent(popupPresenter.PresentationSpan,
popupPresenter.PopupStyles,
popupPresenter.SurfaceElement);
@@ -463,10 +468,10 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
try
{
- ISpaceReservationAgent oldAgent = null;
+ IMDSpaceReservationAgent oldAgent = null;
if ((_reservationAgentIndex.TryGetValue(session, out oldAgent)) && (oldAgent != null))
{
- ISpaceReservationManager manager = null;
+ IMDSpaceReservationManager manager = null;
if ((_reservationManagerIndex.TryGetValue(oldAgent, out manager)) && (manager != null))
{
manager.UpdatePopupAgent(oldAgent, popupPresenter.PresentationSpan, popupPresenter.PopupStyles);
@@ -509,10 +514,10 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
// Now, see if we have a popup agent for this presenter. If so, let's get rid of it. This is what will "hide" the
// popup.
- ISpaceReservationAgent agent;
+ IMDSpaceReservationAgent agent;
if ((_reservationAgentIndex.TryGetValue(session, out agent)) && (agent != null))
{
- ISpaceReservationManager manager;
+ IMDSpaceReservationManager manager;
if ((_reservationManagerIndex.TryGetValue(agent, out manager)) && (manager != null))
{
manager.RemoveAgent(agent);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStackMapService.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStackMapService.cs
index f110d2ae4b..d061903a62 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStackMapService.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSessionStackMapService.cs
@@ -11,7 +11,7 @@ using Microsoft.VisualStudio.Utilities;
namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
{
- [Export(typeof(IIntellisenseSessionStackMapService))]
+ //[Export(typeof(IIntellisenseSessionStackMapService))]
internal sealed class IntellisenseSessionStackMapService : IIntellisenseSessionStackMapService
{
[Import]
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSpaceReservationManagers.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSpaceReservationManagers.cs
index 462b256e00..51a6efa800 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSpaceReservationManagers.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/IntellisenseSpaceReservationManagers.cs
@@ -3,36 +3,37 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Language.Intellisense;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
-namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
+namespace MonoDevelop.SourceEditor
{
internal class IntellisenseSpaceReservationManagers
{
[Export]
[Name(CurrentLineSpaceReservationAgent.CurrentLineSRManagerName)]
[Order(Before = IntellisenseSpaceReservationManagerNames.SmartTagSpaceReservationManagerName)]
- internal SpaceReservationManagerDefinition currentLineManager;
+ internal MDSpaceReservationManagerDefinition currentLineManager;
[Export]
[Name(IntellisenseSpaceReservationManagerNames.SmartTagSpaceReservationManagerName)]
[Order(Before = IntellisenseSpaceReservationManagerNames.QuickInfoSpaceReservationManagerName)]
- internal SpaceReservationManagerDefinition smartTagManager;
+ internal MDSpaceReservationManagerDefinition smartTagManager;
[Export]
[Name(IntellisenseSpaceReservationManagerNames.QuickInfoSpaceReservationManagerName)]
[Order(Before = IntellisenseSpaceReservationManagerNames.SignatureHelpSpaceReservationManagerName)]
- internal SpaceReservationManagerDefinition quickInfoManager;
+ internal MDSpaceReservationManagerDefinition quickInfoManager;
[Export]
[Name(IntellisenseSpaceReservationManagerNames.SignatureHelpSpaceReservationManagerName)]
[Order(Before = IntellisenseSpaceReservationManagerNames.CompletionSpaceReservationManagerName)]
- internal SpaceReservationManagerDefinition signatureHelpManager;
+ internal MDSpaceReservationManagerDefinition signatureHelpManager;
[Export]
[Name(IntellisenseSpaceReservationManagerNames.CompletionSpaceReservationManagerName)]
[Order()]
- internal SpaceReservationManagerDefinition completionManager;
+ internal MDSpaceReservationManagerDefinition completionManager;
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenter.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenter.cs
index c153df47d9..c4596d4b67 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenter.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenter.cs
@@ -1,4 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Microsoft Corporation. All rights reserved.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -14,6 +14,9 @@ using Xwt;
using Xwt.Backends;
using Rect = Xwt.Rectangle;
+// this conflicts with the new editor, but it's internal and will be removed
+#pragma warning disable CS0436 // Type conflicts with imported type
+
namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
{
internal sealed class DefaultSignatureHelpPresenter : IPopupIntellisensePresenter, IObscuringTip, IIntellisenseCommandTarget, IMultiSessionIntellisensePresenter<ISignatureHelpSession>
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenterProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenterProvider.cs
index 5bb292ab30..9792cca190 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenterProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/DefaultSignatureHelpPresenterProvider.cs
@@ -53,14 +53,8 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
internal ITextBufferFactoryService TextBufferFactoryService { get; set; }
[Import]
- internal ITextEditorFactoryService TextEditorFactoryService { get; set; }
-
- [Import]
internal IEditorOptionsFactoryService EditorOptionsFactoryService { get; set; }
- [Import]
- internal GuardedOperations GuardedOperations { get; set; }
-
#if DEBUG
[ImportMany]
internal List<Lazy<IObjectTracker>> ObjectTrackers { get; set; }
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/SignatureHelpBroker.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/SignatureHelpBroker.cs
index 7b42f3cdee..3aa4df1a93 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/SignatureHelpBroker.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Language/Impl/Intellisense/SignatureHelp/SignatureHelpBroker.cs
@@ -13,7 +13,7 @@ using Microsoft.VisualStudio.Utilities;
namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
{
- [Export(typeof(ISignatureHelpBroker))]
+ //[Export(typeof(ISignatureHelpBroker))]
internal class SignatureHelpBroker : ISignatureHelpBroker
{
[ImportMany]
@@ -42,7 +42,7 @@ namespace Microsoft.VisualStudio.Language.Intellisense.Implementation
internal IIntellisenseSessionStackMapService IntellisenseSessionStackMap { get; set; }
[Import]
- internal GuardedOperations GuardedOperations { get; set; }
+ internal IGuardedOperations GuardedOperations { get; set; }
#if DEBUG
[ImportMany]
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/SmartIndentationService.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/SmartIndentationService.cs
index 4a7a752e17..46dbdccef9 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/SmartIndentationService.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/SmartIndentationService.cs
@@ -13,14 +13,14 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
using Microsoft.VisualStudio.Text.Utilities;
using Microsoft.VisualStudio.Utilities;
- [Export(typeof(ISmartIndentationService))]
+ //[Export(typeof(ISmartIndentationService))]
internal sealed class SmartIndentationService : ISmartIndentationService, ISmartIndent
{
[ImportMany]
internal List<Lazy<ISmartIndentProvider, IContentTypeMetadata>> SmartIndentProviders { get; set; }
[Import]
- internal GuardedOperations GuardedOperations { get; set; }
+ internal IGuardedOperations GuardedOperations { get; set; }
[Import]
internal IContentTypeRegistryService ContentTypeRegistryService { get; set; }
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Adornments/ToolTipPresenterStyle.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Adornments/ToolTipPresenterStyle.cs
index f484f58301..fd405a92d5 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Adornments/ToolTipPresenterStyle.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Adornments/ToolTipPresenterStyle.cs
@@ -14,7 +14,7 @@
/// All exports of this component part should be ordered before the "default" ToolTip presenter style. At a minimum, this
/// means adding [Order(Before="default")] to the export metadata.
/// </remarks>
- public class ToolTipPresenterStyle
+ public class ToolTipPresenterStyle2
{
/// <summary>
/// Gets a string that identifies the appearance category for the <see cref="ITextView"/>
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationAgent.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationAgent.cs
index 7fd2dd12a8..f9b537ac3a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationAgent.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationAgent.cs
@@ -2,7 +2,7 @@
// 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.Editor
+namespace MonoDevelop.SourceEditor
{
using System.Windows.Media;
using System;
@@ -10,13 +10,13 @@ namespace Microsoft.VisualStudio.Text.Editor
/// <summary>
/// Handles the display of space reservation adornments.
/// </summary>
- public interface ISpaceReservationAgent
+ public interface IMDSpaceReservationAgent
{
/// <summary>
- /// Positions and displays the contents of the the <see cref="ISpaceReservationAgent"/>.
+ /// Positions and displays the contents of the the <see cref="IMDSpaceReservationAgent"/>.
/// </summary>
/// <param name="reservedSpace">Currently reserved space.</param>
- /// <returns>The space. If null is returned, the <see cref="ISpaceReservationManager"/> will remove the agent.</returns>
+ /// <returns>The space. If null is returned, the <see cref="IMDSpaceReservationManager"/> will remove the agent.</returns>
/// <remarks>If an agent does not want to be removed, but also does not wish to request any additional space, it can return a non-null but empty Geometry.</remarks>
Geometry PositionAndDisplay(Geometry reservedSpace);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationManager.cs
index b64d4ab8bb..a84c726a54 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationManager.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/ISpaceReservationManager.cs
@@ -2,26 +2,26 @@
// 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.Editor
+namespace MonoDevelop.SourceEditor
{
+ using System;
using System.Collections.ObjectModel;
+ using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
- using System;
- using MonoDevelop.Components;
-
+
/// <summary>
/// Manages space reservation adornments.
/// </summary>
- public interface ISpaceReservationManager
+ public interface IMDSpaceReservationManager
{
/// <summary>
- /// Creates a default implementation of an <see cref="ISpaceReservationAgent"/> that displays <paramref name="content"/> in a popup window.
+ /// Creates a default implementation of an <see cref="IMDSpaceReservationAgent"/> that displays <paramref name="content"/> in a popup window.
/// </summary>
/// <param name="visualSpan">The span of text associated with the tip.</param>
/// <param name="style">The style options for displaying the tip.</param>
/// <param name="content">The UI element to be displayed in the tip.</param>
- /// <returns>An <see cref="ISpaceReservationAgent"/> that will display the desired content in a popup window.</returns>
- ISpaceReservationAgent CreatePopupAgent(ITrackingSpan visualSpan, PopupStyles style, Xwt.Widget content);
+ /// <returns>An <see cref="IMDSpaceReservationAgent"/> that will display the desired content in a popup window.</returns>
+ IMDSpaceReservationAgent CreatePopupAgent(ITrackingSpan visualSpan, PopupStyles style, Xwt.Widget content);
/// <summary>
/// Updates <paramref name="agent"/> with the <paramref name="visualSpan"/>.
@@ -29,32 +29,32 @@ namespace Microsoft.VisualStudio.Text.Editor
/// </summary>
/// <param name="agent">The agent to add.</param>
/// <param name="visualSpan">The agent's new visual span.</param>
- void UpdatePopupAgent(ISpaceReservationAgent agent, ITrackingSpan visualSpan, PopupStyles styles);
+ void UpdatePopupAgent(IMDSpaceReservationAgent agent, ITrackingSpan visualSpan, PopupStyles styles);
/// <summary>
/// Adds <paramref name="agent"/> to the list of agents managed by this manager.
/// </summary>
/// <param name="agent">The agent to add.</param>
- void AddAgent(ISpaceReservationAgent agent);
+ void AddAgent(IMDSpaceReservationAgent agent);
/// <summary>
/// Removes <paramref name="agent"/> from the list of agents managed by this manager.
/// </summary>
/// <param name="agent">The agent to remove.</param>
/// <returns><c>true</c> if the agent was in the list of agents to remove.</returns>
- bool RemoveAgent(ISpaceReservationAgent agent);
+ bool RemoveAgent(IMDSpaceReservationAgent agent);
/// <summary>
/// Gets the list of agents managed by this manager.
/// </summary>
- /// <remarks>Any implementation of aa <see cref="ISpaceReservationAgent"/> can be used for this method.</remarks>
- ReadOnlyCollection<ISpaceReservationAgent> Agents { get; }
+ /// <remarks>Any implementation of aa <see cref="IMDSpaceReservationAgent"/> can be used for this method.</remarks>
+ ReadOnlyCollection<IMDSpaceReservationAgent> Agents { get; }
/// <summary>
/// Occurs when the agent is changed.
/// </summary>
/// <remarks></remarks>
- event EventHandler<SpaceReservationAgentChangedEventArgs> AgentChanged;
+ event EventHandler<MDSpaceReservationAgentChangedEventArgs> AgentChanged;
/// <summary>
/// Determines whether the mouse is over an agent managed by this manager.
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationAgentChangedEventArgs.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationAgentChangedEventArgs.cs
index 55aea71068..6e7023008e 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationAgentChangedEventArgs.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationAgentChangedEventArgs.cs
@@ -2,25 +2,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.Editor
+namespace MonoDevelop.SourceEditor
{
using System;
/// <summary>
- /// Provides information when an <see cref="ISpaceReservationAgent"/> is changed in an <see cref="ISpaceReservationManager"/>.
+ /// Provides information when an <see cref="IMDSpaceReservationAgent"/> is changed in an <see cref="IMDSpaceReservationManager"/>.
/// </summary>
- public class SpaceReservationAgentChangedEventArgs : EventArgs
+ public class MDSpaceReservationAgentChangedEventArgs : EventArgs
{
- private readonly ISpaceReservationAgent _newAgent;
- private readonly ISpaceReservationAgent _oldAgent;
+ private readonly IMDSpaceReservationAgent _newAgent;
+ private readonly IMDSpaceReservationAgent _oldAgent;
/// <summary>
- /// Initializes a new instance of <see cref="SpaceReservationAgentChangedEventArgs"/>.
+ /// Initializes a new instance of <see cref="MDSpaceReservationAgentChangedEventArgs"/>.
/// </summary>
- /// <param name="oldAgent">The <see cref="ISpaceReservationAgent "/> associated with the previous value.</param>
- /// <param name="newAgent">The <see cref="ISpaceReservationAgent "/> associated with the new value.</param>
- public SpaceReservationAgentChangedEventArgs(ISpaceReservationAgent oldAgent, ISpaceReservationAgent newAgent)
+ /// <param name="oldAgent">The <see cref="IMDSpaceReservationAgent "/> associated with the previous value.</param>
+ /// <param name="newAgent">The <see cref="IMDSpaceReservationAgent "/> associated with the new value.</param>
+ public MDSpaceReservationAgentChangedEventArgs(IMDSpaceReservationAgent oldAgent, IMDSpaceReservationAgent newAgent)
{
_oldAgent = oldAgent;
_newAgent = newAgent;
@@ -29,11 +29,11 @@ namespace Microsoft.VisualStudio.Text.Editor
/// <summary>
/// Gets the old agent.
/// </summary>
- public ISpaceReservationAgent OldAgent { get { return _oldAgent; } }
+ public IMDSpaceReservationAgent OldAgent { get { return _oldAgent; } }
/// <summary>
/// Gets the new agent.
/// </summary>
- public ISpaceReservationAgent NewAgent { get { return _newAgent; } }
+ public IMDSpaceReservationAgent NewAgent { get { return _newAgent; } }
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationManagerDefinition.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationManagerDefinition.cs
index 4691cf03c0..708b434c2a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationManagerDefinition.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Def/TextUIWpf/Editor/SpaceReservationManagerDefinition.cs
@@ -2,10 +2,10 @@
// 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.Editor
+namespace MonoDevelop.SourceEditor
{
/// <summary>
- /// Represents metadata for an <see cref="ISpaceReservationManager"/>.
+ /// Represents metadata for an <see cref="IMDSpaceReservationManager"/>.
/// </summary>
/// <remarks>
/// Because you cannot subclass this type, you can simply use the [Export] attribute.
@@ -21,7 +21,7 @@ namespace Microsoft.VisualStudio.Text.Editor
/// { other components }
/// }
/// </example>
- public sealed class SpaceReservationManagerDefinition
+ public sealed class MDSpaceReservationManagerDefinition
{
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/GuardedToolTipPresenter.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/GuardedToolTipPresenter.cs
index 937358b5b8..150c8ebdb3 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/GuardedToolTipPresenter.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/GuardedToolTipPresenter.cs
@@ -23,8 +23,10 @@
public event EventHandler Dismissed;
- internal IToolTipPresenter Presenter { get; }
-
+ internal IToolTipPresenter Presenter { get; }
+
+ public bool IsMouseOverAggregated => false;
+
public void Dismiss()
{
if (!this.isDismissed)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ToolTipService.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ToolTipService.cs
index 079bebbe98..22fe187d67 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ToolTipService.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ToolTipService.cs
@@ -8,7 +8,7 @@
using Microsoft.VisualStudio.Threading;
using Microsoft.VisualStudio.Utilities;
- [Export(typeof(IToolTipService))]
+ //[Export(typeof(IToolTipService))]
internal sealed class ToolTipService : IToolTipService
{
private readonly IEnumerable<Lazy<IToolTipPresenterFactory, IOrderable>> unorderedPresenterProviders;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ViewElementFactoryService.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ViewElementFactoryService.cs
index 8777c9e26b..e73640b86a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ViewElementFactoryService.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/ToolTipAdornment/ViewElementFactoryService.cs
@@ -1,4 +1,7 @@
-namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
+// this conflicts with the new editor, but it's internal and will be removed
+#pragma warning disable CS0436 // Type conflicts with imported type
+
+namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
{
using System;
using System.Collections.Generic;
@@ -9,7 +12,7 @@
using Microsoft.VisualStudio.Threading;
using Microsoft.VisualStudio.Utilities;
- [Export(typeof(IViewElementFactoryService))]
+ //[Export(typeof(IViewElementFactoryService))]
internal sealed class ViewElementFactoryService : IViewElementFactoryService
{
private readonly IEnumerable<Lazy<IViewElementFactory, IViewElementFactoryMetadata>> unorderedViewFactories;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/BaseWpfToolTipPresenter.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/BaseWpfToolTipPresenter.cs
index b9be9c100a..84aca344a9 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/BaseWpfToolTipPresenter.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/BaseWpfToolTipPresenter.cs
@@ -10,7 +10,8 @@
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Components;
- using Xwt;
+ using Xwt;
+ using Point = Xwt.Point;
internal abstract class BaseWpfToolTipPresenter : IToolTipPresenter, IObscuringTip
{
@@ -18,7 +19,7 @@
protected readonly IObscuringTipManager obscuringTipManager;
protected readonly ITextView textView;
protected readonly ToolTipParameters parameters;
- protected readonly ToolTipPresenterStyle presenterStyle;
+ protected readonly ToolTipPresenterStyle2 presenterStyle;
protected readonly MonoDevelop.Components.XwtPopup popup = new MonoDevelop.Components.XwtPopup (Xwt.PopupWindow.PopupType.Tooltip);
protected ITrackingSpan applicableToSpan;
@@ -29,7 +30,7 @@
IObscuringTipManager obscuringTipManager,
ITextView textView,
ToolTipParameters parameters,
- ToolTipPresenterStyle presenterStyle)
+ ToolTipPresenterStyle2 presenterStyle)
{
this.viewElementFactoryService = viewElementFactoryService
?? throw new ArgumentNullException(nameof(viewElementFactoryService));
@@ -151,8 +152,10 @@
}
}
- protected IMdTextView WpfTextView => this.textView as IMdTextView;
-
+ protected IMdTextView WpfTextView => this.textView as IMdTextView;
+
+ public bool IsMouseOverAggregated => false;
+
protected Point GetScreenPointFromTextXY(double x, double y)
{
var view = WpfTextView;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/DefaultToolTipPresenterStyle.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/DefaultToolTipPresenterStyle.cs
index 71fcd35f9e..33cccdefd4 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/DefaultToolTipPresenterStyle.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/DefaultToolTipPresenterStyle.cs
@@ -5,9 +5,9 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Utilities;
- [Export(typeof(ToolTipPresenterStyle))]
+ [Export(typeof(ToolTipPresenterStyle2))]
[Name("default")]
- internal sealed class DefaultToolTipPresenterStyle : ToolTipPresenterStyle
+ internal sealed class DefaultToolTipPresenterStyle : ToolTipPresenterStyle2
{
public DefaultToolTipPresenterStyle()
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProvider.cs
index 5d8a94a48a..e578b8cf65 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProvider.cs
@@ -13,9 +13,10 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using System.Windows;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
- using Microsoft.VisualStudio.Text.Editor;
- using MonoDevelop.Components;
-
+ using Microsoft.VisualStudio.Text.Editor;
+ using MonoDevelop.Components;
+ using MonoDevelop.SourceEditor;
+
/// <summary>
/// An adornment provider that can create and display ToolTips taking an arbitrary object as content.
/// </summary>
@@ -23,8 +24,8 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
{
#region Private Members
private readonly IMdTextView _textView;
- internal readonly ISpaceReservationManager _spaceReservationManager;
- internal ISpaceReservationAgent _agent;
+ internal readonly IMDSpaceReservationManager _spaceReservationManager;
+ internal IMDSpaceReservationAgent _agent;
#endregion
internal ToolTipProvider(IMdTextView textView)
@@ -34,7 +35,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
_spaceReservationManager.AgentChanged += OnAgentChanged;
}
- void OnAgentChanged(object sender, SpaceReservationAgentChangedEventArgs e)
+ void OnAgentChanged(object sender, MDSpaceReservationAgentChangedEventArgs e)
{
if (_agent == e.OldAgent)
_agent = null;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProviderFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProviderFactory.cs
index 7b1e38e59d..4002793054 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProviderFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/Legacy/ToolTipProviderFactory.cs
@@ -13,6 +13,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
using System.ComponentModel.Composition;
+ using MonoDevelop.SourceEditor;
[Export(typeof(IToolTipProviderFactory))]
[Obsolete]
@@ -22,15 +23,16 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
[Export]
[Name("ToolTip")]
[Order()]
- internal SpaceReservationManagerDefinition tooltipManager;
+ internal MDSpaceReservationManagerDefinition tooltipManager;
public IToolTipProvider GetToolTipProvider(ITextView textView)
{
- var wpfTextView = textView as IMdTextView;
- if (wpfTextView == null)
- throw new ArgumentException("Invalid TextView");
+ if (!(textView is IMdTextView mdTextView))
+ {
+ return null;
+ }
- return CreateToolTipProviderInternal(wpfTextView);
+ return CreateToolTipProviderInternal(mdTextView);
}
internal static ToolTipProvider CreateToolTipProviderInternal(IMdTextView view)
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/MouseTrackingWpfToolTipPresenter.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/MouseTrackingWpfToolTipPresenter.cs
index 4456e1fa8a..c0e2d0c972 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/MouseTrackingWpfToolTipPresenter.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/MouseTrackingWpfToolTipPresenter.cs
@@ -7,9 +7,10 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Text.Adornments;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Formatting;
- using Xwt;
- using Rect = Xwt.Rectangle;
- using System.Windows.Input;
+ using Xwt;
+ using Rect = Xwt.Rectangle;
+ using Point = Xwt.Point;
+ using System.Windows.Input;
using MonoDevelop.Components;
internal sealed class MouseTrackingWpfToolTipPresenter : BaseWpfToolTipPresenter
@@ -24,7 +25,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
IObscuringTipManager obscuringTipManager,
ITextView textView,
ToolTipParameters parameters,
- ToolTipPresenterStyle presenterStyle)
+ ToolTipPresenterStyle2 presenterStyle)
: base(viewElementFactoryService, obscuringTipManager, textView, parameters, presenterStyle)
{
}
@@ -152,14 +153,15 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
throw new InvalidOperationException("Can't determine the relative position of the mouse without a WpfTextView.");
}
- Point mousePoint;
- //if (e != null)
+ Point mousePoint;
+ //if (e != null)
+ //{
+ // mousePoint = e.GetPosition(view.VisualElement);
+ //}
+ //else
//{
- // mousePoint = e.GetPosition(view.VisualElement);
- //}
- //else
- //{
- mousePoint = Mouse.GetPosition(view.VisualElement);
+ view.VisualElement.GetPointer(out var x, out var y);
+ mousePoint = new Point(x, y);
//}
mousePoint.X += view.ViewportLeft;
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/SpanTrackingWpfToolTipPresenter.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/SpanTrackingWpfToolTipPresenter.cs
index b0fb9d3911..49096489bd 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/SpanTrackingWpfToolTipPresenter.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/SpanTrackingWpfToolTipPresenter.cs
@@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
IObscuringTipManager obscuringTipManager,
ITextView textView,
ToolTipParameters parameters,
- ToolTipPresenterStyle presenterStyle)
+ ToolTipPresenterStyle2 presenterStyle)
: base(viewElementFactoryService, obscuringTipManager, textView, parameters, presenterStyle)
{
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ToolTipStyleFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ToolTipStyleFactory.cs
index 78f4bc4f95..95895c1bab 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ToolTipStyleFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ToolTipStyleFactory.cs
@@ -8,16 +8,16 @@
using Microsoft.VisualStudio.Utilities;
[Export]
- internal sealed class ToolTipStyleFactory
+ internal sealed class ToolTipStyleFactory2
{
- private ToolTipPresenterStyle style;
+ private ToolTipPresenterStyle2 style;
- [ImportMany]
- #pragma warning disable 649 // unassigned
- private List<Lazy<ToolTipPresenterStyle, IOrderable>> unorderedPresenterStyles;
- #pragma warning restore 649
-
- public ToolTipPresenterStyle Style
+ [ImportMany]
+#pragma warning disable 649 // unassigned
+ private List<Lazy<ToolTipPresenterStyle2, IOrderable>> unorderedPresenterStyles;
+#pragma warning restore 649
+
+ public ToolTipPresenterStyle2 Style
{
get
{
@@ -27,7 +27,7 @@
if (this.style == null)
{
- throw new ArgumentNullException($"No exports of type {nameof(ToolTipPresenterStyle)}");
+ throw new ArgumentNullException($"No exports of type {nameof(ToolTipPresenterStyle2)}");
}
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfClassifiedTextElementViewElementFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfClassifiedTextElementViewElementFactory.cs
index 017bf5fae5..8eb99c584b 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfClassifiedTextElementViewElementFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfClassifiedTextElementViewElementFactory.cs
@@ -9,19 +9,19 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Utilities;
using UIElement = Xwt.Widget;
- [Export(typeof(IViewElementFactory))]
+ //[Export(typeof(IViewElementFactory))]
[Name("default ClassifiedTextElement to UIElement")]
[TypeConversion(from: typeof(ClassifiedTextElement), to: typeof(UIElement))]
[Order]
internal sealed class WpfClassifiedTextElementViewElementFactory : IViewElementFactory
{
private readonly IClassificationTypeRegistryService classificationTypeRegistryService;
- private readonly ToolTipStyleFactory styleFactory;
+ private readonly ToolTipStyleFactory2 styleFactory;
[ImportingConstructor]
public WpfClassifiedTextElementViewElementFactory(
IClassificationTypeRegistryService classificationTypeRegistryService,
- ToolTipStyleFactory styleFactory)
+ ToolTipStyleFactory2 styleFactory)
{
this.classificationTypeRegistryService = classificationTypeRegistryService
?? throw new ArgumentNullException(nameof(classificationTypeRegistryService));
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfContainerElementViewElementFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfContainerElementViewElementFactory.cs
index 287d4ebbc6..e64c515ce4 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfContainerElementViewElementFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfContainerElementViewElementFactory.cs
@@ -9,7 +9,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Utilities;
using Xwt;
- [Export(typeof(IViewElementFactory))]
+ //[Export(typeof(IViewElementFactory))]
[Name("default ContainerElement to UIElement")]
[TypeConversion(from: typeof(ContainerElement), to: typeof(UIElement))]
[Order]
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfImageElementViewElementFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfImageElementViewElementFactory.cs
index 56b4876a43..c1c5d6b838 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfImageElementViewElementFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfImageElementViewElementFactory.cs
@@ -10,7 +10,7 @@ namespace Microsoft.VisualStudio.Text.AdornmentLibrary.ToolTip.Implementation
using Microsoft.VisualStudio.Utilities;
using UIElement = Xwt.Widget;
- [Export(typeof(IViewElementFactory))]
+ //[Export(typeof(IViewElementFactory))]
[Name("default ImageElement to UIElement")]
[TypeConversion(from: typeof(ImageElement), to: typeof(UIElement))]
[Order]
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfObjectViewElementFactory.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfObjectViewElementFactory.cs
index 61d4252ec7..fcb8ab876c 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfObjectViewElementFactory.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/ViewElementFactories/WpfObjectViewElementFactory.cs
@@ -10,7 +10,7 @@
using Microsoft.VisualStudio.Utilities;
using UIElement = Xwt.Widget;
- [Export (typeof (IViewElementFactory))]
+ //[Export (typeof (IViewElementFactory))]
[Name ("default object to Xwt.Widget")]
[TypeConversion (from: typeof (object), to: typeof (UIElement))]
[Order]
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/WpfToolTipPresenterProvider.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/WpfToolTipPresenterProvider.cs
index 1e8bdf160b..f57912f429 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/WpfToolTipPresenterProvider.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfToolTipAdornment/WpfToolTipPresenterProvider.cs
@@ -18,7 +18,7 @@
internal IObscuringTipManager obscuringTipManager;
[Import]
- internal ToolTipStyleFactory styleFactory;
+ internal ToolTipStyleFactory2 styleFactory;
public IToolTipPresenter Create(ITextView textView, ToolTipParameters parameters)
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/PopupAgent.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/PopupAgent.cs
index 1101b7801b..f2fec24086 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/PopupAgent.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/PopupAgent.cs
@@ -5,7 +5,7 @@
// This file contain implementations details that are subject to change without notice.
// Use at your own risk.
//
-namespace Microsoft.VisualStudio.Text.Editor.Implementation
+namespace MonoDevelop.SourceEditor
{
using System;
using System.Windows;
@@ -17,16 +17,20 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
using Microsoft.VisualStudio.Text.Outlining;
using Microsoft.VisualStudio.Text.Utilities;
using System.Windows.Input;
- using System.Collections.Generic;
- using Xwt;
- using Mono.TextEditor;
+ using System.Windows.Interop;
+ using System.Collections.Generic;
+ using Xwt;
+ using Mono.TextEditor;
using MonoDevelop.Components;
- using Rect = Xwt.Rectangle;
-
- internal class PopupAgent : ISpaceReservationAgent
+ using Rect = Xwt.Rectangle;
+ using Point = Xwt.Point;
+ using Size = Xwt.Size;
+ using System.Runtime.InteropServices;
+
+ internal class PopupAgent : IMDSpaceReservationAgent
{
- internal readonly Mono.TextEditor.MonoTextEditor _textView;
- internal readonly ISpaceReservationManager _manager;
+ internal readonly Mono.TextEditor.MonoTextEditor _textView;
+ internal readonly IMDSpaceReservationManager _manager;
internal ITrackingSpan _visualSpan;
internal PopupStyles _style;
internal Widget _mouseContainer;
@@ -34,7 +38,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
private const int MaxPopupCacheSize = 10;
private const double BelowTheLineBufferHint = 3.0;
- public PopupAgent(Mono.TextEditor.MonoTextEditor textView, ISpaceReservationManager manager, ITrackingSpan visualSpan, PopupStyles style, Widget content)
+ public PopupAgent(Mono.TextEditor.MonoTextEditor textView, IMDSpaceReservationManager manager, ITrackingSpan visualSpan, PopupStyles style, Widget content)
{
if (textView == null)
throw new ArgumentNullException("textView");
@@ -156,7 +160,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
Rect spanRect = spanRectangle.Value;
spanRect = spanRect.Intersect(viewRect);
- if (spanRect != default(Rect))
+ if (spanRect != default(Rect))
{
// Determine two different rectangles for the span. One is the span in its raw form. The other is a "guess" at
// what the already-reserved space around the span will be. We have a very-prevalent space reservation agent (the
@@ -179,12 +183,12 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
PopupStyles alternateStyle = _style ^ PopupStyles.PreferLeftOrTopPosition;
- Rect reservedRect = reservedSpace.Bounds;
- Point topLeft = new Point(Math.Min(spanRectInScreenCoordinates.Left, reservedRect.Left),
- Math.Min(spanRectInScreenCoordinates.Top, reservedRect.Top));
- Point bottomRight = new Point(Math.Max(spanRectInScreenCoordinates.Right, reservedRect.Right),
- Math.Max(spanRectInScreenCoordinates.Bottom, reservedRect.Bottom));
- reservedRect = new Rect(topLeft, bottomRight);
+ var tr = reservedSpace.Bounds;
+ Point topLeft = new Point(Math.Min(spanRectInScreenCoordinates.Left, tr.Left),
+ Math.Min(spanRectInScreenCoordinates.Top, tr.Top));
+ Point bottomRight = new Point(Math.Max(spanRectInScreenCoordinates.Right, tr.Right),
+ Math.Max(spanRectInScreenCoordinates.Bottom, tr.Bottom));
+ var reservedRect = new Rect(topLeft.X, topLeft.Y, bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y);
//There are 6 possible locations for the popup. The order of preference is determined by the presence of the
//'PositionClosest' PopupStyle.
@@ -210,7 +214,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
// the edges of the screen.
Tuple<PopupStyles, Rect>[] positionChoices;
- if (reservedRect != default(Rect))
+ if (reservedRect != default(Rect))
{
if ((_style & PopupStyles.PositionClosest) == 0)
{
@@ -248,7 +252,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
};
}
- Rect location = Rect.Zero;
+ Rect location = default;
foreach (var choice in positionChoices)
{
Rect locationToTry = GetLocation(choice.Item1, desiredSize, spanRectInScreenCoordinates, choice.Item2, screenRect);
@@ -261,7 +265,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
}
// If we couldn't locate a place to live, tell the manager we want to go away.
- if (location == Rect.Zero)
+ if (location == default)
return null;
if (!_popup.IsVisible)
@@ -270,8 +274,8 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
_popup.DisplayAt(location.TopLeft);
GeometryGroup requestedSpace = new GeometryGroup();
- requestedSpace.Children.Add(new RectangleGeometry(spanRectInScreenCoordinates));
- requestedSpace.Children.Add(new RectangleGeometry(location));
+ requestedSpace.Children.Add(new RectangleGeometry(FromXwtRect(spanRectInScreenCoordinates)));
+ requestedSpace.Children.Add(new RectangleGeometry(FromXwtRect(location)));
return requestedSpace;
}
@@ -281,6 +285,9 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
return null;
}
+ static Xwt.Rectangle FromWpfRect(System.Windows.Rect r) => new Xwt.Rectangle(r.Left, r.Top, r.Width, r.Height);
+ static System.Windows.Rect FromXwtRect(Xwt.Rectangle r) => new System.Windows.Rect(r.X, r.Y, r.Width, r.Height);
+
public bool IsMouseOver
{
get
@@ -437,8 +444,8 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
{
// The mouse left the element over which it was originally positioned. This may or
// may not mean that the mouse left the span of text to which the popup is bound.
- _textView.VisualElement.GetPointer (out int x, out int y);
- if (this.ShouldClearToolTipOnMouseMove(new Point(x,y)))
+ _textView.VisualElement.GetPointer(out int x, out int y);
+ if (this.ShouldClearToolTipOnMouseMove(new Point(x, y)))
{
shouldRemoveAgent = true;
}
@@ -641,7 +648,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
if ((width > 0.0) && (height > 0.0))
{
- Geometry insetLocation = new RectangleGeometry(new Rect(left, top, width, height));
+ Geometry insetLocation = new RectangleGeometry(new System.Windows.Rect(left, top, width, height));
return !reserved.Bounds.IntersectsWith(insetLocation.Bounds);//TODO: This was simpliefied
}
else
@@ -658,14 +665,14 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
internal abstract class PopupOrWindowContainer
{
private Widget _content;
- protected Gtk.Container _placementTarget;
+ protected Gtk.Container _placementTarget;
- public static PopupOrWindowContainer Create(Widget content, Gtk.Container placementTarget)
+ public static PopupOrWindowContainer Create(Widget content, Gtk.Container placementTarget)
{
return new PopUpContainer(content, placementTarget);
}
- public PopupOrWindowContainer(Widget content, Gtk.Container placementTarget)
+ public PopupOrWindowContainer(Widget content, Gtk.Container placementTarget)
{
_content = content;
_placementTarget = placementTarget;
@@ -682,37 +689,42 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
public abstract Size Size { get; }
}
- internal class PopUpContainer : PopupOrWindowContainer
+ internal class PopUpContainer : PopupOrWindowContainer
{
-#if WINDOWS
- private class NoTopmostPopup : XwtThemedPopup
- {
- protected override void OnShown ()
+#if false
+ private class NoTopmostPopup : XwtThemedPopup
+ {
+ protected override void OnShown()
{
- WpfHelper.SetNoTopmost(this.Child);
- base.OnShown ();
- }
+ WpfHelper.SetNoTopmost(this.Child);
+ base.OnShown();
+ }
}
- public static void SetNoTopmost(Visual visual)
- {
- if (visual != null)
+ public static void SetNoTopmost(Visual visual)
{
- HwndSource source = PresentationSource.FromVisual(visual) as HwndSource;
- if (source != null)
+ if (visual != null)
{
- const int SWP_NOMOVE = 0x02;
- const int SWP_NOSIZE = 0x01;
- const int SWP_NOACTIVATE = 0x10;
- const int HWND_NOTOPMOST = -2;
- NativeMethods.SetWindowPos(source.Handle, (IntPtr)HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ HwndSource source = PresentationSource.FromVisual(visual) as HwndSource;
+ if (source != null)
+ {
+ const int SWP_NOMOVE = 0x02;
+ const int SWP_NOSIZE = 0x01;
+ const int SWP_NOACTIVATE = 0x10;
+ const int HWND_NOTOPMOST = -2;
+ SetWindowPos(source.Handle, (IntPtr)HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
+ }
}
}
- }
- internal XwtThemedPopup _popup = new NoTopmostPopup ();
-#else
+
+ [DllImport("user32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int flags);
+
+ internal XwtThemedPopup _popup = new NoTopmostPopup();
+#else
internal XwtThemedPopup _popup = new XwtThemedPopup();
-#endif
+#endif
// WPF popup doesn't detach its child from the visual tree when the popup is not open,
// even if we assign Child property to null. That prevents reusing of the popup content.
@@ -725,7 +737,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
// popup closing.
FrameBox _popupContentContainer = new FrameBox();
- public PopUpContainer(Widget content, Gtk.Container placementTarget)
+ public PopUpContainer(Widget content, Gtk.Container placementTarget)
: base(content, placementTarget)
{
WindowTransparencyDecorator.Attach(_popup);//TODO: not sure we want this on all popus?
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationManager.cs
index 49dee36724..09ea66a577 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationManager.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationManager.cs
@@ -5,7 +5,8 @@
// This file contain implementations details that are subject to change without notice.
// Use at your own risk.
//
-namespace Microsoft.VisualStudio.Text.Editor.Implementation
+
+namespace MonoDevelop.SourceEditor
{
using System;
using System.Collections.Generic;
@@ -14,16 +15,16 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
using System.Windows.Media;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Adornments;
- using Microsoft.VisualStudio.Text.Editor;
- using MonoDevelop.Components;
-
- internal class SpaceReservationManager : ISpaceReservationManager
+ using Microsoft.VisualStudio.Text.Editor;
+ using MonoDevelop.Components;
+
+ internal class SpaceReservationManager : IMDSpaceReservationManager
{
- public readonly string Name;
- public readonly int Rank;
- private readonly Mono.TextEditor.MonoTextEditor _view;
+ public string Name { get; }
+ public int Rank { get; }
+ private readonly Mono.TextEditor.MonoTextEditor _view;
private bool _hasAggregateFocus;
- internal IList<ISpaceReservationAgent> _agents = new List<ISpaceReservationAgent>();
+ internal IList<IMDSpaceReservationAgent> _agents = new List<IMDSpaceReservationAgent>();
public SpaceReservationManager(string name, int rank, Mono.TextEditor.MonoTextEditor view)
{
@@ -34,12 +35,13 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
}
#region ISpaceReservationManager Members
- public ISpaceReservationAgent CreatePopupAgent(ITrackingSpan visualSpan, PopupStyles styles, Xwt.Widget content)
+
+ public IMDSpaceReservationAgent CreatePopupAgent(ITrackingSpan visualSpan, PopupStyles styles, Xwt.Widget content)
{
return new PopupAgent(_view, this, visualSpan, styles, content);
}
- public void UpdatePopupAgent(ISpaceReservationAgent agent, ITrackingSpan visualSpan, PopupStyles styles)
+ public void UpdatePopupAgent(IMDSpaceReservationAgent agent, ITrackingSpan visualSpan, PopupStyles styles)
{
if (agent == null)
throw new ArgumentNullException("agent");
@@ -56,12 +58,12 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
_view.QueueSpaceReservationStackRefresh();
}
- public ReadOnlyCollection<ISpaceReservationAgent> Agents
+ public ReadOnlyCollection<IMDSpaceReservationAgent> Agents
{
- get { return new ReadOnlyCollection<ISpaceReservationAgent>(_agents); }
+ get { return new ReadOnlyCollection<IMDSpaceReservationAgent>(_agents); }
}
- public void AddAgent(ISpaceReservationAgent agent)
+ public void AddAgent(IMDSpaceReservationAgent agent)
{
if (agent == null)
throw new ArgumentNullException("agent");
@@ -72,7 +74,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
_view.QueueSpaceReservationStackRefresh();
}
- public bool RemoveAgent(ISpaceReservationAgent agent)
+ public bool RemoveAgent(IMDSpaceReservationAgent agent)
{
if (agent == null)
throw new ArgumentNullException("agent");
@@ -89,7 +91,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
return false;
}
- public event EventHandler<SpaceReservationAgentChangedEventArgs> AgentChanged;
+ public event EventHandler<MDSpaceReservationAgentChangedEventArgs> AgentChanged;
public bool IsMouseOver
{
@@ -122,9 +124,9 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
public event EventHandler LostAggregateFocus;
public event EventHandler GotAggregateFocus;
- #endregion
+#endregion
- internal void ChangeAgents(ISpaceReservationAgent oldAgent, ISpaceReservationAgent newAgent)
+ internal void ChangeAgents(IMDSpaceReservationAgent oldAgent, IMDSpaceReservationAgent newAgent)
{
if (oldAgent != null)
{
@@ -133,9 +135,9 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
oldAgent.Hide();
}
- EventHandler<SpaceReservationAgentChangedEventArgs> agentChanged = this.AgentChanged;
+ EventHandler<MDSpaceReservationAgentChangedEventArgs> agentChanged = this.AgentChanged;
if (agentChanged != null)
- agentChanged(this, new SpaceReservationAgentChangedEventArgs(oldAgent, newAgent));
+ agentChanged(this, new MDSpaceReservationAgentChangedEventArgs(oldAgent, newAgent));
if (newAgent != null)
{
@@ -179,10 +181,10 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
/// </summary>
void OnViewClosed(object sender, EventArgs e)
{
- List<ISpaceReservationAgent> agentsToRemove = new List<ISpaceReservationAgent>();
+ List<IMDSpaceReservationAgent> agentsToRemove = new List<IMDSpaceReservationAgent>();
agentsToRemove.AddRange (_agents);
- foreach (ISpaceReservationAgent agent in agentsToRemove)
+ foreach (IMDSpaceReservationAgent agent in agentsToRemove)
{
this.RemoveAgent (agent);
}
@@ -190,18 +192,18 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
_view.Closed -= this.OnViewClosed;
}
- internal void PositionAndDisplay(GeometryGroup reservedGeometry)
+ public void PositionAndDisplay(GeometryGroup reservedGeometry)
{
_view.GuardedOperations.CallExtensionPoint(this,
() =>
{
if (_agents.Count != 0)
- {
+ {
if (_view.Visible)
{
for (int i = _agents.Count - 1; (i >= 0); --i)
{
- ISpaceReservationAgent agent = _agents[i];
+ IMDSpaceReservationAgent agent = _agents[i];
Geometry requestedGeometry = agent.PositionAndDisplay(reservedGeometry);
if (requestedGeometry == null)
@@ -217,7 +219,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
{
for (int i = _agents.Count - 1; (i >= 0); --i)
{
- ISpaceReservationAgent agent = _agents[i];
+ IMDSpaceReservationAgent agent = _agents[i];
_agents.RemoveAt(i);
this.ChangeAgents(agent, null);
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationStack.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationStack.cs
index fa403acdfe..fb1a777f96 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationStack.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/Text/Impl/WpfView/SpaceReservationStack.cs
@@ -5,14 +5,14 @@
// This file contain implementations details that are subject to change without notice.
// Use at your own risk.
//
-namespace Microsoft.VisualStudio.Text.Editor.Implementation
+namespace MonoDevelop.SourceEditor
{
using System;
using System.Collections.Generic;
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Editor;
- internal class SpaceReservationStack
+ internal class MDSpaceReservationStack
{
#region Private Members
internal Dictionary<string, int> _orderedManagerDefinitions;
@@ -44,13 +44,13 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
#endregion // Private Members
- public SpaceReservationStack(Dictionary<string, int> orderedManagerDefinitions, Mono.TextEditor.MonoTextEditor view)
+ public MDSpaceReservationStack(Dictionary<string, int> orderedManagerDefinitions, Mono.TextEditor.MonoTextEditor view)
{
_orderedManagerDefinitions = orderedManagerDefinitions;
_view = view;
}
- public ISpaceReservationManager GetOrCreateManager(string name)
+ public IMDSpaceReservationManager GetOrCreateManager(string name)
{
foreach (SpaceReservationManager manager in _managers)
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorFactoryService.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorInitializationService.cs
index 0f9bfe1879..e5e07bf5ee 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorFactoryService.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/TextEditorInitializationService.cs
@@ -5,6 +5,10 @@
// This file contain implementations details that are subject to change without notice.
// Use at your own risk.
//
+
+// this conflicts with the new editor, but it's internal and will be removed
+#pragma warning disable CS0436 // Type conflicts with imported type
+
namespace Microsoft.VisualStudio.Text.Editor.Implementation
{
using System;
@@ -26,15 +30,16 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
using Microsoft.VisualStudio.Text.Editor.Implementation;
using Mono.TextEditor;
using Microsoft.VisualStudio.Platform;
+ using MonoDevelop.SourceEditor;
/// <summary>
/// Provides a VisualStudio Service that aids in creation of Editor Views
/// </summary>
- [Export(typeof(ITextEditorFactoryService))]
- internal sealed class TextEditorFactoryService : ITextEditorFactoryService, IPartImportsSatisfiedNotification
+ [Export(typeof(ITextEditorInitializationService))]
+ internal sealed class TextEditorInitializationService : ITextEditorInitializationService, IPartImportsSatisfiedNotification
{
[Import]
- internal GuardedOperations GuardedOperations { get; set; }
+ internal IGuardedOperations GuardedOperations { get; set; }
[Import]
internal IContentTypeRegistryService ContentTypeRegistryService { get; set; }
@@ -57,7 +62,6 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
[Import]
internal IEditorOptionsFactoryService EditorOptionsFactoryService { get; set; }
-
[Import]
internal ITextSearchService2 TextSearchService { get; set; }
@@ -76,7 +80,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
[Import]
internal ISmartIndentationService SmartIndentationService { get; set; }
- [Import(AllowDefault=true)]
+ [Import(AllowDefault = true)]
internal IOutliningManagerService OutliningManagerService { get; set; }
[Import]
@@ -102,30 +106,29 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
PredefinedTextViewRoles.Structured,
PredefinedTextViewRoles.Zoomable);
- public ITextView CreateTextView (ITextBuffer textBuffer)
+ private static readonly string[] allowedTextViewModelProviders =
{
- MonoDevelop.Ide.Editor.ITextDocument textDocument = textBuffer.GetTextEditor();
- TextEditor textEditor = textDocument as TextEditor;
+ "WebToolingAddin.HtmlTextViewModelProvider" // for Razor
+ };
- return CreateTextView(textEditor);
- }
-
- public ITextView CreateTextView (MonoDevelop.Ide.Editor.TextEditor textEditor, ITextViewRoleSet roles = null, IEditorOptions parentOptions = null)
+ public ITextView CreateTextView(MonoDevelop.Ide.Editor.TextEditor textEditor)
{
if (textEditor == null)
{
throw new ArgumentNullException("textEditor");
}
- if (roles == null) {
- roles = _defaultRoles;
- }
+ var roles = _defaultRoles;
ITextBuffer textBuffer = textEditor.GetContent<Mono.TextEditor.ITextEditorDataProvider>().GetTextEditorData().Document.TextBuffer;
ITextDataModel dataModel = new VacuousTextDataModel(textBuffer);
+ var providers = TextViewModelProviders
+ .Where (t => allowedTextViewModelProviders.Contains (t.Value.ToString ()))
+ .ToArray ();
+
ITextViewModel viewModel = UIExtensionSelector.InvokeBestMatchingFactory
- (TextViewModelProviders,
+ (providers,
dataModel.ContentType,
roles,
(provider) => (provider.CreateTextViewModel(dataModel, roles)),
@@ -134,7 +137,7 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
this) ?? new VacuousTextViewModel(dataModel);
var view = ((MonoDevelop.SourceEditor.SourceEditorView)textEditor.Implementation).TextEditor;
- view.Initialize(viewModel, roles, parentOptions ?? this.EditorOptionsFactoryService.GlobalOptions, this);
+ view.Initialize(viewModel, roles, this.EditorOptionsFactoryService.GlobalOptions, this);
view.Properties.AddProperty(typeof(MonoDevelop.Ide.Editor.TextEditor), textEditor);
this.TextViewCreated?.Invoke(this, new TextViewCreatedEventArgs(view));
@@ -171,18 +174,18 @@ namespace Microsoft.VisualStudio.Text.Editor.Implementation
return new TextViewRoleSet(roles);
}
- private static ITextViewRoleSet RolesFromParameters (params string[] roles)
+ private static ITextViewRoleSet RolesFromParameters(params string[] roles)
{
return new TextViewRoleSet(roles);
}
[ImportMany]
- private List<Lazy<SpaceReservationManagerDefinition, IOrderable>> _spaceReservationManagerDefinitions = null;
+ private List<Lazy<MDSpaceReservationManagerDefinition, IOrderable>> _spaceReservationManagerDefinitions = null;
internal Dictionary<string, int> OrderedSpaceReservationManagerDefinitions = new Dictionary<string, int>();
public void OnImportsSatisfied()
{
- IList<Lazy<SpaceReservationManagerDefinition, IOrderable>> orderedManagers = Orderer.Order(_spaceReservationManagerDefinitions);
+ IList<Lazy<MDSpaceReservationManagerDefinition, IOrderable>> orderedManagers = Orderer.Order(_spaceReservationManagerDefinitions);
for (int i = 0; (i < orderedManagers.Count); ++i)
{
this.OrderedSpaceReservationManagerDefinitions.Add(orderedManagers[i].Metadata.Name, i);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VacuousTextDataModel.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VacuousTextDataModel.cs
deleted file mode 100644
index 7b7aa05112..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VacuousTextDataModel.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-//
-// 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 implementations details that are subject to change without notice.
-// Use at your own risk.
-//
-namespace Microsoft.VisualStudio.Text.Editor
-{
- using System;
- using System.Collections.Generic;
- using Microsoft.VisualStudio.Utilities;
-
- public class VacuousTextDataModel : ITextDataModel
- {
- private ITextBuffer documentBuffer;
-
- public VacuousTextDataModel(ITextBuffer documentBuffer)
- {
- if (documentBuffer == null)
- {
- throw new ArgumentNullException("documentBuffer");
- }
- this.documentBuffer = documentBuffer;
- documentBuffer.ContentTypeChanged += OnDocumentBufferContentTypeChanged;
- }
-
- public event EventHandler<TextDataModelContentTypeChangedEventArgs> ContentTypeChanged;
-
- public IContentType ContentType
- {
- get { return documentBuffer.ContentType; }
- }
-
- public ITextBuffer DocumentBuffer
- {
- get { return this.documentBuffer; }
- }
-
- public ITextBuffer DataBuffer
- {
- get { return this.documentBuffer; }
- }
-
- private void OnDocumentBufferContentTypeChanged(object sender, ContentTypeChangedEventArgs e)
- {
- EventHandler<TextDataModelContentTypeChangedEventArgs> handler = ContentTypeChanged;
- if (handler != null)
- {
- handler(this, new TextDataModelContentTypeChangedEventArgs(e.BeforeContentType, e.AfterContentType));
- }
- }
- }
-} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VisualStudio/Impl/ViewAdapter/TipManager.cs b/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VisualStudio/Impl/ViewAdapter/TipManager.cs
deleted file mode 100644
index 6d733fd1c5..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/VSEditor/VisualStudio/Impl/ViewAdapter/TipManager.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Utilities;
-
-namespace Microsoft.VisualStudio.Editor.Implementation
-{
- [Export (typeof (IObscuringTipManager))]
- public class TipManager : IObscuringTipManager
- {
- public void PushTip (ITextView view, IObscuringTip tip)
- {
- }
-
- public void RemoveTip (ITextView view, IObscuringTip tip)
- {
- }
- }
-} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/packages.config b/main/src/addins/MonoDevelop.SourceEditor2/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/MonoDevelop.SourceEditor2/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewContent.cs
new file mode 100644
index 0000000000..8a58c34980
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewContent.cs
@@ -0,0 +1,283 @@
+//
+// 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 System;
+using System.ComponentModel.Composition;
+
+using AppKit;
+using ObjCRuntime;
+
+using Microsoft.CodeAnalysis.Classification;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Utilities;
+
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using MonoDevelop.Core.FeatureConfiguration;
+using MonoDevelop.Ide.Commands;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.TextEditor
+{
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = ClassificationTypeNames.Text)]
+ [Name (ClassificationTypeNames.Text)]
+ [Order (After = Priority.Default, Before = Priority.High)]
+ [UserVisible (true)]
+ class ClassificationFormatDefinitionFromPreferences : ClassificationFormatDefinition
+ {
+ public ClassificationFormatDefinitionFromPreferences ()
+ {
+ nfloat fontSize = -1;
+ var fontName = Ide.Editor.DefaultSourceEditorOptions.Instance.FontName;
+
+ if (!string.IsNullOrEmpty (fontName)) {
+ var sizeStartOffset = fontName.LastIndexOf (' ');
+ if (sizeStartOffset >= 0) {
+ nfloat.TryParse (fontName.Substring (sizeStartOffset + 1), out fontSize);
+ fontName = fontName.Substring (0, sizeStartOffset);
+ }
+ }
+
+ if (string.IsNullOrEmpty (fontName))
+ fontName = "Menlo";
+
+ if (fontSize <= 1)
+ fontSize = 12;
+
+ FontTypeface = NSFontWorkarounds.FromFontName (fontName, fontSize);
+ }
+ }
+
+ class CocoaTextViewContent : TextViewContent<ICocoaTextView, CocoaTextViewImports>
+ {
+ ICocoaTextViewHost textViewHost;
+ NSView textViewHostControl;
+ GtkNSViewHostControl embeddedControl;
+
+ static readonly Lazy<bool> useManagedGtkNSViewHost = new Lazy<bool> (
+ () => FeatureSwitchService.IsFeatureEnabled ("ManagedGtkNSViewHost").GetValueOrDefault ());
+
+ abstract class GtkNSViewHostControl : Control
+ {
+ public Gtk.Widget GtkView { get; protected set; }
+ }
+
+ sealed class ManagedGtkNSViewHostControl : GtkNSViewHostControl
+ {
+ public ManagedGtkNSViewHostControl (ICocoaTextViewHost textViewHost)
+ {
+ if (textViewHost == null)
+ throw new ArgumentNullException (nameof (textViewHost));
+
+ GtkView = new Gtk.GtkNSViewHost (textViewHost.HostControl);
+ GtkView.Show ();
+ }
+
+ protected override object CreateNativeWidget<T> ()
+ => GtkView;
+
+ public override bool HasFocus
+ => GtkView.HasFocus;
+
+ public override void GrabFocus ()
+ => GtkView.GrabFocus ();
+ }
+
+ sealed class LegacyGtkNSViewHostControl : GtkNSViewHostControl
+ {
+ readonly ICocoaTextViewHost textViewHost;
+ readonly NSView nsView;
+
+ bool nativeViewNeedsFocus;
+
+ public bool IsGrabbingFocus { get; private set; }
+
+ public LegacyGtkNSViewHostControl (ICocoaTextViewHost textViewHost)
+ {
+ this.textViewHost = textViewHost ?? throw new ArgumentNullException (nameof (textViewHost));
+ this.nsView = textViewHost.HostControl;
+
+ GtkView = this.GetNativeWidget<Gtk.Widget> ();
+ GtkView.CanFocus = true;
+
+ textViewHost.HostControlMovedToWindow += OnNativeViewMovedToWindow;
+ }
+
+ protected override void Dispose (bool disposing)
+ {
+ if (disposing)
+ textViewHost.HostControlMovedToWindow -= OnNativeViewMovedToWindow;
+
+ base.Dispose (disposing);
+ }
+
+ protected override object CreateNativeWidget<T> ()
+ => nsView;
+
+ // NOTE: Doesn't seem to be used in any vital way?
+ public override bool HasFocus => base.HasFocus;
+
+ public override void GrabFocus ()
+ {
+ if (IsGrabbingFocus)
+ return;
+
+ IsGrabbingFocus = true;
+ GtkView.GrabFocus ();
+
+ if (nsView.Window != null)
+ FocusEditor ();
+ else
+ nativeViewNeedsFocus = true;
+ }
+
+ private void OnNativeViewMovedToWindow (object sender, EventArgs e)
+ {
+ if (!nativeViewNeedsFocus || nsView.Window == null)
+ return;
+
+ FocusEditor ();
+ }
+
+ private void FocusEditor ()
+ {
+ // We really want the nsView (our grid view) to be first responder,
+ // so focus returns to find widget or whatever. But it's not working
+ // for some reason I can't figure out.
+ //if (!nsView.Window.MakeFirstResponder (nsView))
+ textViewHost.TextView.Focus ();
+
+ // This is necessary to get focus back when using the navigation/breadcrumb bar
+ nsView.Window.MakeKeyAndOrderFront (nsView.Window);
+
+ IsGrabbingFocus = false;
+ }
+ }
+
+ public CocoaTextViewContent (CocoaTextViewImports imports, FilePath fileName, string mimeType, Project ownerProject)
+ : base (imports, fileName, mimeType, ownerProject)
+ {
+ }
+
+ protected override ICocoaTextView CreateTextView (ITextViewModel viewModel, ITextViewRoleSet roles)
+ => Imports.TextEditorFactoryService.CreateTextView (viewModel, roles, Imports.EditorOptionsFactoryService.GlobalOptions);
+
+ protected override ITextViewRoleSet GetAllPredefinedRoles ()
+ => Imports.TextEditorFactoryService.AllPredefinedRoles;
+
+ protected override Control CreateControl ()
+ {
+ textViewHost = Imports.TextEditorFactoryService.CreateTextViewHost (TextView, setFocus: true);
+ textViewHostControl = textViewHost.HostControl;
+
+ if (useManagedGtkNSViewHost.Value) {
+ embeddedControl = new ManagedGtkNSViewHostControl (textViewHost);
+
+ TextView.GotAggregateFocus += (sender, e)
+ => embeddedControl.GtkView.GrabFocus ();
+ } else {
+ var legacyEmbeddedControl = new LegacyGtkNSViewHostControl (textViewHost);
+ embeddedControl = legacyEmbeddedControl;
+
+ TextView.GotAggregateFocus += (sender, e) => {
+ if (!legacyEmbeddedControl.IsGrabbingFocus)
+ embeddedControl.GtkView.GrabFocus ();
+ };
+ }
+
+ TextView.Properties.AddProperty (typeof (Gtk.Widget), embeddedControl.GtkView);
+
+ return embeddedControl;
+ }
+
+ public override void GrabFocus()
+ {
+ embeddedControl.GrabFocus();
+ base.GrabFocus();
+ }
+
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+
+ if (textViewHost != null) {
+ textViewHost.Close ();
+ textViewHost = null;
+ }
+ }
+
+ protected override void InstallAdditionalEditorOperationsCommands ()
+ {
+ base.InstallAdditionalEditorOperationsCommands ();
+
+ EditorOperationCommands.Add (SearchCommands.Find, new EditorOperationCommand (
+ _ => HandleTextFinderAction (
+ TextFinderAction.ShowFindInterface,
+ perform: true),
+ (_, info) => info.Enabled = HandleTextFinderAction (
+ TextFinderAction.ShowFindInterface,
+ perform: false)));
+
+ EditorOperationCommands.Add (SearchCommands.Replace, new EditorOperationCommand (
+ _ => HandleTextFinderAction (
+ TextFinderAction.ShowReplaceInterface,
+ perform: true),
+ (_, info) => info.Enabled = HandleTextFinderAction (
+ TextFinderAction.ShowReplaceInterface,
+ perform: false)));
+
+ bool HandleTextFinderAction (TextFinderAction action, bool perform)
+ {
+ var responder = textViewHostControl?.Window?.FirstResponder;
+
+ if (responder != null && responder.RespondsToSelector (action.Action)) {
+ if (perform)
+ responder.PerformTextFinderAction (action);
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ sealed class TextFinderAction : Foundation.NSObject, INSValidatedUserInterfaceItem
+ {
+ public static readonly TextFinderAction ShowFindInterface
+ = new TextFinderAction (NSTextFinderAction.ShowFindInterface);
+
+ public static readonly TextFinderAction ShowReplaceInterface
+ = new TextFinderAction (NSTextFinderAction.ShowReplaceInterface);
+
+ public Selector Action { get; } = new Selector ("performTextFinderAction:");
+ public nint Tag { get; }
+
+ TextFinderAction (IntPtr handle) : base (handle)
+ {
+ }
+
+ TextFinderAction (NSTextFinderAction action)
+ => Tag = (int)action;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs
new file mode 100644
index 0000000000..36f207524c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewDisplayBinding.cs
@@ -0,0 +1,70 @@
+//
+// 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 System;
+using System.Windows;
+using Gdk;
+using Microsoft.VisualStudio.Text.Classification;
+
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.TextEditor
+{
+ class CocoaTextViewDisplayBinding : TextViewDisplayBinding<CocoaTextViewImports>
+ {
+ static CocoaTextViewDisplayBinding ()
+ {
+ Microsoft.VisualStudio.UI.GettextCatalog.Initialize (GettextCatalog.GetString, GettextCatalog.GetString);
+ Microsoft.VisualStudio.Text.Editor.Implementation.CocoaLocalEventMonitor.FilterGdkEvents += (enable) => {
+ if (enable)
+ Gdk.Window.AddFilterForAll (Filter);
+ else
+ Gdk.Window.RemoveFilterForAll (Filter);
+ };
+ }
+
+ static FilterReturn Filter (IntPtr xevent, Event evnt)
+ {
+ return FilterReturn.Remove;
+ }
+
+ protected override ViewContent CreateContent (CocoaTextViewImports imports, FilePath fileName, string mimeType, Project ownerProject)
+ {
+ return new CocoaTextViewContent (imports, fileName, mimeType, ownerProject);
+ }
+
+ protected override ThemeToClassification CreateThemeToClassification (IEditorFormatMapService editorFormatMapService)
+ => new CocoaThemeToClassification (editorFormatMapService);
+
+ class CocoaThemeToClassification : ThemeToClassification
+ {
+ public CocoaThemeToClassification (IEditorFormatMapService editorFormatMapService) : base (editorFormatMapService) {}
+
+ protected override void AddFontToDictionary (ResourceDictionary resourceDictionary, string fontName, double fontSize)
+ {
+ resourceDictionary [ClassificationFormatDefinition.TypefaceId] = fontName;
+ resourceDictionary [ClassificationFormatDefinition.FontRenderingSizeId] = fontSize;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewImports.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewImports.cs
new file mode 100644
index 0000000000..beda56eaa0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/CocoaTextViewImports.cs
@@ -0,0 +1,33 @@
+//
+// 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 System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.TextEditor
+{
+ [Export]
+ class CocoaTextViewImports : TextViewImports
+ {
+ [Import]
+ public ICocoaTextEditorFactoryService TextEditorFactoryService { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/GtkNSViewHost.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/GtkNSViewHost.cs
new file mode 100644
index 0000000000..d2cadf5da7
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/GtkNSViewHost.cs
@@ -0,0 +1,380 @@
+//
+// 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 System;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+using AppKit;
+using CoreGraphics;
+using ObjCRuntime;
+
+namespace Gtk
+{
+ sealed class GtkNSViewHost : Widget
+ {
+ const string LIBGTKQUARTZ = "libgtk-quartz-2.0.dylib";
+
+ [DllImport (LIBGTKQUARTZ)]
+ static extern IntPtr gdk_quartz_window_get_nsview (IntPtr window);
+
+ [DllImport (LIBGTKQUARTZ)]
+ static extern IntPtr gdk_quartz_event_get_nsevent (IntPtr evnt);
+
+ [DllImport (LIBGTKQUARTZ)]
+ static extern void gdk_window_coords_to_parent (
+ IntPtr window,
+ double x,
+ double y,
+ out double parent_x,
+ out double parent_y);
+
+ [DllImport (LIBGTKQUARTZ)]
+ static extern bool gdk_window_has_native (IntPtr window);
+
+ static NSEvent GetNSEvent (Gdk.Event evnt)
+ {
+ if (evnt == null || evnt.Handle == IntPtr.Zero)
+ return null;
+
+ var nsEventHandle = gdk_quartz_event_get_nsevent (evnt.Handle);
+ if (nsEventHandle == IntPtr.Zero)
+ return null;
+
+ return Runtime.GetNSObject<NSEvent> (nsEventHandle);
+ }
+
+ NSView view;
+ NSView superview;
+
+ public GtkNSViewHost (NSView view)
+ {
+ this.view = view ?? throw new ArgumentNullException (nameof (view));
+
+ WidgetFlags |= WidgetFlags.NoWindow;
+ }
+
+ void UpdateViewFrame ()
+ {
+ LogEnter ();
+ try {
+ if (view == null)
+ return;
+
+ var window = GdkWindow;
+ var allocation = Allocation;
+ double x = allocation.X;
+ double y = allocation.Y;
+
+ while (window != null && !gdk_window_has_native (window.Handle)) {
+ gdk_window_coords_to_parent (window.Handle, x, y, out var nx, out var ny);
+ Log ($"({x},{y}) -> ({nx},{ny})");
+ x = nx;
+ y = ny;
+ window = window.Parent;
+ }
+
+ view.Frame = new CGRect (x, y, allocation.Width, allocation.Height);
+ Log ($"Frame: {view.Frame}");
+ } finally {
+ LogExit ();
+ }
+ }
+
+ static NSView RecursivelyFindSubviewForPredicate (NSView view, Predicate<NSView> predicate)
+ {
+ if (view == null)
+ return null;
+
+ if (predicate (view))
+ return view;
+
+ var subviews = view.Subviews;
+ if (subviews != null && subviews.Length > 0) {
+ foreach (var subview in subviews) {
+ if (subview != null) {
+ var foundView = RecursivelyFindSubviewForPredicate (subview, predicate);
+ if (foundView != null)
+ return foundView;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ NSView GetAcceptsFirstResponderView ()
+ => RecursivelyFindSubviewForPredicate (view, v => v.AcceptsFirstResponder ());
+
+ protected override void OnDestroyed ()
+ {
+ LogEnter ();
+ try {
+ view?.RemoveFromSuperview ();
+ view = null;
+ superview = null;
+
+ base.OnDestroyed ();
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnRealized ()
+ {
+ LogEnter ();
+ try {
+ GdkWindow = Parent?.GdkWindow;
+
+ if (GdkWindow != null && GdkWindow.Handle != IntPtr.Zero) {
+ var superviewHandle = gdk_quartz_window_get_nsview (GdkWindow.Handle);
+ if (superviewHandle != IntPtr.Zero)
+ superview = Runtime.GetNSObject<NSView> (superviewHandle);
+ }
+
+ if (superview != null && view != null)
+ superview.AddSubview (view);
+
+ base.OnRealized ();
+
+ UpdateViewFrame ();
+ CanFocus = GetAcceptsFirstResponderView () != null;
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnUnrealized ()
+ {
+ LogEnter ();
+ try {
+ Unmap ();
+
+ view?.RemoveFromSuperview ();
+ superview = null;
+
+ base.OnUnrealized ();
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnMapped ()
+ {
+ LogEnter ();
+ try {
+ if (view != null)
+ view.Hidden = false;
+
+ base.OnMapped ();
+
+ UpdateViewFrame ();
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnUnmapped ()
+ {
+ LogEnter ();
+ try {
+ if (view != null)
+ view.Hidden = true;
+
+ base.OnUnmapped ();
+
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override bool OnConfigureEvent (Gdk.EventConfigure evnt)
+ {
+ LogEnter ();
+ try {
+ return base.OnConfigureEvent (evnt);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnSizeRequested (ref Requisition requisition)
+ {
+ LogEnter ();
+ try {
+ if (view == null) {
+ Log ("Calling base. 'view' is null");
+ base.OnSizeRequested (ref requisition);
+ return;
+ }
+
+ var fittingSize = view.FittingSize;
+ requisition.Width = (int)fittingSize.Width;
+ requisition.Height = (int)fittingSize.Height;
+ Log ($"Setting requisition to {requisition.Width}x{requisition.Height}");
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override void OnSizeAllocated (Gdk.Rectangle allocation)
+ {
+ LogEnter ();
+ try {
+ base.OnSizeAllocated (allocation);
+
+ UpdateViewFrame ();
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override bool OnFocusInEvent (Gdk.EventFocus evnt)
+ {
+ LogEnter ();
+ try {
+ var acceptsFirstResponderView = GetAcceptsFirstResponderView ();
+ if (acceptsFirstResponderView == null) {
+ Log ("neither view nor descendants accept first responder");
+ return false;
+ }
+
+ if (acceptsFirstResponderView.Window == null) {
+ Log ("first responder found, but it does not have a window");
+ return false;
+ }
+
+ acceptsFirstResponderView.Window.MakeFirstResponder (acceptsFirstResponderView);
+
+ UpdateViewFrame ();
+
+ return base.OnFocusInEvent (evnt);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override bool OnFocusOutEvent (Gdk.EventFocus evnt)
+ {
+ LogEnter ();
+ try {
+ var firstResponder = view?.Window.FirstResponder as NSView;
+ if (firstResponder != null && view?.AncestorSharedWithView (firstResponder) == view)
+ firstResponder.Window.MakeFirstResponder (null);
+ return base.OnFocusOutEvent (evnt);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override bool OnWidgetEvent (Gdk.Event evnt)
+ {
+ LogEnter ();
+ try {
+ UpdateViewFrame ();
+ return base.OnWidgetEvent (evnt);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ bool ForwardEvent<TEvent> (
+ TEvent evnt,
+ Action<NSView, NSEvent> forwardCall,
+ Func<TEvent, bool> baseCall) where TEvent : Gdk.Event
+ {
+ var acceptsFirstResponderView = GetAcceptsFirstResponderView ();
+ if (acceptsFirstResponderView == null)
+ return false;
+
+ var nsEvent = GetNSEvent (evnt);
+ if (nsEvent == null)
+ return false;
+
+ forwardCall (acceptsFirstResponderView, nsEvent);
+
+ return baseCall (evnt);
+ }
+
+ protected override bool OnKeyPressEvent (Gdk.EventKey evnt)
+ {
+ LogEnter ();
+ try {
+ return ForwardEvent (
+ evnt,
+ (v, e) => v.KeyDown (e),
+ base.OnKeyReleaseEvent);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ protected override bool OnKeyReleaseEvent (Gdk.EventKey evnt)
+ {
+ LogEnter ();
+ try {
+ return ForwardEvent (
+ evnt,
+ (v, e) => v.KeyUp (e),
+ base.OnKeyReleaseEvent);
+ } finally {
+ LogExit ();
+ }
+ }
+
+ #region Tracing
+
+ int traceDepth;
+ int traceGeneration;
+
+ [Conditional ("DEBUG")]
+ void LogIndent ()
+ => Debug.Write ($"{traceGeneration:0000}|{new string (' ', traceDepth * 2)}");
+
+ [Conditional ("DEBUG")]
+ void Log (string message, [CallerMemberName] string memberName = null)
+ {
+ LogIndent ();
+ Debug.WriteLine ($"{memberName}: {message}");
+ }
+
+ [Conditional ("DEBUG")]
+ void LogEnter ([CallerMemberName] string memberName = null)
+ {
+ if (traceDepth == 0)
+ traceGeneration++;
+ LogIndent ();
+ Debug.WriteLine ($"Enter: {memberName}");
+ traceDepth++;
+ }
+
+ [Conditional ("DEBUG")]
+ void LogExit ([CallerMemberName] string memberName = null)
+ {
+ traceDepth--;
+ LogIndent ();
+ Debug.WriteLine ($"Exit: {memberName}");
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/ImageService.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/ImageService.cs
new file mode 100644
index 0000000000..69f7aa4f74
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/ImageService.cs
@@ -0,0 +1,103 @@
+//
+// 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 System.Collections.Generic;
+using System.ComponentModel.Composition;
+
+using Microsoft.VisualStudio.Core.Imaging;
+
+using MonoDevelop.Core;
+using MDImageService = MonoDevelop.Ide.ImageService;
+
+namespace MonoDevelop.TextEditor.Cocoa
+{
+ // Import with AllowDefault:true
+ [Export (typeof (IImageService))]
+ public class ImageService : IImageService
+ {
+ static readonly Dictionary<ImageDescription, object> descriptionToImageMap = new Dictionary<ImageDescription, object> ();
+ static readonly Dictionary<ImageTags, string []> tagsToStylesMap = new Dictionary<ImageTags, string []> ();
+
+ public object GetImage (ImageDescription imageDescription)
+ {
+ if (descriptionToImageMap.TryGetValue (imageDescription, out var nativeImage))
+ return nativeImage;
+
+ if (!MDImageService.TryGetImage (imageDescription.Id, generateDefaultIcon: false, out Xwt.Drawing.Image image, out string stockId)) {
+ LoggingService.LogWarning ("ImageService missing ImageDescription: {0}", imageDescription);
+ }
+
+ if (image == null)
+ return null;
+
+ if (imageDescription.Width > 0 && imageDescription.Height > 0)
+ image = image.WithSize (imageDescription.Width, imageDescription.Height);
+
+ if (imageDescription.Tags != ImageTags.None) {
+ if (!tagsToStylesMap.TryGetValue (imageDescription.Tags, out var styles)) {
+ var stylesList = new List<string> (8);
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Dark))
+ stylesList.Add ("dark");
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Disabled))
+ stylesList.Add ("disabled");
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Error))
+ stylesList.Add ("error");
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Hover))
+ stylesList.Add ("hover");
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Pressed))
+ stylesList.Add ("pressed");
+
+ if (imageDescription.Tags.HasFlag (ImageTags.Selected))
+ stylesList.Add ("sel");
+
+ if (stylesList.Count > 0)
+ tagsToStylesMap [imageDescription.Tags] = styles = stylesList.ToArray ();
+ }
+
+ if (styles != null && styles.Length > 0)
+ image = image.WithStyles (styles);
+ }
+
+ if (image != null) {
+ nativeImage = Xwt.Toolkit.NativeEngine.GetNativeImage (image);
+ if (nativeImage is AppKit.NSImage nsImage) {
+ if (stockId != null)
+ nsImage.Name = stockId;
+ if (imageDescription.Tags.HasFlag (ImageTags.Template))
+ nsImage.Template = true;
+ }
+
+ descriptionToImageMap [imageDescription] = nativeImage;
+ return nativeImage;
+ }
+
+ return null;
+ }
+
+ public object GetImage (ImageId imageId)
+ => GetImage (new ImageDescription (imageId, ImageTags.None));
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MdMouseProcessorProvider.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MdMouseProcessorProvider.cs
new file mode 100644
index 0000000000..9d988f4c92
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MdMouseProcessorProvider.cs
@@ -0,0 +1,106 @@
+//
+// MdMouseProcessorProvider.cs
+//
+// Author:
+// David Karlaš <david.karlas@microsoft.com>
+//
+// 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 System;
+using System.ComponentModel.Composition;
+
+using AppKit;
+
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Utilities;
+
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+
+namespace MonoDevelop.TextEditor.Cocoa
+{
+ [Export (typeof (ICocoaMouseProcessorProvider))]
+ [Name ("VisualStudioMouseProcessor")]
+ [Order (Before = "WordSelection")]
+ [ContentType ("Text")]
+ [TextViewRole ("INTERACTIVE")]
+ sealed class MdMouseProcessorProvider : ICocoaMouseProcessorProvider
+ {
+ [Import]
+ public IEditorCommandHandlerServiceFactory CommandServiceFactory { get; private set; }
+
+ public ICocoaMouseProcessor GetAssociatedProcessor (ICocoaTextView cocoaTextView)
+ => new MdMouseProcessor (
+ CommandServiceFactory.GetService (cocoaTextView),
+ cocoaTextView);
+ }
+
+ sealed class MdMouseProcessor : CocoaMouseProcessorBase
+ {
+ const string menuPath = "/MonoDevelop/TextEditor/ContextMenu/Editor";
+
+ readonly IEditorCommandHandlerService commandServiceFactory;
+ readonly ICocoaTextView textView;
+
+ public MdMouseProcessor (
+ IEditorCommandHandlerService commandServiceFactory,
+ ICocoaTextView textView)
+ {
+ this.commandServiceFactory = commandServiceFactory
+ ?? throw new ArgumentNullException (nameof (commandServiceFactory));
+
+ this.textView = textView
+ ?? throw new ArgumentNullException (nameof (textView));
+ }
+
+ public override void PreprocessMouseRightButtonDown (MouseEvent e)
+ => MoveCaretToPosition (textView, e.Event);
+
+ public override void PreprocessMouseRightButtonUp (MouseEvent e)
+ {
+ var view = (ViewContent)textView.Properties [typeof (ViewContent)];
+ var extensionContext = view.WorkbenchWindow?.ExtensionContext ?? Mono.Addins.AddinManager.AddinEngine;
+ var commandEntrySet = IdeApp.CommandService.CreateCommandEntrySet (extensionContext, menuPath);
+
+ var menuPosition = GetViewRelativeMousePosition (textView, e.Event);
+
+ IdeApp.CommandService.ShowContextMenu (
+ textView.VisualElement,
+ (int)menuPosition.X,
+ (int)menuPosition.Y,
+ commandEntrySet,
+ view);
+ }
+
+ public override void PreprocessMouseLeftButtonDown (MouseEvent e)
+ {
+ if ((e.Event.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask) == NSEventModifierMask.ControlKeyMask)
+ PreprocessMouseRightButtonDown (e);
+ }
+
+ public override void PreprocessMouseLeftButtonUp (MouseEvent e)
+ {
+ if ((e.Event.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask) == NSEventModifierMask.ControlKeyMask)
+ PreprocessMouseRightButtonUp (e);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MonoDevelop.TextEditor.Cocoa.csproj b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MonoDevelop.TextEditor.Cocoa.csproj
new file mode 100644
index 0000000000..aa525639f2
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/MonoDevelop.TextEditor.Cocoa.csproj
@@ -0,0 +1,94 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="..\..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesVSEditor)" />
+ <Import Project="$(ReferencesGtk)" />
+ <PropertyGroup>
+ <AssemblyTitle>MonoDevelop Cocoa Text Editor</AssemblyTitle>
+ <AssemblyDescription>Integrates the Cocoa version of the Visual Studio Editor into MonoDevelop</AssemblyDescription>
+ <AddinBuildDir>DisplayBindings\TextEditor.Cocoa</AddinBuildDir>
+ <AddMonoDevelopCoreReferences>true</AddMonoDevelopCoreReferences>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
+ <StartAction>Program</StartAction>
+ <StartProgram>..\..\..\..\build\bin\MonoDevelop.exe</StartProgram>
+ <StartArguments>--no-redirect</StartArguments>
+ <ExternalConsole>false</ExternalConsole>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Xamarin.Mac" HintPath="..\..\..\..\external\Xamarin.Mac.dll" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\CocoaControls\CocoaControls.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Core\Impl\CoreUtilityImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Language\Impl\Language\LanguageImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Language\Impl\StandardClassification\StandardClassificationImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\BraceCompletion\BraceCompletionImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\ClassificationAggregator\ClassificationAggregatorImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\ClassificationFormat\ClassificationFormatMapImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\ClassificationType\ClassificationTypeImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Commanding\CommandingImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\CurrentLineHighlighter\CurrentLineHighlighterImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\DifferenceAlgorithm\DifferenceAlgorithmImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\EditorOperations\EditorOperationsImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\EditorOptions\EditorOptionsImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\EditorPrimitives\EditorPrimitivesImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Find\Find.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Navigation\NavigationImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\NavigationProviders\NavigationProvidersImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Outlining\Outlining.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\RTF\RtfBuilderServiceImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\StandaloneUndo\StandaloneUndoImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\TagAggregator\TagAggregatorImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\TextAndAdornmentSequencer\TextAndAdornmentSequencerImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\TextBufferUndoManager\TextBufferUndoManagerImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\TextModel\TextModelImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\ToolTipAdornment\ToolTipAdornmentImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\TextSearch\TextSearchImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\VisibleWhitespace\VisibleWhitespaceImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\XPlat\MultiCaretImpl\MultiCaretImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextLogicUtil\TextLogicUtil.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\FPF\UIAutomationClient\UIAutomationClient.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\PatternMatching\PatternMatchingImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\GlyphMargin\GlyphMarginImpl.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Language\Util\LanguageUtil\LanguageUtil.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\CocoaView\CocoaViewImpl.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextDataUtil\TextDataUtil.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\TextUIUtil.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Def\InfoBar\InfoBar.csproj" />
+ <ProjectReference Include="..\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj" Private="False" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Remove="icons\vs-find-replace-close-16.png" />
+ <None Remove="icons\vs-find-replace-close-16%402x.png" />
+ <None Remove="icons\vs-find-replace-option-case-sensitive-16~disabled.png" />
+ <None Remove="icons\vs-find-replace-option-case-sensitive-16~disabled%402x.png" />
+ <None Remove="icons\vs-find-replace-option-case-sensitive-16.png" />
+ <None Remove="icons\vs-find-replace-option-case-sensitive-16%402x.png" />
+ <None Remove="icons\vs-find-replace-option-regex-16~disabled.png" />
+ <None Remove="icons\vs-find-replace-option-regex-16~disabled%402x.png" />
+ <None Remove="icons\vs-find-replace-option-regex-16.png" />
+ <None Remove="icons\vs-find-replace-option-regex-16%402x.png" />
+ <None Remove="icons\vs-find-replace-option-whole-words-only-16~disabled.png" />
+ <None Remove="icons\vs-find-replace-option-whole-words-only-16~disabled%402x.png" />
+ <None Remove="icons\vs-find-replace-option-whole-words-only-16.png" />
+ <None Remove="icons\vs-find-replace-option-whole-words-only-16%402x.png" />
+ <None Remove="icons\vs-find-replace-search-16.png" />
+ <None Remove="icons\vs-find-replace-search-16%402x.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="icons\vs-find-replace-close-16.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-close-16%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-case-sensitive-16~disabled.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-case-sensitive-16~disabled%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-case-sensitive-16.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-case-sensitive-16%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-regex-16~disabled.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-regex-16~disabled%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-regex-16.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-regex-16%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-whole-words-only-16~disabled.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-whole-words-only-16~disabled%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-whole-words-only-16.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-option-whole-words-only-16%402x.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-search-16.png" />
+ <EmbeddedResource Include="icons\vs-find-replace-search-16%402x.png" />
+ </ItemGroup>
+</Project>
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/AddinInfo.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/AddinInfo.cs
new file mode 100644
index 0000000000..7aa1149f62
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/AddinInfo.cs
@@ -0,0 +1,40 @@
+//
+// 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 System;
+using Mono.Addins;
+using Mono.Addins.Description;
+
+[assembly:Addin ("TextEditor.Cocoa",
+ Namespace = "MonoDevelop",
+ Version = MonoDevelop.BuildInfo.Version,
+ Category = "MonoDevelop Core")]
+
+[assembly:AddinName ("MonoDevelop Text Editor")]
+[assembly:AddinDescription ("Integrates the Visual Studio text editor")]
+[assembly: AddinFlags (AddinFlags.Hidden)]
+
+[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Debugger", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Refactoring", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/MonoDevelop.TextEditor.Cocoa.addin.xml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/MonoDevelop.TextEditor.Cocoa.addin.xml
new file mode 100644
index 0000000000..6453ba35c5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/Properties/MonoDevelop.TextEditor.Cocoa.addin.xml
@@ -0,0 +1,63 @@
+<ExtensionModel>
+ <Runtime>
+ <Import assembly="../../../bin/Microsoft.VisualStudio.UI.Controls.macOS.dll" />
+ <Import assembly="../../../bin/Microsoft.VisualStudio.Text.Find.Implementation.dll" />
+ </Runtime>
+ <Extension path="/MonoDevelop/Ide/Composition">
+ <Assembly file="../../../bin/Microsoft.VisualStudio.CoreUtilityImplementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Language.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Language.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Language.StandardClassification.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Language.Utilities.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.BufferUndoManager.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Classification.Aggregator.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Classification.LookUp.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Find.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Navigation.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Navigation.NavigationProviders.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Logic.Text.Tagging.Aggregator.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.BraceCompletion.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Data.Utilities.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Differencing.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.EditorOptions.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Find.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Formatting.RtfBuilderService.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Implementation.StandaloneUndo.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Logic.Utilities.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Model.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.MultiCaret.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Outlining.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.PatternMatching.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.Structure.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.UI.Utilities.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.AdornmentLibrary.ToolTip.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.Cocoa.View.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.Commanding.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.EditorOperations.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.EditorPrimitives.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.TextAndAdornmentSequencer.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.Wpf.Classification.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.Wpf.GlyphMargin.Implementation.dll" />
+ <Assembly file="MonoDevelop.TextEditor.Cocoa.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.AdornmentLibrary.VisibleWhitespace.Implementation.dll" />
+ <Assembly file="../../../bin/Microsoft.VisualStudio.UI.Text.CurrentLineHighlighter.Implementation.dll" />
+ </Extension>
+ <Extension path="/MonoDevelop/Ide/DisplayBindings">
+ <DisplayBinding id="TextViewCocoa" insertbefore="TextEditor" class="MonoDevelop.TextEditor.CocoaTextViewDisplayBinding" />
+ </Extension>
+ <Extension path="/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid="vs-find-replace-search" resource="vs-find-replace-search-16.png" size="Menu" imageid="{6114fe54-2a4a-4354-aabb-d2b8fad160a5}#1" />
+ <StockIcon stockid="vs-find-replace-close" resource="vs-find-replace-close-16.png" size="Menu" imageid="{6114fe54-2a4a-4354-aabb-d2b8fad160a5}#2" />
+ <StockIcon stockid="vs-find-replace-option-case-sensitive" resource="vs-find-replace-option-case-sensitive-16.png" size="Menu" imageid="{6114fe54-2a4a-4354-aabb-d2b8fad160a5}#3" />
+ <StockIcon stockid="vs-find-replace-option-regex" resource="vs-find-replace-option-regex-16.png" size="Menu" imageid="{6114fe54-2a4a-4354-aabb-d2b8fad160a5}#4" />
+ <StockIcon stockid="vs-find-replace-option-whole-words-only" resource="vs-find-replace-option-whole-words-only-16.png" size="Menu" imageid="{6114fe54-2a4a-4354-aabb-d2b8fad160a5}#5" />
+ </Extension>
+ <Extension path = "/MonoDevelop/TextEditor/CommandMapping">
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.DeleteKey" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.BackspaceKeyCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.SearchCommands.Find" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.FindCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.SearchCommands.FindNext" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.FindNextCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.SearchCommands.FindPrevious" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.FindPreviousCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.SearchCommands.Replace" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.ReplaceCommandArgs" />
+ </Extension>
+</ExtensionModel> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16.png
new file mode 100644
index 0000000000..cb75ad193f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16@2x.png
new file mode 100644
index 0000000000..a81c673b30
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-close-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16.png
new file mode 100644
index 0000000000..380706e8aa
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16@2x.png
new file mode 100644
index 0000000000..38040a3460
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled.png
new file mode 100644
index 0000000000..4ac273a7c5
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled@2x.png
new file mode 100644
index 0000000000..f21e082a65
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-case-sensitive-16~disabled@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16.png
new file mode 100644
index 0000000000..0ceaf07e63
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16@2x.png
new file mode 100644
index 0000000000..03e9a660ad
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled.png
new file mode 100644
index 0000000000..a81ff731ad
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled@2x.png
new file mode 100644
index 0000000000..2fe2811678
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-regex-16~disabled@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16.png
new file mode 100644
index 0000000000..500bfdc7ac
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16@2x.png
new file mode 100644
index 0000000000..85ebe8acca
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled.png
new file mode 100644
index 0000000000..9694f52b3c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled@2x.png
new file mode 100644
index 0000000000..a1642fe36c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-option-whole-words-only-16~disabled@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16.png
new file mode 100644
index 0000000000..ea52a426a4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16@2x.png b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16@2x.png
new file mode 100644
index 0000000000..a1431bb43e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Cocoa/icons/vs-find-replace-search-16@2x.png
Binary files differ
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs
new file mode 100644
index 0000000000..69261b99cb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs
@@ -0,0 +1,224 @@
+//
+// 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 System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Language.StandardClassification;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Ide.Text
+{
+ class WebClassification
+ {
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Element Name")]
+ [Name ("HTML Element Name")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLElementName : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLElementName ()
+ {
+ ForegroundColor = Colors.Maroon;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Attribute Name")]
+ [Name ("HTML Attribute Name")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLAttributeName : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLAttributeName ()
+ {
+ ForegroundColor = Colors.Red;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Attribute Value")]
+ [Name ("HTML Attribute Value")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLAttributeValue : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLAttributeValue ()
+ {
+ ForegroundColor = Colors.Blue;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Operator")]
+ [Name ("HTML Operator")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLOperator : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLOperator ()
+ {
+ ForegroundColor = Colors.Blue;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Tag Delimiter")]
+ [Name ("HTML Tag Delimiter")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLTagDelimiter : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLTagDelimiter ()
+ {
+ ForegroundColor = Colors.Blue;
+ }
+ }
+
+ private const string RazorCode = nameof (RazorCode);
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = RazorCode)]
+ [Name (RazorCode)]
+ [Order]
+ internal sealed class RazorCodeClassificationFormat : ClassificationFormatDefinition
+ {
+ public RazorCodeClassificationFormat ()
+ {
+ BackgroundColor = Color.FromRgb (0xE5, 0xE5, 0xE5);
+ }
+ }
+
+ [Export (typeof (ClassificationTypeDefinition))]
+ [Name (RazorCode), Export]
+ internal ClassificationTypeDefinition RazorCodeClassificationType { get; set; }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [ClassificationType (ClassificationTypeNames = "HTML Server-Side Script")]
+ [Name ("HTML Server-Side Script")]
+ [UserVisible (true)]
+ internal class ExportedClassificationFormatHTMLServerSideScript : ClassificationFormatDefinition
+ {
+ internal ExportedClassificationFormatHTMLServerSideScript ()
+ {
+ ForegroundColor = Colors.Black;
+ BackgroundColor = Colors.Yellow;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = FormatName)]
+ [Name (FormatName)]
+ [Order (Before = LanguagePriority.FormalLanguage)]
+ internal sealed class JsonPropertyNameClassificationFormat : ClassificationFormatDefinition
+ {
+ public const string FormatName = "JSON Property Name";
+
+ public JsonPropertyNameClassificationFormat ()
+ {
+ ForegroundColor = Color.FromRgb (0x2E, 0x75, 0xB6);
+ this.DisplayName = FormatName;
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS Comment")]
+ [Name ("CSS Comment")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class CommentClassificationFormat : ClassificationFormatDefinition
+ {
+ internal CommentClassificationFormat ()
+ {
+ ForegroundColor = Colors.DarkGreen;
+ this.DisplayName = "CSS Comment";
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS Keyword")]
+ [Name ("CSS Keyword")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class KeywordClassificationFormat : ClassificationFormatDefinition
+ {
+ public KeywordClassificationFormat ()
+ {
+ ForegroundColor = Colors.Purple;
+ this.DisplayName = "CSS Keyword";
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS Selector")]
+ [Name ("CSS Selector")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class SelectorClassificationFormat : ClassificationFormatDefinition
+ {
+ public SelectorClassificationFormat ()
+ {
+ ForegroundColor = Colors.Maroon;
+ this.DisplayName = "CSS Selector";
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS Property Name")]
+ [Name ("CSS Property Name")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class CssPropertyNameClassificationFormat : ClassificationFormatDefinition
+ {
+ public CssPropertyNameClassificationFormat ()
+ {
+ ForegroundColor = Colors.Red;
+ this.DisplayName = "CSS Property Name";
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS Property Value")]
+ [Name ("CSS Property Value")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class PropertyValueClassificationFormat : ClassificationFormatDefinition
+ {
+ public PropertyValueClassificationFormat ()
+ {
+ ForegroundColor = Colors.Blue;
+ this.DisplayName = "CSS Property Value";
+ }
+ }
+
+ [Export (typeof (EditorFormatDefinition))]
+ [UserVisible (true)]
+ [ClassificationType (ClassificationTypeNames = "CSS String Value")]
+ [Name ("CSS String Value")]
+ [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
+ internal sealed class StringValueClassificationFormat : ClassificationFormatDefinition
+ {
+ internal StringValueClassificationFormat ()
+ {
+ ForegroundColor = Colors.Blue;
+ this.DisplayName = "CSS String Value";
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs
new file mode 100644
index 0000000000..4dc1d0d31c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs
@@ -0,0 +1,62 @@
+//
+// 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 System.ComponentModel.Composition;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Language.Intellisense;
+using Microsoft.VisualStudio.Text.Formatting;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.TextEditor.Wpf
+{
+ [Export(typeof(CodeLensPresenterStyle))]
+ [Name("MonoDevelopCodeLensPresenterStyle")]
+ [Order(Before = "default")]
+ class MonoDevelopCodeLensPresenterStyle : CodeLensPresenterStyle
+ {
+ public MonoDevelopCodeLensPresenterStyle()
+ {
+ var blackBrush = new SolidColorBrush(Colors.Black);
+ var whiteBrush = new SolidColorBrush(Colors.White);
+
+ var typeface = new Typeface("Calibri");
+ var size = 8.0 * 96.0 / 72.0;
+
+ var textRunProperties = TextFormattingRunProperties.CreateTextFormattingRunProperties(
+ foreground: blackBrush,
+ background: null,
+ typeface: typeface,
+ size: size,
+ textDecorations: null,
+ textEffects: null,
+ hintingSize: null,
+ cultureInfo: null);
+
+ this.IndicatorTextRunProperties = textRunProperties;
+ this.IndicatorHoveredTextRunProperties = textRunProperties;
+ this.IndicatorDisabledTextRunProperties = textRunProperties;
+ this.IndicatorSeparatorBrush = blackBrush;
+ this.PopupBackgroundBrush = whiteBrush;
+ this.PopupTextBrush = blackBrush;
+ this.PopupBorderBrush = blackBrush;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml
new file mode 100644
index 0000000000..96d1edbb21
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml
@@ -0,0 +1,460 @@
+<UserControl x:Class="MonoDevelop.TextEditor.Wpf.Find.FindUI" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:c="clr-namespace:System.Windows.Controls;assembly=PresentationFramework" Cursor="Arrow"
+ x:Name="FindControl"
+ Background="#EEEEF2"
+ MinWidth="350"
+ Width="500"
+ KeyboardNavigation.TabNavigation="Cycle"
+ KeyboardNavigation.DirectionalNavigation="Cycle"
+ MouseDown="OnMouseDown"
+ MouseUp="OnMouseUp"
+ GotKeyboardFocus="OnGotKeyboardFocus"
+ LostKeyboardFocus="OnLostKeyboardFocus"
+ AutomationProperties.Name="FindControl"
+ AutomationProperties.AutomationId="FindControl">
+
+ <UserControl.Resources>
+ <ResourceDictionary>
+
+ <!-- Toggle button style that is used to expand/collapse to/from replace mode -->
+ <Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}">
+ <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+ <Setter Property="Control.Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ToggleButton}">
+ <Border Background="Transparent" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}">
+ <Grid SnapsToDevicePixels="False" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="19" />
+ </Grid.ColumnDefinitions>
+ <Path Data="M1,1.5L4.5,5 8,1.5" Stroke="#717171" StrokeThickness="2" Name="arrow" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="False" />
+ </Grid>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="ToggleButton.IsChecked" Value="True">
+ <Setter TargetName="arrow" Property="Path.Data">
+ <Setter.Value>
+ <StreamGeometry>M1,4.5L4.5,1 8,4.5</StreamGeometry>
+ </Setter.Value>
+ </Setter>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
+ <Setter Property="Background" Value="Transparent" />
+ <Setter Property="BorderBrush" Value="Transparent" />
+ <Setter Property="BorderThickness" Value="0" />
+ <Setter Property="MinWidth" Value="20" />
+ <Setter Property="MinHeight" Value="20" />
+ </Style>
+
+ <!-- Search Options Toggle button Style-->
+ <Style x:Key="SearchOptionToggleButtonStyle"
+ TargetType="{x:Type ToggleButton}">
+ <Setter Property="IsTabStop" Value="true"/>
+ <Setter Property="Focusable" Value="true"/>
+ <Setter Property="ClickMode" Value="Press"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ToggleButton}">
+ <Border x:Name="Border"
+ Width="20"
+ Height="20"
+ Background="Transparent"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ SnapsToDevicePixels="True">
+ <Border.Child>
+ <ContentPresenter Name="Image"
+ Margin="0"
+ Visibility="Visible"
+ RecognizesAccessKey="True" />
+ </Border.Child>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsChecked" Value="False">
+ <Setter TargetName="Border"
+ Property="BorderThickness"
+ Value="0" />
+ </Trigger>
+ <Trigger Property="IsChecked" Value="True">
+ <Setter TargetName="Border"
+ Property="BorderThickness"
+ Value="1" />
+ <Setter TargetName="Border"
+ Property="BorderBrush"
+ Value="#3399FF" />
+ <Setter TargetName="Border" Property="Background" Value="#EEEEF2" />
+ </Trigger>
+ <Trigger Property="IsPressed" Value="True">
+ <Setter TargetName="Border"
+ Property="BorderThickness"
+ Value="1" />
+ <Setter TargetName="Border"
+ Property="BorderBrush"
+ Value="#007ACC" />
+ </Trigger>
+ <Trigger Property="IsMouseOver" Value="true">
+ <Setter TargetName="Border" Property="BorderThickness" Value="1" />
+ <Setter TargetName="Border" Property="BorderBrush" Value="#3399FF" />
+ <Setter TargetName="Border" Property="Background" Value="#C9DEF5" />
+ </Trigger>
+ <Trigger Property="IsEnabled" Value="false">
+ <Setter TargetName="Border" Property="Background" Value="#EEEEF2" />
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <Path x:Key="ArrowPath" Fill="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource Self}}" Data="M 0 4 L 7 4 L 3.5 0 Z" />
+
+ <Path x:Key="DownArrowPath" Fill="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource Self}}"
+ Width="8"
+ Height="4"
+ Data="F1 M 0,0L 4,4L 8,0L 0,0 Z"
+ SnapsToDevicePixels="True"/>
+
+ <Path x:Key="XShapePath"
+ Width="10"
+ Height="8"
+ Fill="{Binding Path=(TextElement.Foreground), RelativeSource={RelativeSource Self}}"
+ Stretch="Uniform"
+ Data="F1 M 0,0L 2,0L 5,3L 8,0L 10,0L 6,4L 10,8L 8,8L 5,5L 2,8L 0,8L 4,4L 0,0 Z" />
+
+ </ResourceDictionary>
+ </UserControl.Resources>
+
+ <UserControl.Content>
+ <Grid Margin="0,3,0,0">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="8px"/>
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition />
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <Grid.Children>
+
+ <ToggleButton Name="FindReplaceToggleButton"
+ KeyboardNavigation.TabNavigation="Once"
+ VerticalAlignment="Center"
+ Padding="0"
+ Margin="12,0,4,0"
+ HorizontalAlignment="Center"
+ HorizontalContentAlignment="Center"
+ KeyboardNavigation.TabIndex="9"
+ VerticalContentAlignment="Center"
+ Background="Transparent"
+ ToolTip="Toggle to switch between find and replace modes"
+ Style="{StaticResource ResourceKey=ToggleButtonStyle}"
+ Width="21"
+ Height="21"
+ AutomationProperties.AutomationId="FindReplaceToggleButton"
+ AutomationProperties.Name="FindReplaceToggleButton"/>
+
+ <ResizeGrip Grid.RowSpan="3"
+ Name="Resizer"
+ VerticalAlignment="Bottom"
+ HorizontalAlignment="Left"
+ Cursor="SizeWE"
+ MouseLeftButtonDown="OnResizerMouseLeftButtonDown"
+ MouseLeftButtonUp="OnResizerMouseLeftButtonUp"
+ MouseMove="OnResizerMouseMove"
+ Width="7"
+ Height="7"
+ IsTabStop="False"
+ AutomationProperties.AutomationId="Resizer" AutomationProperties.Name="Resizer">
+ <ResizeGrip.Template>
+ <ControlTemplate TargetType="{x:Type ResizeGrip}">
+ <Grid Background="Transparent" Margin="2,2,2,6" VerticalAlignment="{TemplateBinding VerticalAlignment}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}">
+ <Path Fill="#717171" Data="F1 M 0,1 L 0,0 L 1,0 L 1,1 L 0,1 Z"/>
+ <Path Fill="#717171" Data="F1 M 3,4 L 3,3 L 4,3 L 4,4 L 3,4 Z"/>
+ <Path Fill="#717171" Data="F1 M 0,4 L 0,3 L 1,3 L 1,4 L 0,4 Z"/>
+ <Path Fill="#717171" Data="F1 M 3,7 L 3,6 L 4,6 L 4,7 L 3,7 Z"/>
+ <Path Fill="#717171" Data="F1 M 0,7 L 0,6 L 1,6 L 1,7 L 0,7 Z"/>
+ <Path Fill="#717171" Data="F1 M 6,7 L 6,6 L 7,6 L 7,7 L 6,7 Z"/>
+ </Grid>
+ </ControlTemplate>
+ </ResizeGrip.Template>
+ </ResizeGrip>
+
+ <Border Grid.Column="1"
+ Name="FindControlGroup"
+ HorizontalAlignment="Stretch">
+ <Border Name="InvalidSearchBorder"
+ BorderThickness="1"
+ BorderBrush="Transparent">
+ <TextBox x:Name="SearchControl"
+ Padding="3"
+ FontSize="12"
+ MinHeight="23"
+ HorizontalContentAlignment="Stretch"
+ KeyboardNavigation.TabIndex="0"
+ AutomationProperties.Name="SearchControl"
+ AutomationProperties.AutomationId="SearchControl"/>
+ </Border>
+ </Border>
+
+ <Border Grid.Column="1"
+ Grid.Row="1"
+ Name="ReplaceControlGroup"
+ Padding="1,3,1,0"
+ HorizontalAlignment="Stretch"
+ BorderThickness="0">
+ <TextBox x:Name="ReplaceControl"
+ MinHeight="23"
+ Padding="3"
+ FontSize="12"
+ KeyboardNavigation.TabIndex="1"
+ HorizontalAlignment="Stretch"
+ HorizontalContentAlignment="Stretch"
+ AutomationProperties.Name="ReplaceControl"
+ AutomationProperties.AutomationId="ReplaceControl"/>
+ </Border>
+
+ <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center">
+ <ToggleButton x:Name="MatchCaseToggleButton"
+ Margin="2,0,2,0"
+ Style="{StaticResource SearchOptionToggleButtonStyle}"
+ ToolTip="Match case (Alt+C)"
+ KeyboardNavigation.TabIndex="5"
+ KeyboardNavigation.TabNavigation="Local"
+ AutomationProperties.Name="MatchCaseToggleButton"
+ AutomationProperties.AutomationId="MatchCaseToggleButton">
+ <ToggleButton.Content>
+ <Image Margin="0" Stretch="None" Width="17" Height="17">
+ <Image.Source>
+ <DrawingImage>
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="Transparent" Geometry="F1 M 15.80,5.97 C 15.66,5.55 15.44,5.19 15.15,4.88 C 14.85,4.58 14.48,4.35 14.05,4.20 C 13.66,4.07 13.20,4.00 12.69,4.00 C 12.44,4.00 12.18,4.02 11.91,4.06 C 11.67,4.10 11.43,4.15 11.21,4.20 C 10.98,4.26 10.77,4.33 10.57,4.40 C 10.35,4.49 10.17,4.58 10.04,4.66 L 9.58,4.95 L 9.58,7.53 C 9.40,7.75 9.26,8.01 9.16,8.29 C 9.16,8.29 9.16,8.30 9.15,8.31 L 6.38,0.00 L 3.61,0.00 L 0.00,10.83 L 0.00,12.00 L 3.22,12.00 L 3.88,10.00 L 6.11,10.00 L 6.77,12.00 L 10.38,12.00 L 10.24,11.58 C 10.40,11.67 10.57,11.75 10.75,11.81 C 11.09,11.93 11.47,12.00 11.89,12.00 C 12.16,12.00 12.42,11.97 12.67,11.91 L 12.67,12.00 L 16.00,12.00 L 16.00,7.23 C 16.00,6.76 15.93,6.34 15.80,5.97 Z"/>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 3.66,7.50 L 5.00,3.50 L 6.33,7.50 L 3.66,7.50 Z M 4.33,1.00 L 1.00,11.00 L 2.50,11.00 L 3.16,9.00 L 6.83,9.00 L 7.50,11.00 L 9.00,11.00 L 5.66,1.00 L 4.33,1.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 13.68,8.59 C 13.68,8.78 13.65,8.96 13.58,9.13 C 13.52,9.30 13.42,9.44 13.30,9.57 C 13.18,9.69 13.04,9.79 12.87,9.86 C 12.70,9.94 12.51,9.97 12.30,9.97 C 12.15,9.97 12.02,9.95 11.89,9.91 C 11.77,9.87 11.67,9.81 11.58,9.74 C 11.50,9.67 11.43,9.59 11.39,9.49 C 11.34,9.39 11.32,9.28 11.32,9.16 C 11.32,9.03 11.33,8.92 11.36,8.82 C 11.39,8.72 11.45,8.63 11.53,8.55 C 11.61,8.47 11.72,8.41 11.85,8.35 C 12.00,8.30 12.18,8.26 12.40,8.24 L 13.68,8.07 L 13.68,8.59 Z M 14.85,6.29 C 14.76,6.01 14.62,5.78 14.43,5.59 C 14.25,5.39 14.01,5.25 13.72,5.15 C 13.43,5.05 13.09,5.00 12.69,5.00 C 12.49,5.00 12.28,5.01 12.07,5.05 C 11.86,5.08 11.65,5.12 11.46,5.17 C 11.27,5.22 11.09,5.28 10.94,5.34 C 10.78,5.40 10.66,5.45 10.58,5.50 L 10.58,6.64 C 10.85,6.45 11.15,6.30 11.50,6.18 C 11.84,6.06 12.19,6.01 12.55,6.01 C 12.91,6.01 13.19,6.10 13.39,6.28 C 13.58,6.47 13.68,6.77 13.68,7.17 L 11.94,7.40 C 11.60,7.44 11.30,7.52 11.06,7.63 C 10.81,7.74 10.61,7.88 10.45,8.04 C 10.29,8.21 10.18,8.40 10.10,8.61 C 10.03,8.82 10.00,9.05 10.00,9.30 C 10.00,9.55 10.04,9.78 10.12,9.98 C 10.20,10.19 10.33,10.37 10.48,10.52 C 10.64,10.67 10.84,10.79 11.08,10.87 C 11.31,10.95 11.58,11.00 11.89,11.00 C 12.27,11.00 12.61,10.92 12.91,10.76 C 13.20,10.60 13.45,10.37 13.65,10.07 L 13.67,10.07 L 13.67,11.00 L 15.00,11.00 L 15.00,7.23 C 15.00,6.88 14.95,6.56 14.85,6.29 Z"/>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
+ </Image.Source>
+ </Image>
+ </ToggleButton.Content>
+ </ToggleButton>
+ <ToggleButton x:Name="MatchWholeWordToggleButton"
+ Margin="2,0,2,0"
+ Style="{StaticResource ResourceKey=SearchOptionToggleButtonStyle}"
+ ToolTip="Match whole word (Alt+W)"
+ KeyboardNavigation.TabIndex="6"
+ KeyboardNavigation.TabNavigation="Local"
+ AutomationProperties.Name="MatchWholeWordToggleButton"
+ AutomationProperties.AutomationId="MatchWholeWordToggleButton">
+ <ToggleButton.Content>
+ <Image Margin="0" Stretch="None" Width="17" Height="17">
+ <Image.Source>
+ <DrawingImage>
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="Transparent" Geometry="F1 M 12.03,5.00 L 10.00,5.00 L 10.00,3.00 L 12.04,3.00 L 12.03,5.00 Z M 7.00,6.83 L 5.72,3.00 L 7.00,3.00 L 7.00,6.83 Z M 3.05,10.00 L 3.38,9.00 L 4.61,9.00 L 4.94,10.00 L 3.05,10.00 Z M 15.00,0.01 L 0.00,0.00 L 0.00,3.00 L 2.28,3.00 L 0.00,9.83 L 0.00,11.00 L 0.00,12.00 L 0.00,13.00 L 15.00,12.98 L 15.00,0.01 Z"/>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 11.00,7.00 L 11.00,9.00 L 9.00,9.00 L 9.00,7.00 L 11.00,7.00 Z M 8.00,3.00 L 8.00,10.00 L 12.00,10.00 L 12.00,6.00 L 9.00,6.00 L 9.00,3.00 L 8.00,3.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 13.00,10.00 L 14.00,10.00 L 14.00,3.00 L 13.04,3.00 L 13.00,10.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 4.00,4.00 L 5.00,7.00 L 3.00,7.00 L 4.00,4.00 Z M 5.33,8.00 L 6.00,10.00 L 7.00,10.00 L 4.66,3.00 L 3.33,3.00 L 1.00,10.00 L 2.00,10.00 L 2.66,8.00 L 5.33,8.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 1.00,1.00 L 1.00,2.00 L 14.00,2.00 L 14.00,1.00 L 1.00,1.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 1.00,12.00 L 14.00,12.00 L 14.00,11.00 L 1.00,11.00 L 1.00,12.00 Z"/>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
+ </Image.Source>
+ </Image>
+ </ToggleButton.Content>
+ </ToggleButton>
+ <ToggleButton x:Name="RegularExpressionToggleButton"
+ Margin="2,0,2,0"
+ Style="{StaticResource ResourceKey=SearchOptionToggleButtonStyle}"
+ ToolTip="Use Regular Expressions"
+ KeyboardNavigation.TabIndex="7"
+ KeyboardNavigation.TabNavigation="Local"
+ AutomationProperties.Name="RegularExpressionToggleButton"
+ AutomationProperties.AutomationId="RegularExpressionToggleButton">
+ <ToggleButton.Content>
+ <Image Margin="0" Stretch="None" Width="17" Height="17">
+ <Image.Source>
+ <DrawingImage>
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="Transparent" Geometry="F1 M 14.34,5.70 L 12.94,1.79 L 10.81,2.68 L 11.09,0.00 L 6.90,0.00 L 7.18,2.68 L 5.05,1.79 L 3.65,5.70 L 6.06,6.11 L 5.33,6.99 L 0.00,6.99 L 0.00,12.99 L 6.00,12.99 L 6.00,9.22 L 7.78,10.45 L 9.00,8.22 L 10.24,10.45 L 13.58,8.11 L 11.95,6.11 L 14.34,5.70 Z"/>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 13.00,4.91 L 12.35,3.11 L 9.64,4.25 L 9.98,1.00 L 8.01,1.00 L 8.35,4.25 L 5.64,3.11 L 5.00,4.91 L 7.93,5.41 L 5.86,7.91 L 7.44,9.00 L 8.99,6.16 L 10.58,9.00 L 12.13,7.91 L 10.09,5.41 L 13.00,4.91 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 1.00,11.99 L 5.00,11.99 L 5.00,7.99 L 1.00,7.99 L 1.00,11.99 Z"/>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
+ </Image.Source>
+ </Image>
+ </ToggleButton.Content>
+ </ToggleButton>
+
+ <TextBlock x:Name="ResultIndexAndCount"
+ MinWidth="60"
+ FontSize="12"
+ VerticalAlignment="Center"
+ Margin="8,0,8,0" />
+
+ <Button x:Name="FindPreviousButton"
+ Margin="4,0,2,0"
+ ToolTip="Find Previous (Shift+F3)"
+ Click="OnFindPreviousClick"
+ Style="{StaticResource ButtonStyle}">
+ <Path Data="M5,1 L1,5 L5,9" Stroke="#717171" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
+ </Button>
+ <Button x:Name="FindNextButton"
+ Margin="4,0,2,0"
+ ToolTip="Find Next (F3)"
+ Click="OnFindNextClick"
+ Style="{StaticResource ButtonStyle}">
+ <Path Data="M3,1 L7,5 L3,9" Stroke="#717171" StrokeThickness="2" HorizontalAlignment="Center" VerticalAlignment="Center" />
+ </Button>
+
+ <Button Name="CloseButton"
+ Style="{StaticResource ButtonStyle}"
+ Margin="12,0,0,0"
+ Padding="2"
+ Click="OnHide"
+ Content="{StaticResource ResourceKey=XShapePath}"
+ KeyboardNavigation.TabIndex="10"
+ ToolTip="Close"
+ TextElement.Foreground="#717171"
+ AutomationProperties.Name="CloseButton"
+ AutomationProperties.AutomationId="CloseButton">
+ </Button>
+
+ </StackPanel>
+
+ <StackPanel Name="ReplaceButtons"
+ Orientation="Horizontal"
+ HorizontalAlignment="Left"
+ VerticalAlignment="Center"
+ Grid.Column="2"
+ Grid.Row="1">
+ <Button Name="ReplaceNextButton"
+ Click="OnReplaceNext"
+ Margin="2,0,2,0"
+ Style="{StaticResource ButtonStyle}"
+ ToolTip="Replace next (Alt+R)"
+ KeyboardNavigation.TabIndex="3"
+ AutomationProperties.Name="ReplaceNextButton"
+ AutomationProperties.AutomationId="ReplaceNextButton">
+ <Button.Content>
+ <Image Margin="0"
+ Stretch="None"
+ AutomationProperties.Name="ReplaceNextImage"
+ AutomationProperties.AutomationId="ReplaceNextImage"
+ Width="17"
+ Height="17">
+ <Image.Source>
+ <DrawingImage>
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <GeometryDrawing Brush="Transparent"
+ Geometry="F1 M 6.00,5.00 L 6.00,4.00 L 8.00,4.00 L 8.00,8.00 L 4.91,8.00 L 6.00,6.91 L 6.00,5.00 M 11.00,2.00 L 11.00,0.00 L 8.00,0.00 L 8.00,1.00 L 4.47,1.00 C 3.10,1.00 1.97,2.12 1.97,3.50 L 1.97,3.56 L 1.00,2.58 L 1.00,6.91 L 2.08,8.00 L 0.00,8.00 L 0.00,16.00 L 9.00,16.00 L 9.00,8.00 L 14.00,8.00 L 14.00,2.00 L 11.00,2.00 Z"/>
+ <GeometryDrawing Brush="#424242"
+ Geometry="F1 M 12.00,6.00 L 10.00,6.00 L 10.00,4.00 L 12.00,4.00 L 12.00,6.00 Z M 10.00,3.00 L 10.00,1.00 L 9.00,1.00 L 9.00,6.00 L 9.00,7.00 L 10.00,7.00 L 12.00,7.00 L 13.00,7.00 L 13.00,4.00 L 13.00,3.00 L 10.00,3.00 Z"/>
+ <GeometryDrawing Brush="#424242"
+ Geometry="F1 M 3.00,10.00 L 6.00,10.00 L 6.00,11.00 L 4.00,11.00 L 4.00,13.00 L 6.00,13.00 L 6.00,14.00 L 3.00,14.00 L 3.00,10.00 Z M 1.00,15.00 L 8.00,15.00 L 8.00,9.00 L 1.00,9.00 L 1.00,15.00 Z"/>
+ <GeometryDrawing Brush="#424242"
+ Geometry="F1 M 2.97,3.50 L 3.00,6.00 L 2.00,5.00 L 2.00,6.50 L 3.50,8.00 L 5.00,6.50 L 5.00,5.00 L 4.00,6.00 L 3.97,3.50 C 3.97,3.22 4.20,3.00 4.47,3.00 L 8.00,3.00 L 8.00,2.00 L 4.47,2.00 C 3.65,2.00 2.97,2.67 2.97,3.50 Z"/>
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
+ </Image.Source>
+ </Image>
+ </Button.Content>
+ </Button>
+ <Button Name="ReplaceAllButton"
+ Click="OnReplaceAll"
+ Margin="2,0,2,0"
+ Style="{StaticResource ButtonStyle}"
+ ToolTip="Replace all (Alt+A)"
+ KeyboardNavigation.TabIndex="4"
+ AutomationProperties.Name="ReplaceAllButton"
+ AutomationProperties.AutomationId="ReplaceAllButton">
+ <Button.Content>
+ <Image Margin="0"
+ Stretch="None"
+ AutomationProperties.Name="ReplaceAllImage"
+ AutomationProperties.AutomationId="ReplaceAllImage"
+ Width="17"
+ Height="17">
+ <Image.Source>
+ <DrawingImage>
+ <DrawingImage.Drawing>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="Transparent" Geometry="F1 M 6.97,4.00 L 6.97,6.00 L 5.00,6.00 L 5.00,4.00 L 6.97,4.00 Z M 15.97,1.00 L 13.97,1.00 L 13.97,0.00 L 10.97,0.00 L 10.97,1.00 L 8.00,1.00 L 6.97,1.00 L 3.50,1.00 C 2.12,1.00 1.00,2.12 1.00,3.50 L 1.00,3.58 L 0.00,2.58 L 0.00,6.91 L 1.08,8.00 L 0.00,8.00 L 0.00,16.00 L 12.00,16.00 L 12.00,14.00 L 13.97,14.00 L 13.97,7.00 L 15.97,7.00 L 15.97,1.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 13.97,5.00 L 12.97,5.00 L 12.97,3.00 L 13.97,3.00 L 13.97,5.00 Z M 12.97,2.00 L 12.97,1.00 L 11.97,1.00 L 11.97,6.00 L 14.97,6.00 L 14.97,2.00 L 12.97,2.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 10.97,2.00 L 7.97,2.00 L 7.97,3.00 L 8.97,3.00 L 8.97,4.00 L 9.97,4.00 L 9.97,5.00 L 8.97,5.00 L 8.97,4.00 L 7.97,4.00 L 7.97,6.00 L 10.97,6.00 L 10.97,2.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 4.97,8.00 L 11.97,8.00 L 11.97,13.00 L 12.97,13.00 L 12.97,8.00 L 12.97,7.00 L 4.97,7.00 L 4.97,8.00 Z"/>
+ <DrawingGroup>
+ <DrawingGroup.Children>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 3.97,13.00 L 3.97,12.00 L 2.97,12.00 L 2.97,13.00 L 3.97,13.00 Z"/>
+ <GeometryDrawing Brush="#424242" Geometry="F1 M 9.97,11.00 L 7.97,11.00 L 7.97,13.00 L 9.97,13.00 L 9.97,14.00 L 6.97,14.00 L 6.97,10.00 L 9.97,10.00 L 9.97,11.00 Z M 4.97,14.00 L 1.97,14.00 L 1.97,12.00 L 2.97,12.00 L 2.97,11.00 L 1.97,11.00 L 1.97,10.00 L 4.97,10.00 L 4.97,14.00 Z M 1.00,9.00 L 1.00,15.00 L 11.00,15.00 L 11.00,9.00 L 1.00,9.00 Z"/>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ <GeometryDrawing Brush="#00529B" Geometry="F1 M 4.00,6.50 L 4.00,5.00 L 3.00,6.00 L 3.00,3.50 C 3.00,3.22 3.22,3.00 3.50,3.00 L 7.00,3.00 L 7.00,2.00 L 3.50,2.00 C 2.67,2.00 2.00,2.67 2.00,3.50 L 2.00,6.00 L 1.00,5.00 L 1.00,6.50 L 2.50,8.00 L 4.00,6.50 Z"/>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingGroup.Children>
+ </DrawingGroup>
+ </DrawingImage.Drawing>
+ </DrawingImage>
+ </Image.Source>
+ </Image>
+ </Button.Content>
+ </Button>
+ </StackPanel>
+
+ <Rectangle Margin="0,4,0,0" Grid.ColumnSpan="3" Grid.Row="2" Name="Find_Focus_Border">
+ <Rectangle.Style>
+ <Style TargetType="{x:Type Rectangle}">
+ <Style.Setters>
+ <Setter Property="Fill" Value="#007ACC"/>
+ </Style.Setters>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Path=IsKeyboardFocusWithin, ElementName=FindControl}" Value="False">
+ <Setter Property="Fill" Value="#CCCEDB"/>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Rectangle.Style>
+ </Rectangle>
+ </Grid.Children>
+ </Grid>
+ </UserControl.Content>
+
+</UserControl>
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs
new file mode 100644
index 0000000000..a3b4988a0c
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs
@@ -0,0 +1,363 @@
+//
+// 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 System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Threading;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Operations;
+
+namespace MonoDevelop.TextEditor.Wpf.Find
+{
+ public partial class FindUI : UserControl
+ {
+ private IWpfTextView currentTextView; // The text view on which the UI is being displayed at any given time
+
+ /// <summary>
+ /// Used for resizing of the control
+ /// </summary>
+ double _resizingBaselineWidth;
+ double _resizingBaselinePoint;
+
+ public event Action<string> SearchTextChanged;
+ public event Action<string> ReplaceTextChanged;
+ public event Action<FindOptions> FindOptionsChanged;
+ public event Action FindPrevious;
+ public event Action FindNext;
+ public event Action Replace;
+ public event Action ReplaceAll;
+ public event Action CloseRequested;
+
+ public const string FindUIAdornmentLayer = nameof (FindUIAdornmentLayer);
+
+ public FindUI ()
+ {
+ InitializeComponent ();
+
+ Visibility = Visibility.Collapsed;
+
+ SearchControl.TextChanged += OnSearchTextChanged;
+ ReplaceControl.TextChanged += OnReplaceTextChanged;
+
+ FindReplaceToggleButton.Checked += (s, e) => IsInReplaceMode = true;
+ FindReplaceToggleButton.Unchecked += (s, e) => IsInReplaceMode = false;
+ MatchCaseToggleButton.Checked += RaiseFindOptionsChanged;
+ MatchCaseToggleButton.Unchecked += RaiseFindOptionsChanged;
+ MatchWholeWordToggleButton.Checked += RaiseFindOptionsChanged;
+ MatchWholeWordToggleButton.Unchecked += RaiseFindOptionsChanged;
+ RegularExpressionToggleButton.Checked += RaiseFindOptionsChanged;
+ RegularExpressionToggleButton.Unchecked += RaiseFindOptionsChanged;
+
+ UpdateReplaceVisibility (false);
+ }
+
+ public void ShowAdornment (IWpfTextView view)
+ {
+ IAdornmentLayer adornmentLayer = view.GetAdornmentLayer (FindUIAdornmentLayer);
+
+ // Make sure anti-aliasing doesn't cause trouble
+ ((UIElement)adornmentLayer).SnapsToDevicePixels = true;
+
+ currentTextView = view;
+
+ if (adornmentLayer.Elements.Count == 0) {
+ adornmentLayer.AddAdornment (AdornmentPositioningBehavior.OwnerControlled, null, this, this, null);
+ }
+
+ Position ();
+
+ Visibility = Visibility.Visible;
+
+ view.VisualElement.SizeChanged += OnViewSizeChanged;
+ view.Closed += OnViewClosed;
+
+ FocusFindBox ();
+ }
+
+ public void HideAdornment ()
+ {
+ IWpfTextView textView = currentTextView;
+
+ // Send the focus back to the editor.
+ if (textView != null && !textView.IsClosed) {
+ textView.VisualElement.Focus ();
+ }
+
+ // Hide the adornment (Note that this calls DetachFromView on us)
+ // This has to be done after the focus transfer because the FindAdornmentManager
+ // needs to respond to the focus transfer before it disconnects itself from the view.
+ Visibility = Visibility.Collapsed;
+
+ if (textView != null) {
+ if (this.IsKeyboardFocusWithin) {
+ // This method will remove the Find UI adornment from the visual tree but that on its own
+ // won't move the focus from the Find UI. WPF would later get around to restoring a valid focus.
+ // There is a problematic case when the adornment is being hidden while doing a FindNext to
+ // a document in a different top-level floating window frame because when we do try to focus
+ // the other top-level window frame, WPF will detect that focus is still "disconnected"
+ // and will restore focus to this editor instead of moving it as we request.
+ // By manually moving focus here, it will not get into this "disconnected" state.
+ textView.VisualElement.Focus ();
+ }
+
+ currentTextView = null;
+
+ textView.GetAdornmentLayer (FindUIAdornmentLayer).RemoveAllAdornments ();
+ textView.VisualElement.SizeChanged -= OnViewSizeChanged;
+ textView.Closed -= OnViewClosed;
+ textView = null;
+ }
+ }
+
+ private void RaiseFindOptionsChanged (object sender, EventArgs args)
+ {
+ FindOptionsChanged?.Invoke (FindOptions);
+ }
+
+ public FindOptions FindOptions {
+ get {
+ var options = FindOptions.None;
+ if (MatchCaseToggleButton.IsChecked == true) {
+ options |= FindOptions.MatchCase;
+ }
+
+ if (MatchWholeWordToggleButton.IsChecked == true) {
+ options |= FindOptions.WholeWord;
+ }
+
+ if (RegularExpressionToggleButton.IsChecked == true) {
+ options |= FindOptions.UseRegularExpressions;
+ }
+
+ return options;
+ }
+ set {
+ MatchCaseToggleButton.IsChecked = (value & FindOptions.MatchCase) != 0;
+ MatchWholeWordToggleButton.IsChecked = (value & FindOptions.WholeWord) != 0;
+ RegularExpressionToggleButton.IsChecked = (value & FindOptions.UseRegularExpressions) != 0;
+ }
+ }
+
+ private bool isInReplaceMode;
+ public bool IsInReplaceMode {
+ get => isInReplaceMode;
+ set {
+ if (isInReplaceMode == value) {
+ return;
+ }
+
+ isInReplaceMode = value;
+ FindReplaceToggleButton.IsChecked = value;
+ UpdateReplaceVisibility (value);
+ }
+ }
+
+ private void UpdateReplaceVisibility (bool value)
+ {
+ var visibility = value ? Visibility.Visible : Visibility.Collapsed;
+ ReplaceControlGroup.Visibility = visibility;
+ ReplaceButtons.Visibility = visibility;
+ }
+
+ private void OnSearchTextChanged (object sender, TextChangedEventArgs e)
+ {
+ SearchTextChanged?.Invoke (SearchControl.Text);
+ }
+
+ private void OnReplaceTextChanged (object sender, TextChangedEventArgs e)
+ {
+ ReplaceTextChanged?.Invoke (ReplaceControl.Text);
+ }
+
+ private void OnFindPreviousClick (object sender, RoutedEventArgs args)
+ {
+ FindPrevious?.Invoke ();
+ }
+
+ private void OnFindNextClick (object sender, RoutedEventArgs args)
+ {
+ FindNext?.Invoke ();
+ }
+
+ private void OnReplaceNext (object sender, RoutedEventArgs e)
+ {
+ Replace?.Invoke ();
+ e.Handled = true;
+ }
+
+ private void OnReplaceAll (object sender, RoutedEventArgs e)
+ {
+ ReplaceAll?.Invoke ();
+ e.Handled = true;
+ }
+
+ private void OnMouseDown (object sender, MouseButtonEventArgs e)
+ {
+ // We don't want to allow the mouse click to go through to the editor.
+ e.Handled = true;
+ }
+
+ private void OnMouseUp (object sender, MouseButtonEventArgs e)
+ {
+ // We don't want to allow the mouse click to go through to the editor.
+ e.Handled = true;
+ }
+
+ private void OnGotKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
+ {
+ // Don't let the GotKeyboardFocus event propagate to the parent. The text view, upon receipt of this event,
+ // does some processing (among which is IME) and causes issues.
+ e.Handled = true;
+ }
+
+ private void OnLostKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
+ {
+ // Don't let the LostKeyboardFocus event propagate to the parent. The text view, upon receipt of this event,
+ // does some processing (among which is IME) and causes issues.
+ e.Handled = true;
+ }
+
+ private void OnResizerMouseLeftButtonDown (object sender, MouseButtonEventArgs e)
+ {
+ if (!this.Resizer.IsMouseCaptured) {
+ _resizingBaselinePoint = this.PointToScreen (e.GetPosition (this)).X;
+ _resizingBaselineWidth = this.ActualWidth;
+
+ // While in the CaptureMouse call we can reentrantly get the MouseMove event so we
+ // have to have initialized the point and width fields above before the call.
+ if (!this.Resizer.CaptureMouse ()) {
+ _resizingBaselinePoint = .0;
+ _resizingBaselineWidth = .0;
+ }
+
+ e.Handled = true;
+ }
+ }
+
+ private void OnResizerMouseLeftButtonUp (object sender, MouseButtonEventArgs e)
+ {
+ if (this.Resizer.IsMouseCaptured) {
+ this.Resizer.ReleaseMouseCapture ();
+ _resizingBaselinePoint = .0;
+ _resizingBaselineWidth = .0;
+ e.Handled = true;
+ }
+ }
+
+ private void OnResizerMouseMove (object sender, MouseEventArgs e)
+ {
+ if (this.Resizer.IsMouseCaptured && e.LeftButton == MouseButtonState.Pressed) {
+ Point mouseLocation = e.GetPosition (this);
+ Point anchorPoint = this.PointFromScreen (new Point (_resizingBaselinePoint, .0));
+ double delta = anchorPoint.X > mouseLocation.X ? anchorPoint.X - mouseLocation.X : -(mouseLocation.X - anchorPoint.X);
+ this.Width = Math.Min (Math.Max (this.MinWidth, _resizingBaselineWidth + delta), this.MaxWidth);
+
+ Canvas.SetTop (this, 0.0);
+ Canvas.SetLeft (this, currentTextView.ViewportWidth - this.Width);
+
+ e.Handled = true;
+ }
+ }
+
+ private void OnHide (object sender, RoutedEventArgs e)
+ {
+ CloseRequested?.Invoke ();
+ e.Handled = true;
+ }
+
+ private void OnViewClosed (object sender, EventArgs args)
+ {
+ this.HideAdornment ();
+ }
+
+ private void OnViewSizeChanged (object sender, SizeChangedEventArgs e)
+ {
+ if (e.WidthChanged) {
+ Position ();
+ }
+ }
+
+ public void Position ()
+ {
+ if (currentTextView != null) {
+ this.MaxWidth = currentTextView.ViewportWidth;
+ this.Width = Math.Min (Math.Max (this.Width, this.MinWidth), this.MaxWidth);
+
+ Canvas.SetTop (this, 0.0);
+ Canvas.SetLeft (this, currentTextView.ViewportWidth - this.Width);
+ }
+ }
+
+ protected override void OnPreviewKeyDown (KeyEventArgs e)
+ {
+ if (e == null || e.Handled) {
+ return;
+ }
+
+ // We handle the Escape key on preview so that we have the chance of handling it before any of the controls inside
+ // the find adornment since we want to always dismiss the UI when escape is pressed irrespective of the state of
+ // the child controls.
+ base.OnPreviewKeyDown (e);
+
+ if (e.Handled) {
+ return;
+ }
+
+ if (e.Key == Key.Escape) {
+ // If the search or replace controls have their pop up open, we want to let Escape take its normal
+ // route so that it dismisses the popups. Also check whether a dropdown button has its context menu open.
+ if (!InputManager.Current.IsInMenuMode) {
+ CloseRequested?.Invoke ();
+ e.Handled = true;
+ }
+ } else if (e.Key == Key.F3) {
+ if (e.KeyboardDevice.Modifiers == ModifierKeys.None) {
+ FindNext?.Invoke ();
+ e.Handled = true;
+ } else if (e.KeyboardDevice.Modifiers == ModifierKeys.Shift) {
+ FindPrevious?.Invoke ();
+ e.Handled = true;
+ }
+ } else if (e.Key == Key.A && e.KeyboardDevice.Modifiers == ModifierKeys.Alt) {
+ ReplaceAll?.Invoke ();
+ e.Handled = true;
+ } else if (e.Key == Key.R && e.KeyboardDevice.Modifiers == ModifierKeys.Alt) {
+ Replace?.Invoke ();
+ e.Handled = true;
+ }
+ }
+
+ private void OnIsVisibleChanged (object sender, DependencyPropertyChangedEventArgs e)
+ {
+ if ((bool)e.NewValue) {
+ this.Position ();
+ }
+ }
+
+ public void FocusFindBox ()
+ {
+ Dispatcher.BeginInvoke (new Action (() => this.SearchControl.Focus ()), DispatcherPriority.Input);
+ }
+ }
+}
+
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs
new file mode 100644
index 0000000000..ce8ec3dfe4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs
@@ -0,0 +1,172 @@
+//
+// 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 System;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Text.Find;
+using Microsoft.VisualStudio.Text.Find.Implementation;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+
+namespace MonoDevelop.TextEditor.Wpf.Find
+{
+ class WpfFindPresenter : IFindPresenter
+ {
+ readonly WpfFindPresenterFactory factory;
+ readonly ITextView textView;
+ readonly FindUI findUI;
+ readonly IEditorCommandHandlerService commandHandlerService;
+ FindController controller;
+
+ static Action Noop { get; } = () => { };
+ FindBroker Broker => factory.FindBroker;
+
+ public WpfFindPresenter (WpfFindPresenterFactory factory, ITextView textView)
+ {
+ this.factory = factory;
+ this.textView = textView;
+ this.findUI = new FindUI ();
+ this.commandHandlerService = factory.EditorCommandHandlerServiceFactory.GetService (textView);
+
+ SubscribeToUIEvents ();
+ }
+
+ /// <summary>
+ /// Controller is lazy to avoid a MEF loop
+ /// </summary>
+ FindController Controller {
+ get {
+ if (controller == null) {
+ controller = Broker.GetFindController (textView);
+ SubscribeToControllerEvents ();
+ }
+
+ return controller;
+ }
+ }
+
+ public bool IsVisible => findUI.IsVisible;
+
+ public bool IsFocused => findUI.IsKeyboardFocusWithin;
+
+ public void ShowFind ()
+ {
+ findUI.ShowAdornment ((IWpfTextView)textView);
+ findUI.IsInReplaceMode = false;
+ Controller.UpdateSearchTextFromCurrentWord ();
+ }
+
+ public void ShowReplace ()
+ {
+ findUI.ShowAdornment ((IWpfTextView)textView);
+ findUI.IsInReplaceMode = true;
+ Controller.UpdateSearchTextFromCurrentWord ();
+ }
+
+ public void Hide ()
+ {
+ findUI.HideAdornment ();
+ Controller.ClearTags ();
+ }
+
+ void SubscribeToUIEvents ()
+ {
+ findUI.CloseRequested += Hide;
+ findUI.SearchTextChanged += OnSearchTextChangedInUI;
+ findUI.ReplaceTextChanged += OnReplaceTextChangedInUI;
+ findUI.FindOptionsChanged += OnFindOptionsChangedInUI;
+ findUI.FindPrevious += OnFindPreviousClicked;
+ findUI.FindNext += OnFindNextClicked;
+ findUI.Replace += OnReplaceClicked;
+ findUI.ReplaceAll += OnReplaceAllClicked;
+ }
+
+ void SubscribeToControllerEvents ()
+ {
+ controller.ResultsAvailable += OnResultsAvailable;
+ controller.FindOptionsChanged += OnFindOptionsChanged;
+ controller.SearchTextChanged += OnSearchTextChanged;
+ }
+
+ void OnSearchTextChanged ()
+ {
+ if (findUI.SearchControl.Text != controller.SearchText) {
+ findUI.SearchControl.Text = controller.SearchText;
+ findUI.SearchControl.SelectAll ();
+ }
+ }
+
+ void OnResultsAvailable ((int index, int count) args)
+ {
+ string summaryText = null;
+ if (args.count == 0) {
+ summaryText = "No results";
+ } else {
+ summaryText = $"{args.index + 1} of {args.count}";
+ }
+
+ findUI.Dispatcher.InvokeAsync (() => {
+ findUI.ResultIndexAndCount.Text = summaryText;
+ });
+ }
+
+ void OnFindOptionsChanged ()
+ {
+ findUI.FindOptions = Broker.FindOptions;
+ }
+
+ void OnFindPreviousClicked ()
+ {
+ commandHandlerService.Execute ((v, b) => new FindPreviousCommandArgs (v, b), Noop);
+ }
+
+ void OnFindNextClicked ()
+ {
+ commandHandlerService.Execute ((v, b) => new FindNextCommandArgs (v, b), Noop);
+ }
+
+ void OnReplaceClicked ()
+ {
+ commandHandlerService.Execute ((v, b) => new ReplaceNextCommandArgs (v, b), Noop);
+ }
+
+ void OnReplaceAllClicked ()
+ {
+ commandHandlerService.Execute ((v, b) => new ReplaceAllCommandArgs (v, b), Noop);
+ }
+
+ void OnFindOptionsChangedInUI (FindOptions findOptions)
+ {
+ Broker.FindOptions = findOptions;
+ }
+
+ void OnSearchTextChangedInUI (string text)
+ {
+ Controller.SearchText = text;
+ }
+
+ void OnReplaceTextChangedInUI (string text)
+ {
+ Controller.ReplaceText = text;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs
new file mode 100644
index 0000000000..4f6b1e7cc2
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs
@@ -0,0 +1,55 @@
+//
+// 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 System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Find;
+using Microsoft.VisualStudio.Text.Find.Implementation;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.TextEditor.Wpf.Find
+{
+ [Export (typeof (IFindPresenterFactory))]
+ class WpfFindPresenterFactory : IFindPresenterFactory
+ {
+ [Import]
+ public FindBroker FindBroker { get; set; }
+
+ [Import]
+ public IEditorCommandHandlerServiceFactory EditorCommandHandlerServiceFactory { get; set; }
+
+ public IFindPresenter TryGetFindPresenter (ITextView textView)
+ {
+ return textView.Properties.GetOrCreateSingletonProperty<IFindPresenter> (() =>
+ {
+ var presenter = new WpfFindPresenter (this, textView);
+ return presenter;
+ });
+ }
+
+ [Export]
+ [Name (FindUI.FindUIAdornmentLayer)]
+ [Order (After = PredefinedAdornmentLayers.Caret)]
+ [IsOverlayLayer (true)]
+ private AdornmentLayerDefinition adornmentLayerDefinition;
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs
new file mode 100644
index 0000000000..daea6c8986
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs
@@ -0,0 +1,422 @@
+//
+// 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 System;
+using System.Windows.Input;
+using Microsoft.VisualStudio.Commanding;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
+using Microsoft.VisualStudio.Text.Operations;
+
+namespace MonoDevelop.Ide.Text
+{
+ sealed class DefaultKeyProcessor : KeyProcessor
+ {
+ readonly IWpfTextView _textView;
+ readonly IEditorOperations _editorOperations;
+ readonly ITextUndoHistoryRegistry _undoHistoryRegistry;
+ readonly IEditorCommandHandlerService _editorCommandHandlerService;
+
+ static Func<CommandState> Unspecified { get; } = () => CommandState.Unspecified;
+ static Action Noop { get; } = () => { };
+
+ internal DefaultKeyProcessor (
+ IWpfTextView textView,
+ IEditorOperations editorOperations,
+ ITextUndoHistoryRegistry undoHistoryRegistry,
+ IEditorCommandHandlerService editorCommandHandlerService)
+ {
+ this._textView = textView;
+ this._editorOperations = editorOperations;
+ this._undoHistoryRegistry = undoHistoryRegistry;
+ this._editorCommandHandlerService = editorCommandHandlerService;
+ }
+
+ public void QueryAndExecute<T> (Func<ITextView, ITextBuffer, T> argsFactory) where T : EditorCommandArgs
+ {
+ var state = _editorCommandHandlerService.GetCommandState (argsFactory, Unspecified);
+ if (state.IsAvailable)
+ _editorCommandHandlerService.Execute (argsFactory, Noop);
+ }
+
+ public override void KeyDown (KeyEventArgs args)
+ {
+ if (args.Handled) {
+ return;
+ }
+
+ args.Handled = true;
+ switch (args.KeyboardDevice.Modifiers) {
+ case ModifierKeys.None:
+ HandleKey (args);
+ break;
+ case ModifierKeys.Control:
+ HandleControlKey (args);
+ break;
+ case ModifierKeys.Alt:
+ HandleAltKey (args);
+ break;
+ case ModifierKeys.Shift | ModifierKeys.Alt:
+ HandleAltShiftKey (args);
+ break;
+ case ModifierKeys.Control | ModifierKeys.Shift:
+ HandleControlShiftKey (args);
+ break;
+ case ModifierKeys.Shift:
+ HandleShiftKey (args);
+ break;
+ case ModifierKeys.Control | ModifierKeys.Alt:
+ HandleAltControlKey (args);
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleAltControlKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Home:
+ _editorOperations.MoveCurrentLineToTop ();
+ break;
+ case Key.End:
+ _editorOperations.MoveCurrentLineToBottom ();
+ break;
+ case Key.Space:
+ QueryAndExecute ((v, b) => new ToggleCompletionModeCommandArgs (v, b));
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleShiftKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Back:
+ QueryAndExecute ((v, b) => new BackspaceKeyCommandArgs (v, b));
+ break;
+ case Key.Right:
+ _editorOperations.MoveToNextCharacter (extendSelection: true);
+ break;
+ case Key.Left:
+ _editorOperations.MoveToPreviousCharacter (extendSelection: true);
+ break;
+ case Key.Up:
+ _editorOperations.MoveLineUp (extendSelection: true);
+ break;
+ case Key.Down:
+ _editorOperations.MoveLineDown (extendSelection: true);
+ break;
+ case Key.Home:
+ QueryAndExecute ((v, b) => new LineStartExtendCommandArgs (v, b));
+ break;
+ case Key.End:
+ QueryAndExecute ((v, b) => new LineEndExtendCommandArgs (v, b));
+ break;
+ case Key.PageUp:
+ _editorOperations.PageUp (extendSelection: true);
+ break;
+ case Key.PageDown:
+ _editorOperations.PageDown (extendSelection: true);
+ break;
+ case Key.Tab:
+ QueryAndExecute ((v, b) => new BackTabKeyCommandArgs (v, b));
+ break;
+ case Key.Enter:
+ QueryAndExecute ((v, b) => new ReturnKeyCommandArgs (v, b));
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleControlShiftKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Right:
+ _editorOperations.MoveToNextWord (extendSelection: true);
+ break;
+ case Key.Left:
+ _editorOperations.MoveToPreviousWord (extendSelection: true);
+ break;
+ case Key.Home:
+ _editorOperations.MoveToStartOfDocument (extendSelection: true);
+ break;
+ case Key.End:
+ _editorOperations.MoveToEndOfDocument (extendSelection: true);
+ break;
+ case Key.U:
+ args.Handled = this.PerformEditAction (() => _editorOperations.MakeUppercase ());
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleAltShiftKey (KeyEventArgs args)
+ {
+ if (args.Key == Key.T) {
+ args.Handled = this.PerformEditAction (() => _editorOperations.TransposeLine ());
+ return;
+ }
+
+ // If this is starting a new selection, put the selection in
+ // box selection mode.
+ if ((args.Key == Key.Down ||
+ args.Key == Key.Up ||
+ args.Key == Key.Left ||
+ args.Key == Key.Right) &&
+ _textView.Selection.IsEmpty) {
+ _textView.Selection.Mode = TextSelectionMode.Box;
+ }
+
+ // Treat it as a regular Shift + keypress
+ HandleShiftKey (args);
+ }
+
+ private void HandleAltKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Left:
+ _editorOperations.SelectEnclosing ();
+ break;
+ case Key.Right:
+ _editorOperations.SelectFirstChild ();
+ break;
+ case Key.Down:
+ _editorOperations.SelectNextSibling (extendSelection: false);
+ break;
+ case Key.Up:
+ _editorOperations.SelectPreviousSibling (extendSelection: false);
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleControlKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Space:
+ QueryAndExecute ((v, b) => new CommitUniqueCompletionListItemCommandArgs (v, b));
+ break;
+ case Key.Back:
+ QueryAndExecute ((v, b) => new WordDeleteToStartCommandArgs (v, b));
+ break;
+ case Key.Delete:
+ QueryAndExecute ((v, b) => new WordDeleteToEndCommandArgs (v, b));
+ break;
+ case Key.A:
+ QueryAndExecute ((v, b) => new SelectAllCommandArgs (v, b));
+ break;
+ case Key.F:
+ QueryAndExecute ((v, b) => new FindCommandArgs (v, b));
+ break;
+ case Key.H:
+ QueryAndExecute ((v, b) => new ReplaceCommandArgs (v, b));
+ break;
+ case Key.W:
+ _editorOperations.SelectCurrentWord ();
+ break;
+ case Key.Right:
+ _editorOperations.MoveToNextWord (extendSelection: false);
+ break;
+ case Key.Left:
+ _editorOperations.MoveToPreviousWord (extendSelection: false);
+ break;
+ case Key.Home:
+ QueryAndExecute ((v, b) => new DocumentStartCommandArgs (v, b));
+ break;
+ case Key.End:
+ QueryAndExecute ((v, b) => new DocumentEndCommandArgs (v, b));
+ break;
+ case Key.Up:
+ _editorOperations.ScrollUpAndMoveCaretIfNecessary ();
+ break;
+ case Key.Down:
+ _editorOperations.ScrollDownAndMoveCaretIfNecessary ();
+ break;
+ case Key.T:
+ args.Handled = this.PerformEditAction (() => _editorOperations.TransposeCharacter ());
+ break;
+ case Key.U:
+ args.Handled = this.PerformEditAction (() => _editorOperations.MakeLowercase ());
+ break;
+ case Key.C:
+ QueryAndExecute ((v, b) => new CopyCommandArgs (v, b));
+ break;
+ case Key.X:
+ QueryAndExecute ((v, b) => new CutCommandArgs (v, b));
+ break;
+ case Key.V:
+ QueryAndExecute ((v, b) => new PasteCommandArgs (v, b));
+ break;
+ case Key.Z:
+ if (UndoHistory.CanUndo)
+ QueryAndExecute ((v, b) => new UndoCommandArgs (v, b));
+ else
+ args.Handled = false;
+ break;
+ case Key.Y:
+ if (UndoHistory.CanRedo)
+ QueryAndExecute ((v, b) => new RedoCommandArgs (v, b));
+ else
+ args.Handled = false;
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ private void HandleKey (KeyEventArgs args)
+ {
+ switch (args.Key) {
+ case Key.Right:
+ QueryAndExecute ((v, b) => new RightKeyCommandArgs (v, b));
+ break;
+ case Key.Left:
+ QueryAndExecute ((v, b) => new LeftKeyCommandArgs (v, b));
+ break;
+ case Key.Up:
+ QueryAndExecute ((v, b) => new UpKeyCommandArgs (v, b));
+ break;
+ case Key.Down:
+ QueryAndExecute ((v, b) => new DownKeyCommandArgs (v, b));
+ break;
+ case Key.PageUp:
+ QueryAndExecute ((v, b) => new PageUpKeyCommandArgs (v, b));
+ break;
+ case Key.PageDown:
+ QueryAndExecute ((v, b) => new PageDownKeyCommandArgs (v, b));
+ break;
+ case Key.Home:
+ QueryAndExecute ((v, b) => new LineStartCommandArgs (v, b));
+ break;
+ case Key.End:
+ QueryAndExecute ((v, b) => new LineEndCommandArgs (v, b));
+ break;
+ case Key.Escape:
+ QueryAndExecute ((v, b) => new EscapeKeyCommandArgs (v, b));
+ break;
+ case Key.Delete:
+ QueryAndExecute ((v, b) => new DeleteKeyCommandArgs (v, b));
+ break;
+ case Key.Back:
+ QueryAndExecute ((v, b) => new BackspaceKeyCommandArgs (v, b));
+ break;
+ case Key.Insert:
+ _editorOperations.Options.SetOptionValue (DefaultTextViewOptions.OverwriteModeId,
+ !_editorOperations.Options.IsOverwriteModeEnabled ());
+ break;
+ case Key.Enter:
+ QueryAndExecute ((v, b) => new ReturnKeyCommandArgs (v, b));
+ break;
+ case Key.Tab:
+ QueryAndExecute ((v, b) => new TabKeyCommandArgs (v, b));
+ break;
+ case Key.F2:
+ QueryAndExecute ((v, b) => new RenameCommandArgs (v, b));
+ break;
+ default:
+ args.Handled = false;
+ break;
+ }
+ }
+
+ public override void TextInput (TextCompositionEventArgs args)
+ {
+ if (args.Text.Length == 1) {
+ QueryAndExecute ((v, b) => new TypeCharCommandArgs (v, b, args.Text[0]));
+ args.Handled = true;
+ }
+ }
+
+ public override void TextInputStart (TextCompositionEventArgs args)
+ {
+ if (args.TextComposition is ImeTextComposition) {
+ // This TextInputStart message is part of an IME event and needs to be treated like
+ // provisional text input (if the cast failed, then an IME is not the source of the
+ // text input and we can rely on getting an identical TextInput event as soon as we
+ // exit).
+ this.HandleProvisionalImeInput (args);
+ }
+ }
+
+ public override void TextInputUpdate (TextCompositionEventArgs args)
+ {
+ if (args.TextComposition is ImeTextComposition) {
+ this.HandleProvisionalImeInput (args);
+ } else {
+ args.Handled = false;
+ }
+ }
+
+ private void HandleProvisionalImeInput (TextCompositionEventArgs args)
+ {
+ if (args.Text.Length > 0) {
+ args.Handled = this.PerformEditAction (() => _editorOperations.InsertProvisionalText (args.Text));
+
+ if (args.Handled) {
+ _textView.Caret.EnsureVisible ();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Performs the passed editAction if the view does not prohibit user input.
+ /// </summary>
+ /// <returns>True if the editAction was performed.</returns>
+ private bool PerformEditAction (Action editAction)
+ {
+ if (!_textView.Options.GetOptionValue<bool> (DefaultTextViewOptions.ViewProhibitUserInputId)) {
+ editAction.Invoke ();
+ return true;
+ }
+
+ return false;
+ }
+
+ private ITextUndoHistory UndoHistory {
+ get {
+ return _undoHistoryRegistry.GetHistory (_textView.TextBuffer);
+ }
+ }
+ }
+}
+
+// TODO:
+// InvokeCompletionList
+// InvokeSignatureHelp
+// InsertSnippet
+// MoveSelectedLinesUp
+// MoveSelectedLinesDown
+// Rename
+// SurroundWith \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs
new file mode 100644
index 0000000000..2c7a17a0d0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs
@@ -0,0 +1,65 @@
+//
+// 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 System;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.Ide.Text
+{
+ [Export(typeof(IKeyProcessorProvider))]
+ [Name("DefaultKeyProcessor")]
+ [ContentType("text")]
+ [TextViewRole(PredefinedTextViewRoles.Interactive)]
+ internal sealed class DefaultKeyProcessorProvider : IKeyProcessorProvider
+ {
+ [Import]
+ private IEditorOperationsFactoryService editorOperationsProvider = null;
+
+ [Import]
+ private IEditorCommandHandlerServiceFactory editorCommandHandlerServiceFactory = null;
+
+ [Import]
+ private ITextUndoHistoryRegistry textUndoHistoryRegistry = null;
+
+ /// <summary>
+ /// Creates a new key processor provider for the given WPF text view host
+ /// </summary>
+ /// <param name="wpfTextView">WPF-based text view to create key processor for</param>
+ /// <returns>A valid key processor</returns>
+ public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
+ {
+ if (wpfTextView == null)
+ {
+ throw new ArgumentNullException("wpfTextView");
+ }
+
+ return new DefaultKeyProcessor(
+ wpfTextView,
+ editorOperationsProvider.GetEditorOperations(wpfTextView),
+ textUndoHistoryRegistry,
+ editorCommandHandlerServiceFactory.GetService(wpfTextView));
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj
new file mode 100644
index 0000000000..9474f78de0
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj
@@ -0,0 +1,47 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="..\..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesVSEditor)" />
+ <Import Project="$(ReferencesGtk)" />
+ <PropertyGroup>
+ <AssemblyTitle>MonoDevelop WPF Text Editor</AssemblyTitle>
+ <AssemblyDescription>Integrates the WPF version of the Visual Studio Editor into MonoDevelop</AssemblyDescription>
+ <AddinBuildDir>DisplayBindings\TextEditor.Wpf</AddinBuildDir>
+ <AddMonoDevelopCoreReferences>true</AddMonoDevelopCoreReferences>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="DiagnosticMargin" Version="1.0.1" PrivateAssets="all" />
+ <PackageReference Include="Microsoft.VisualStudio.CoreUtility" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Imaging" Version="16.0.27828" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Text.Data" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Text.Internal" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Text.Logic" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Language" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Language.Intellisense" Version="$(NuGetVersionVSEditor)" PrivateAssets="all" ExcludeAssets="runtime" />
+ <ProjectReference Include="..\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\xwt\Xwt\Xwt.csproj" Private="False" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Find\Find.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Def\InfoBar\InfoBar.csproj" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="WindowsFormsIntegration" />
+ <Reference Include="System.Xaml" />
+ </ItemGroup>
+ <ItemGroup>
+ <IncludeCopyLocal Include="DiagnosticMargin.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.Find.Implementation.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.InfoBar.dll" />
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="**\*.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Update="Find\FindUI.xaml.cs">
+ <DependentUpon>FindUI.xaml</DependentUpon>
+ </Compile>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs
new file mode 100644
index 0000000000..66b33c472a
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs
@@ -0,0 +1,241 @@
+//
+// 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 System;
+using System.Diagnostics;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.TextEditor
+{
+ class MonoDevelopTracer : Microsoft.VisualStudio.Utilities.ITracer
+ {
+ public MonoDevelopTracer (string name, SourceLevels level = SourceLevels.Warning)
+ {
+ Source = new TraceSource (name);
+ Level = level;
+ }
+
+ public TraceSource Source { get; }
+
+ public SourceLevels Level { get; set; }
+
+ public int IndentLevel => 0;
+
+ public IDisposable Indent (int count = 1)
+ {
+ return null;
+ }
+
+ public bool ShouldTrace (TraceEventType eventType)
+ {
+ switch (eventType) {
+ case TraceEventType.Critical:
+ return Level.HasFlag (SourceLevels.Critical);
+ case TraceEventType.Error:
+ return Level.HasFlag (SourceLevels.Error);
+ case TraceEventType.Warning:
+ return Level.HasFlag (SourceLevels.Warning);
+ case TraceEventType.Information:
+ return Level.HasFlag (SourceLevels.Information);
+ case TraceEventType.Verbose:
+ return Level.HasFlag (SourceLevels.Verbose);
+ }
+ return false;
+ }
+
+ public void Trace (TraceEventType eventType, string message)
+ {
+ if (ShouldTrace (eventType)) {
+ switch (eventType) {
+ case TraceEventType.Critical:
+ LoggingService.LogFatalError (message);
+ break;
+ case TraceEventType.Error:
+ LoggingService.LogError (message);
+ break;
+ case TraceEventType.Warning:
+ LoggingService.LogWarning (message);
+ break;
+ case TraceEventType.Information:
+ LoggingService.LogInfo (message);
+ break;
+ case TraceEventType.Verbose:
+ LoggingService.LogDebug (message);
+ break;
+ }
+ }
+ }
+
+ public void Trace (TraceEventType eventType, string message, object arg0)
+ {
+ if (ShouldTrace (eventType)) {
+ switch (eventType) {
+ case TraceEventType.Critical:
+ LoggingService.LogFatalError (message, arg0);
+ break;
+ case TraceEventType.Error:
+ LoggingService.LogError (message, arg0);
+ break;
+ case TraceEventType.Warning:
+ LoggingService.LogWarning (message, arg0);
+ break;
+ case TraceEventType.Information:
+ LoggingService.LogInfo (message, arg0);
+ break;
+ case TraceEventType.Verbose:
+ LoggingService.LogDebug (message, arg0);
+ break;
+ }
+ }
+ }
+
+ public void Trace (TraceEventType eventType, string message, object arg0, object arg1)
+ {
+ if (ShouldTrace (eventType)) {
+ switch (eventType) {
+ case TraceEventType.Critical:
+ LoggingService.LogFatalError (message, arg0, arg1);
+ break;
+ case TraceEventType.Error:
+ LoggingService.LogError (message, arg0, arg1);
+ break;
+ case TraceEventType.Warning:
+ LoggingService.LogWarning (message, arg0, arg1);
+ break;
+ case TraceEventType.Information:
+ LoggingService.LogInfo (message, arg0, arg1);
+ break;
+ case TraceEventType.Verbose:
+ LoggingService.LogDebug (message, arg0, arg1);
+ break;
+ }
+ }
+ }
+
+ public void Trace (TraceEventType eventType, string message, params object[] args)
+ {
+ if (ShouldTrace (eventType)) {
+ switch (eventType) {
+ case TraceEventType.Critical:
+ LoggingService.LogFatalError (message, args);
+ break;
+ case TraceEventType.Error:
+ LoggingService.LogError (message, args);
+ break;
+ case TraceEventType.Warning:
+ LoggingService.LogWarning (message, args);
+ break;
+ case TraceEventType.Information:
+ LoggingService.LogInfo (message, args);
+ break;
+ case TraceEventType.Verbose:
+ LoggingService.LogDebug (message, args);
+ break;
+ }
+ }
+ }
+
+ public void TraceError (string message)
+ {
+ LoggingService.LogError (message);
+ }
+
+ public void TraceError (string message, object arg0)
+ {
+ LoggingService.LogError (message, arg0);
+ }
+
+ public void TraceError (string message, object arg0, object arg1)
+ {
+ LoggingService.LogError (message, arg0, arg1);
+ }
+
+ public void TraceError (string message, params object[] args)
+ {
+ LoggingService.LogError (message, args);
+ }
+
+ public void TraceException (Exception ex, TraceEventType eventType = TraceEventType.Error)
+ {
+ LoggingService.LogError (Source.Name, ex);
+ }
+
+ public void TraceInformation (string message)
+ {
+ LoggingService.LogInfo (message);
+ }
+
+ public void TraceInformation (string message, object arg0)
+ {
+ LoggingService.LogInfo (message, arg0);
+ }
+
+ public void TraceInformation (string message, object arg0, object arg1)
+ {
+ LoggingService.LogInfo (message, arg0, arg1);
+ }
+
+ public void TraceInformation (string message, params object[] args)
+ {
+ LoggingService.LogInfo (message, args);
+ }
+
+ public void TraceVerbose (string message)
+ {
+ LoggingService.LogDebug (message);
+ }
+
+ public void TraceVerbose (string message, object arg0)
+ {
+ LoggingService.LogDebug (message, arg0);
+ }
+
+ public void TraceVerbose (string message, object arg0, object arg1)
+ {
+ LoggingService.LogDebug (message, arg1);
+ }
+
+ public void TraceVerbose (string message, params object[] args)
+ {
+ LoggingService.LogDebug (message, args);
+ }
+
+ public void TraceWarning (string message)
+ {
+ LoggingService.LogWarning (message);
+ }
+
+ public void TraceWarning (string message, object arg0)
+ {
+ LoggingService.LogWarning (message, arg0);
+ }
+
+ public void TraceWarning (string message, object arg0, object arg1)
+ {
+ LoggingService.LogWarning (message, arg0, arg1);
+ }
+
+ public void TraceWarning (string message, params object[] args)
+ {
+ LoggingService.LogWarning (message, args);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs
new file mode 100644
index 0000000000..cf779fbb00
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs
@@ -0,0 +1,40 @@
+//
+// 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 System;
+using Mono.Addins;
+using Mono.Addins.Description;
+
+[assembly:Addin ("TextEditor.Wpf",
+ Namespace = "MonoDevelop",
+ Version = MonoDevelop.BuildInfo.Version,
+ Category = "MonoDevelop Core")]
+
+[assembly:AddinName ("MonoDevelop Text Editor")]
+[assembly:AddinDescription ("Integrates the Visual Studio text editor")]
+[assembly: AddinFlags (AddinFlags.Hidden)]
+
+[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Debugger", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Refactoring", MonoDevelop.BuildInfo.Version)]
+[assembly: AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml
new file mode 100644
index 0000000000..9436da65eb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml
@@ -0,0 +1,22 @@
+<ExtensionModel>
+ <Runtime>
+ <Import assembly="MonoDevelop.TextEditor.Wpf.dll"/>
+ <Import assembly="../../../bin/Microsoft.VisualStudio.Language.NavigateTo.Interfaces.dll" />
+ <Import assembly="../../../bin/Microsoft.VisualStudio.Text.Internal.dll" />
+ </Runtime>
+ <Extension path="/MonoDevelop/Ide/Composition">
+ <Assembly file="../../../bin/Microsoft.CodeAnalysis.EditorFeatures.Wpf.dll"/>
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Platform.VSEditor.dll"/>
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Text.UI.Wpf.dll"/>
+ <Assembly file="MonoDevelop.TextEditor.Wpf.dll"/>
+ <Assembly file="Microsoft.VisualStudio.Text.Find.Implementation.dll"/>
+ <Assembly file="Microsoft.VisualStudio.Text.InfoBar.dll"/>
+ <Assembly file="DiagnosticMargin.dll"/>
+ </Extension>
+ <Extension path = "/MonoDevelop/Ide/DisplayBindings">
+ <DisplayBinding id = "TextViewWpf" insertbefore = "TextEditor" class = "MonoDevelop.TextEditor.WpfTextViewDisplayBinding" />
+ </Extension>
+ <Extension path = "/MonoDevelop/TextEditor/CommandMapping">
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.DeleteKey" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DeleteKeyCommandArgs" />
+ </Extension>
+</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs
new file mode 100644
index 0000000000..854c01c903
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs
@@ -0,0 +1,39 @@
+//
+// 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.Components.Windows;
+using System.Windows.Controls;
+
+namespace MonoDevelop.TextEditor
+{
+ class RootWpfWidget : GtkWPFWidget
+ {
+ public RootWpfWidget (Control control) : base(control)
+ {
+ }
+
+ protected override void RepositionWpfWindow ()
+ {
+ var scale = MonoDevelop.Components.GtkWorkarounds.GetScaleFactor (this);
+ RepositionWpfWindow (scale, scale);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs
new file mode 100644
index 0000000000..acf9ecd7a1
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs
@@ -0,0 +1,267 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Utilities;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Ide.Text
+{
+ /// <summary>
+ /// Provides a very simple ITextUndoHistory implementation.
+ /// </summary>
+ internal sealed class UndoHistory : ITextUndoHistory
+ {
+ private readonly Stack<UndoTransaction> _openTransactionStack = new Stack<UndoTransaction>();
+ private readonly Stack<ITextUndoTransaction> _undoStack = new Stack<ITextUndoTransaction>();
+ private readonly Stack<ITextUndoTransaction> _redoStack = new Stack<ITextUndoTransaction>();
+ private readonly PropertyCollection _properties = new PropertyCollection();
+ private TextUndoHistoryState _state = TextUndoHistoryState.Idle;
+ private event EventHandler<TextUndoRedoEventArgs> _undoRedoHappened;
+ private event EventHandler<TextUndoTransactionCompletedEventArgs> _undoTransactionCompleted;
+
+ internal ITextUndoTransaction CurrentTransaction
+ {
+ get { return _openTransactionStack.Count > 0 ? _openTransactionStack.Peek() : null; }
+ }
+
+ internal Stack<ITextUndoTransaction> UndoStack => _undoStack;
+
+ internal Stack<ITextUndoTransaction> RedoStack => _redoStack;
+
+ internal object Context { get; }
+
+ internal UndoHistory(object context) => Context = context;
+
+ internal ITextUndoTransaction CreateTransaction(string description)
+ {
+ _openTransactionStack.Push(new UndoTransaction(this, description));
+ return _openTransactionStack.Peek();
+ }
+
+ internal void Redo(int count)
+ {
+ try
+ {
+ count = Math.Min(_redoStack.Count, count);
+ _state = TextUndoHistoryState.Redoing;
+ for (var i = 0; i < count; i++)
+ {
+ var current = _redoStack.Peek();
+ if (!current.CanRedo)
+ {
+ throw new InvalidOperationException();
+ }
+
+ _redoStack.Pop();
+ current.Do();
+ _undoStack.Push(current);
+ }
+
+ RaiseUndoRedoHappened();
+ }
+ finally
+ {
+ _state = TextUndoHistoryState.Idle;
+ }
+ }
+
+ internal void Undo(int count)
+ {
+ try
+ {
+ count = Math.Min(_undoStack.Count, count);
+ _state = TextUndoHistoryState.Undoing;
+ for (var i = 0; i < count; i++)
+ {
+ var current = _undoStack.Peek();
+ if (!current.CanUndo)
+ {
+ throw new InvalidOperationException();
+ }
+ _undoStack.Pop();
+ current.Undo();
+ _redoStack.Push(current);
+
+ RaiseUndoRedoHappened();
+ }
+ }
+ finally
+ {
+ _state = TextUndoHistoryState.Idle;
+ }
+ }
+
+ internal void OnTransactionClosed(UndoTransaction transaction, bool didComplete)
+ {
+ if (_openTransactionStack.Count == 0 || transaction != _openTransactionStack.Peek())
+ {
+ // Happens in dispose after complete / cancel
+ return;
+ }
+
+ _openTransactionStack.Pop();
+ if (!didComplete)
+ {
+ return;
+ }
+
+ if (_openTransactionStack.Count == 0)
+ {
+ OnTransactionStackCompleted(transaction);
+ }
+ else
+ {
+ var top = _openTransactionStack.Peek();
+ foreach (var cur in transaction.UndoPrimitives)
+ {
+ top.AddUndo(cur);
+ }
+
+ transaction.UndoPrimitives.Clear();
+ }
+ }
+
+ private void OnTransactionStackCompleted(UndoTransaction transaction)
+ {
+ Debug.Assert(_openTransactionStack.Count == 0);
+
+ ITextUndoTransaction eventArgument = transaction;
+ var result = TextUndoTransactionCompletionResult.TransactionAdded;
+ if (_undoStack.Count > 0)
+ {
+ var previous = _undoStack.Peek();
+ if (transaction.MergePolicy != null &&
+ previous.MergePolicy != null &&
+ previous.MergePolicy.TestCompatiblePolicy(transaction.MergePolicy) &&
+ previous.MergePolicy.CanMerge(newerTransaction: transaction, olderTransaction: previous))
+ {
+ eventArgument = previous;
+ previous.MergePolicy.PerformTransactionMerge(existingTransaction: previous, newTransaction: transaction);
+ }
+ else
+ {
+ _undoStack.Push(transaction);
+ }
+ }
+ else
+ {
+ _undoStack.Push(transaction);
+ }
+
+ _undoTransactionCompleted?.Invoke(this, new TextUndoTransactionCompletedEventArgs(eventArgument, result));
+ }
+
+ internal void Clear()
+ {
+ if (_state != TextUndoHistoryState.Idle || CurrentTransaction != null)
+ {
+ throw new InvalidOperationException("Can't clear with an open transaction or in undo / redo");
+ }
+
+ _undoStack.Clear();
+ _redoStack.Clear();
+
+ // The IEditorOperations AddAfterTextBufferChangePrimitive and AddBeforeTextBufferChangePrimitive
+ // implementations store an ITextView in the Property of the associated ITextUndoHistory. It's
+ // necessary to keep this value present so long as the primitives are in the undo / redo stack
+ // as their implementation depends on it. Once the stack is cleared we can safely remove
+ // the value.
+ //
+ // This is in fact necessary for sane testing. Without this removal it's impossible to have
+ // an ITextView disconnect and be collected from it's underlying ITextBuffer. The ITextUndoHistory
+ // is associated with an ITextBuffer and through it's undo stack will keep the ITextView alive
+ // indefinitely
+ _properties.RemoveProperty(typeof(ITextView));
+ }
+
+ private void RaiseUndoRedoHappened()
+ {
+ // Note: Passing null here as this is what Visual Studio does
+ _undoRedoHappened?.Invoke(this, new TextUndoRedoEventArgs(_state, null));
+ }
+
+ bool ITextUndoHistory.CanRedo => _redoStack.Count > 0;
+
+ bool ITextUndoHistory.CanUndo => _undoStack.Count > 0;
+
+ ITextUndoTransaction ITextUndoHistory.CreateTransaction(string description) => CreateTransaction(description);
+
+ ITextUndoTransaction ITextUndoHistory.CurrentTransaction => CurrentTransaction;
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ ITextUndoTransaction ITextUndoHistory.LastRedoTransaction => throw new NotSupportedException();
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ ITextUndoTransaction ITextUndoHistory.LastUndoTransaction => throw new NotSupportedException();
+
+ void ITextUndoHistory.Redo(int count) => Redo(count);
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ string ITextUndoHistory.RedoDescription => throw new NotSupportedException();
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ IEnumerable<ITextUndoTransaction> ITextUndoHistory.RedoStack => _redoStack;
+
+ TextUndoHistoryState ITextUndoHistory.State
+ {
+ [DebuggerNonUserCode]
+ get => _state;
+ }
+
+ void ITextUndoHistory.Undo(int count) => Undo(count);
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ string ITextUndoHistory.UndoDescription => throw new NotSupportedException();
+
+ event EventHandler<TextUndoRedoEventArgs> ITextUndoHistory.UndoRedoHappened
+ {
+ add => _undoRedoHappened += value;
+ remove => _undoRedoHappened -= value;
+ }
+
+ /// <summary>
+ /// Easy to implement but not supported by Visual Studio
+ /// </summary>
+ IEnumerable<ITextUndoTransaction> ITextUndoHistory.UndoStack => _undoStack;
+
+ event EventHandler<TextUndoTransactionCompletedEventArgs> ITextUndoHistory.UndoTransactionCompleted
+ {
+ add => _undoTransactionCompleted += value;
+ remove => _undoTransactionCompleted -= value;
+ }
+
+ PropertyCollection IPropertyOwner.Properties => _properties;
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs
new file mode 100644
index 0000000000..4f8f73668e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs
@@ -0,0 +1,100 @@
+//
+// 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 System;
+using System.ComponentModel.Composition;
+using System.Runtime.CompilerServices;
+using Microsoft.VisualStudio.Text.Operations;
+
+namespace MonoDevelop.Ide.Text
+{
+ /// <summary>
+ /// This class is intended to be a very simple ITextUndoHistoryRegistry implementation for hosts that
+ /// don't have a built-in undo mechanism
+ /// </summary>
+ [Export(typeof(ITextUndoHistoryRegistry))]
+ internal sealed class TextUndoHistoryRegistry : ITextUndoHistoryRegistry
+ {
+ private readonly ConditionalWeakTable<object, ITextUndoHistory> _map = new ConditionalWeakTable<object, ITextUndoHistory>();
+
+ internal TextUndoHistoryRegistry()
+ {
+ }
+
+ private bool TryGetHistory(object context, out ITextUndoHistory undoHistory)
+ {
+ return _map.TryGetValue(context, out undoHistory);
+ }
+
+ #region ITextUndoHistoryRegistry
+
+ /// <summary>
+ /// Easy to implement but the Visual Studio implementation throws a NotSupportedException
+ /// </summary>
+ void ITextUndoHistoryRegistry.AttachHistory(object context, ITextUndoHistory history)
+ {
+ throw new NotSupportedException();
+ }
+
+ ITextUndoHistory ITextUndoHistoryRegistry.GetHistory(object context)
+ {
+ ITextUndoHistory history;
+ _map.TryGetValue(context, out history);
+ return history;
+ }
+
+ ITextUndoHistory ITextUndoHistoryRegistry.RegisterHistory(object context)
+ {
+ ITextUndoHistory history;
+ if (!_map.TryGetValue(context, out history))
+ {
+ history = new UndoHistory(context);
+ _map.Add(context, history);
+ }
+ return history;
+ }
+
+ void ITextUndoHistoryRegistry.RemoveHistory(ITextUndoHistory history)
+ {
+ var undoHistory = history as UndoHistory;
+ if (undoHistory != null)
+ {
+ _map.Remove(undoHistory.Context);
+ undoHistory.Clear();
+ }
+ }
+
+ bool ITextUndoHistoryRegistry.TryGetHistory(object context, out ITextUndoHistory history)
+ {
+ ITextUndoHistory undoHistory;
+ if (TryGetHistory(context, out undoHistory))
+ {
+ history = undoHistory;
+ return true;
+ }
+
+ history = null;
+ return false;
+ }
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoTransaction.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoTransaction.cs
new file mode 100644
index 0000000000..546c00ecb3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoTransaction.cs
@@ -0,0 +1,179 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.VisualStudio.Text.Operations;
+
+namespace MonoDevelop.Ide.Text
+{
+ internal sealed class UndoTransaction : ITextUndoTransaction
+ {
+ private readonly UndoHistory _textUndoHistory;
+ private readonly List<ITextUndoPrimitive> _primitiveList = new List<ITextUndoPrimitive>();
+ private bool _completed;
+
+ internal string Description
+ {
+ get;
+ set;
+ }
+
+ internal List<ITextUndoPrimitive> UndoPrimitives
+ {
+ get { return _primitiveList; }
+ }
+
+ internal bool CanRedo
+ {
+ get { return _primitiveList.All(x => x.CanRedo); }
+ }
+
+ internal bool CanUndo
+ {
+ get { return _primitiveList.All(x => x.CanUndo); }
+ }
+
+ internal IMergeTextUndoTransactionPolicy MergePolicy
+ {
+ get;
+ set;
+ }
+
+ internal UndoTransaction(UndoHistory textUndoHistory, string description)
+ {
+ _textUndoHistory = textUndoHistory;
+ Description = description;
+ }
+
+ internal void AddUndo(ITextUndoPrimitive undo)
+ {
+ System.Diagnostics.Debug.Assert(undo.CanUndo);
+ _primitiveList.Add(undo);
+ undo.Parent = this;
+ }
+
+ private void HandleCompleted()
+ {
+ if (_completed)
+ {
+ throw new InvalidOperationException();
+ }
+
+ _completed = true;
+ }
+
+ #region ITextUndoTransaction
+
+ void ITextUndoTransaction.AddUndo(ITextUndoPrimitive undo)
+ {
+ AddUndo(undo);
+ }
+
+ /// <summary>
+ /// Visual Studio implementation throw so duplicate here
+ /// </summary>
+ bool ITextUndoTransaction.CanRedo
+ {
+ get { return CanRedo; }
+ }
+
+ /// <summary>
+ /// Visual Studio implementation throw so duplicate here
+ /// </summary>
+ bool ITextUndoTransaction.CanUndo
+ {
+ get { return CanUndo; }
+ }
+
+ ITextUndoHistory ITextUndoTransaction.History
+ {
+ get { return _textUndoHistory; }
+ }
+
+ IMergeTextUndoTransactionPolicy ITextUndoTransaction.MergePolicy
+ {
+ get { return MergePolicy; }
+ set { MergePolicy = value; }
+ }
+
+ ITextUndoTransaction ITextUndoTransaction.Parent
+ {
+ get { throw new NotSupportedException(); }
+ }
+
+ IList<ITextUndoPrimitive> ITextUndoTransaction.UndoPrimitives
+ {
+ get { return UndoPrimitives; }
+ }
+
+ UndoTransactionState ITextUndoTransaction.State
+ {
+ get { throw new NotSupportedException(); }
+ }
+
+ string ITextUndoTransaction.Description
+ {
+ get { return Description; }
+ set { Description = value; }
+ }
+
+ void ITextUndoTransaction.Cancel()
+ {
+ HandleCompleted();
+ _textUndoHistory.OnTransactionClosed(this, didComplete: false);
+ }
+
+ void ITextUndoTransaction.Complete()
+ {
+ HandleCompleted();
+ _textUndoHistory.OnTransactionClosed(this, didComplete: true);
+ }
+
+ void ITextUndoTransaction.Do()
+ {
+ for (var i = 0; i < _primitiveList.Count; i++)
+ {
+ _primitiveList[i].Do();
+ }
+ }
+
+ void ITextUndoTransaction.Undo()
+ {
+ for (var i = _primitiveList.Count - 1; i >= 0; i--)
+ {
+ _primitiveList[i].Undo();
+ }
+ }
+
+ #endregion
+
+ #region IDisposable
+
+ void IDisposable.Dispose()
+ {
+ _textUndoHistory.OnTransactionClosed(this, didComplete: false);
+ }
+
+ #endregion
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfImageElementViewElementFactory.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfImageElementViewElementFactory.cs
new file mode 100644
index 0000000000..a344db8490
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfImageElementViewElementFactory.cs
@@ -0,0 +1,55 @@
+//
+// 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 System;
+using System.ComponentModel.Composition;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media.Imaging;
+using Microsoft.VisualStudio.Text.Adornments;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.TextEditor.Wpf
+{
+ [Export (typeof (IViewElementFactory))]
+ [Name ("MonoDevelop ImageElement to UIElement")]
+ [TypeConversion (from: typeof (ImageElement), to: typeof (UIElement))]
+ [Order(Before = "default ImageElement to UIElement")]
+ sealed class WpfImageElementViewElementFactory : IViewElementFactory
+ {
+ public TView CreateViewElement<TView> (ITextView textView, object model) where TView : class
+ {
+ // Should never happen if the service's code is correct, but it's good to be paranoid.
+ if (typeof (TView) != typeof (UIElement) || !(model is ImageElement element)) {
+ throw new ArgumentException ($"Invalid type conversion. Unsupported {nameof (model)} or {nameof (TView)} type");
+ }
+
+ var image = new Image ();
+ if (MonoDevelop.Ide.ImageService.TryGetImage (element.ImageId, out var xwtImage)) {
+ var nativeImage = Xwt.Toolkit.NativeEngine.GetNativeImage (xwtImage);
+ image.Source = nativeImage as BitmapSource;
+ }
+
+ return image as TView;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfMouseProcessor.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfMouseProcessor.cs
new file mode 100644
index 0000000000..87bcf4c37f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfMouseProcessor.cs
@@ -0,0 +1,74 @@
+//
+// 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 System.ComponentModel.Composition;
+using System.Windows;
+using System.Windows.Input;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Utilities;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+
+namespace MonoDevelop.TextEditor.Wpf
+{
+ [Export (typeof (IMouseProcessorProvider))]
+ [Name (nameof (WpfMouseProcessorProvider))]
+ [Order (Before = "WordSelection")]
+ [ContentType ("Text")]
+ [TextViewRole (PredefinedTextViewRoles.Interactive)]
+ class WpfMouseProcessorProvider : IMouseProcessorProvider
+ {
+ [Import]
+ public ITextDocumentFactoryService TextDocumentFactory { get; private set; }
+
+ [Import]
+ public IEditorCommandHandlerServiceFactory CommandServiceFactory { get; private set; }
+
+ public IMouseProcessor GetAssociatedProcessor (IWpfTextView textView)
+ {
+ return new WfpMouseProcessor (CommandServiceFactory.GetService (textView), textView);
+ }
+ }
+
+ class WfpMouseProcessor : MouseProcessorBase
+ {
+ IWpfTextView textView;
+ private readonly IEditorCommandHandlerService commandServiceFactory;
+ readonly string menuPath = "/MonoDevelop/TextEditor/ContextMenu/Editor";
+
+ public WfpMouseProcessor (IEditorCommandHandlerService commandServiceFactory, IWpfTextView textView)
+ {
+ this.textView = textView;
+ this.commandServiceFactory = commandServiceFactory;
+ }
+
+ public override void PreprocessMouseRightButtonUp (MouseButtonEventArgs e)
+ {
+ var view = (WpfTextViewContent)textView.Properties[typeof (ViewContent)];
+ var ctx = view.WorkbenchWindow?.ExtensionContext ?? Mono.Addins.AddinManager.AddinEngine;
+ var cset = IdeApp.CommandService.CreateCommandEntrySet (ctx, menuPath);
+ var pt = e.GetPosition (view.HostControl);
+ IdeApp.CommandService.ShowContextMenu (view.Control, (int)pt.X, (int)pt.Y, cset, view);
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfObscuringTipManager.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfObscuringTipManager.cs
new file mode 100644
index 0000000000..ffad8c6f54
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfObscuringTipManager.cs
@@ -0,0 +1,83 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.TextEditor
+{
+ [Export (typeof (IObscuringTipManager))]
+ class WpfObscuringTipManager : IObscuringTipManager
+ {
+ readonly Dictionary<ITextView, List<IObscuringTip>> tipStacks
+ = new Dictionary<ITextView, List<IObscuringTip>> ();
+
+ public void PushTip (ITextView view, IObscuringTip tip)
+ {
+ if (!(view is IWpfTextView)) {
+ return;
+ }
+
+ if (!tipStacks.TryGetValue (view, out var stack)) {
+ view.Closed += OnTextViewClosed;
+ tipStacks[view] = stack = new List<IObscuringTip> ();
+ }
+
+ stack.Add (tip);
+ }
+
+ public void RemoveTip (ITextView view, IObscuringTip tip)
+ {
+ if (!(view is IWpfTextView)) {
+ return;
+ }
+
+ if (tipStacks.TryGetValue (view, out var stack)) {
+ stack.Remove (tip);
+ }
+ }
+
+ public bool HasStack (ITextView view)
+ => tipStacks.TryGetValue (view, out var stack) && stack.Count > 0;
+
+ public bool DismissTopOfStack (ITextView view)
+ {
+ if (tipStacks.TryGetValue (view, out var stack)) {
+ if (stack.Count > 0) {
+ // NOTE: Tip is responsible for removing itself.
+ stack[stack.Count - 1].Dismiss ();
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void OnTextViewClosed (object sender, EventArgs e)
+ {
+ var textView = (ITextView)sender;
+ tipStacks.Remove (textView);
+ textView.Closed -= OnTextViewClosed;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewContent.cs
new file mode 100644
index 0000000000..8bba77b1a3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewContent.cs
@@ -0,0 +1,110 @@
+//
+// 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 System.Windows.Input;
+using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.Components;
+
+namespace MonoDevelop.TextEditor
+{
+ class WpfTextViewContent : TextViewContent<IWpfTextView, WpfTextViewImports>, Ide.Gui.Content.IZoomable
+ {
+ IWpfTextViewHost wpfTextViewHost;
+
+ public WpfTextViewContent (WpfTextViewImports imports, Core.FilePath fileName, string mimeType, Projects.Project ownerProject)
+ : base (imports, fileName, mimeType, ownerProject)
+ {
+ }
+
+ protected override IWpfTextView CreateTextView (ITextViewModel viewModel, ITextViewRoleSet roles)
+ => Imports.TextEditorFactoryService.CreateTextView (viewModel, roles, Imports.EditorOptionsFactoryService.GlobalOptions);
+
+ public System.Windows.Controls.Control HostControl => wpfTextViewHost.HostControl;
+
+ protected override Control CreateControl ()
+ {
+ wpfTextViewHost = Imports.TextEditorFactoryService.CreateTextViewHost (TextView, setFocus: true);
+ var wpfControl = wpfTextViewHost.HostControl;
+
+ Gtk.Widget widget = new RootWpfWidget (wpfControl) {
+ HeightRequest = 50,
+ WidthRequest = 100
+ };
+
+ TextView.VisualElement.Tag = widget;
+
+ var xwtWidget = Xwt.Toolkit.CurrentEngine.WrapWidget (widget, Xwt.NativeWidgetSizing.External);
+ xwtWidget.Show ();
+
+ return new XwtControl (xwtWidget);
+ }
+
+ protected override ITextViewRoleSet GetAllPredefinedRoles () => Imports.TextEditorFactoryService.AllPredefinedRoles;
+
+ protected override void SubscribeToEvents ()
+ {
+ base.SubscribeToEvents ();
+ TextView.VisualElement.LostKeyboardFocus += HandleWpfLostKeyboardFocus;
+ }
+
+ protected override void UnsubscribeFromEvents ()
+ {
+ base.UnsubscribeFromEvents ();
+ TextView.VisualElement.LostKeyboardFocus -= HandleWpfLostKeyboardFocus;
+ }
+
+ void HandleWpfLostKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
+ => Components.Commands.CommandManager.LastFocusedWpfElement = TextView.VisualElement;
+
+ public override void Dispose ()
+ {
+ base.Dispose ();
+ if (wpfTextViewHost != null) {
+ wpfTextViewHost.Close ();
+ wpfTextViewHost = null;
+ }
+ }
+
+ #region IZoomable
+
+ // the base TextViewContent impl of IZoomable doesn't work on Windows as it requires IEditorOperations4
+
+ const double MAX_ZOOM = 400.0;
+ const double MIN_ZOOM = 20.0;
+ const double DEFAULT_ZOOM = 100.0;
+
+ bool IsZoomable => TextView.Roles.Contains (PredefinedTextViewRoles.Zoomable);
+
+ public bool EnableZoomIn => IsZoomable && TextView.ZoomLevel < MAX_ZOOM;
+
+ public bool EnableZoomOut => IsZoomable && TextView.ZoomLevel < MIN_ZOOM;
+
+ public bool EnableZoomReset => IsZoomable && TextView.ZoomLevel != DEFAULT_ZOOM;
+
+ public void ZoomIn () => EditorOperations.ZoomIn ();
+
+ public void ZoomOut () => EditorOperations.ZoomOut ();
+
+ public void ZoomReset () => EditorOperations.ZoomTo (DEFAULT_ZOOM);
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewDisplayBinding.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewDisplayBinding.cs
new file mode 100644
index 0000000000..9a38354172
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewDisplayBinding.cs
@@ -0,0 +1,70 @@
+//
+// 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 System;
+using System.Reflection;
+using System.Windows;
+using System.Windows.Media;
+
+using Microsoft.VisualStudio.Text.Classification;
+
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.TextEditor
+{
+ class WpfTextViewDisplayBinding : TextViewDisplayBinding<WpfTextViewImports>
+ {
+ static WpfTextViewDisplayBinding ()
+ {
+ AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
+ }
+
+ private static Assembly OnAssemblyResolve (object sender, ResolveEventArgs args)
+ {
+ if (args.Name == "MonoDevelop.TextEditor.Wpf, Version=2.6.0, Culture=neutral") {
+ return typeof (WpfTextViewDisplayBinding).Assembly;
+ }
+
+ return null;
+ }
+
+ protected override ViewContent CreateContent (WpfTextViewImports imports, FilePath fileName, string mimeType, Project ownerProject)
+ {
+ return new WpfTextViewContent (imports, fileName, mimeType, ownerProject);
+ }
+
+ protected override ThemeToClassification CreateThemeToClassification (IEditorFormatMapService editorFormatMapService)
+ => new WpfThemeToClassification (editorFormatMapService);
+ }
+
+ class WpfThemeToClassification : ThemeToClassification
+ {
+ public WpfThemeToClassification (IEditorFormatMapService editorFormatMapService) : base (editorFormatMapService) { }
+
+ protected override void AddFontToDictionary (ResourceDictionary resourceDictionary, string fontName, double fontSize)
+ {
+ resourceDictionary[ClassificationFormatDefinition.TypefaceId] = new Typeface (fontName);
+ resourceDictionary[ClassificationFormatDefinition.FontRenderingSizeId] = fontSize * 96 / 72;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewImports.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewImports.cs
new file mode 100644
index 0000000000..c568e91ceb
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTextViewImports.cs
@@ -0,0 +1,33 @@
+//
+// 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 System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.TextEditor
+{
+ [Export]
+ class WpfTextViewImports : TextViewImports
+ {
+ [Import]
+ public ITextEditorFactoryService TextEditorFactoryService { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTipManagerCommandHandler.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTipManagerCommandHandler.cs
new file mode 100644
index 0000000000..3b5087c84f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/WpfTipManagerCommandHandler.cs
@@ -0,0 +1,69 @@
+//
+// 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 System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Commanding;
+using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.TextEditor
+{
+ [Name (nameof (WpfTipManagerCommandHandler))]
+ [ContentType ("text")]
+ [TextViewRole (PredefinedTextViewRoles.Interactive)]
+ [Export (typeof (ICommandHandler))]
+ [Order (Before = PredefinedCompletionNames.CompletionCommandHandler)]
+ sealed class WpfTipManagerCommandHandler :
+ ICommandHandler<EscapeKeyCommandArgs>
+ //FIXME: this is currently internal
+ //IDynamicCommandHandler<EscapeKeyCommandArgs>
+ {
+ #pragma warning disable 649 //field not assigned
+
+ [Import]
+ IObscuringTipManager obscuringTipManager;
+
+ #pragma warning restore 649
+
+ WpfObscuringTipManager cocoaTipManager;
+ WpfObscuringTipManager TipManager {
+ get {
+ if (cocoaTipManager == null) {
+ cocoaTipManager = (WpfObscuringTipManager)obscuringTipManager;
+ }
+ return cocoaTipManager;
+ }
+ }
+
+ string INamed.DisplayName => nameof (WpfTipManagerCommandHandler);
+
+ CommandState ICommandHandler<EscapeKeyCommandArgs>.GetCommandState (EscapeKeyCommandArgs args)
+ => TipManager.HasStack (args.TextView) ? CommandState.Available : CommandState.Unspecified;
+
+ //bool IDynamicCommandHandler<EscapeKeyCommandArgs>.CanExecuteCommand (EscapeKeyCommandArgs args)
+ // => TipManager.HasStack (args.TextView);
+
+ bool ICommandHandler<EscapeKeyCommandArgs>.ExecuteCommand (EscapeKeyCommandArgs args, CommandExecutionContext executionContext)
+ => TipManager.DismissTopOfStack (args.TextView);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandArgsFactories.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandArgsFactories.cs
new file mode 100644
index 0000000000..a56238809e
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandArgsFactories.cs
@@ -0,0 +1,33 @@
+//
+// 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 Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+
+namespace MonoDevelop.TextEditor
+{
+ static class CommandArgsFactories
+ {
+ public static RedoCommandArgs CreateRedoCommandArgs (ITextView v, ITextBuffer b) => new RedoCommandArgs (v, b);
+ public static UndoCommandArgs CreateUndoCommandArgs (ITextView v, ITextBuffer b) => new UndoCommandArgs (v, b);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappingExtensionNode.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappingExtensionNode.cs
new file mode 100644
index 0000000000..36fae84338
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappingExtensionNode.cs
@@ -0,0 +1,110 @@
+//
+// 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 System;
+using System.Reflection.Emit;
+using Microsoft.VisualStudio.Commanding;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Mono.Addins;
+
+namespace MonoDevelop.TextEditor
+{
+ class CommandMappingExtensionNode : TypeExtensionNode
+ {
+ [NodeAttribute ("argsType", Required = true, Description = "The fully qualified type of the EditorCommandArgs subclass")]
+ public string ArgsType { get; private set; }
+
+ MappedEditorCommand mappedCommand;
+
+ public MappedEditorCommand GetMappedCommand ()
+ {
+ return mappedCommand ?? (mappedCommand = CreateMappedCommand ());
+ }
+
+ MappedEditorCommand CreateMappedCommand ()
+ {
+ Type type;
+ Delegate factory;
+
+ // Hidden feature, if the first character of the type is @ it's really a static factory method
+ // and the actual type is determined from the method's return type.
+ // This is needed for Undo/Redo which have additional arguments in their ctors.
+ if (ArgsType[0] == '@') {
+ factory = GetDelegate (ArgsType, 1);
+ type = factory.Method.ReturnType;
+ } else {
+ type = Addin.GetType (ArgsType, true);
+ factory = CreateArgsFactory (type);
+ }
+
+ var mapType = typeof (MappedEditorCommand<>).MakeGenericType (type);
+ return (MappedEditorCommand) Activator.CreateInstance (mapType, factory);
+ }
+
+ Delegate GetDelegate (string fullName, int offset = 0)
+ {
+ var dotIdx = fullName.LastIndexOf ('.');
+ var factoryTypeName = fullName.Substring (offset, dotIdx - offset);
+ var factoryType = Addin.GetType (factoryTypeName, true);
+ var methodName = fullName.Substring (dotIdx + 1);
+ var methodInfo = factoryType.GetMethod (methodName);
+ return Delegate.CreateDelegate (typeof (Func<,,>).MakeGenericType (typeof (ITextView), typeof (ITextBuffer), methodInfo.ReturnType), methodInfo);
+ }
+
+ class MappedEditorCommand<T> : MappedEditorCommand
+ where T : EditorCommandArgs
+ {
+ Func<ITextView, ITextBuffer, T> factory;
+
+ public MappedEditorCommand (Func<ITextView, ITextBuffer, T> factory)
+ {
+ this.factory = factory;
+ }
+
+ public override void Execute (IEditorCommandHandlerService service, Action nextCommandHandler)
+ {
+ service.Execute (factory, nextCommandHandler);
+ }
+
+ public override CommandState GetCommandState (IEditorCommandHandlerService service, Func<CommandState> nextCommandHandler)
+ {
+ return service.GetCommandState (factory, nextCommandHandler);
+ }
+ }
+
+ Delegate CreateArgsFactory (Type type)
+ {
+ var constructorArgTypes = new Type[] { typeof (ITextView), typeof (ITextBuffer) };
+ var ctor = type.GetConstructor (constructorArgTypes);
+
+ var method = new DynamicMethod ($"Create{type.Name}", type, constructorArgTypes);
+ var il = method.GetILGenerator (8);
+ il.Emit (OpCodes.Ldarg_0);
+ il.Emit (OpCodes.Ldarg_1);
+ il.Emit (OpCodes.Newobj, ctor);
+ il.Emit (OpCodes.Ret);
+
+ return method.CreateDelegate (typeof (Func<,,>).MakeGenericType (typeof (ITextView), typeof (ITextBuffer), type));
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappings.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappings.cs
new file mode 100644
index 0000000000..807ed65678
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/CommandMappings.cs
@@ -0,0 +1,72 @@
+//
+// 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 System;
+using System.Collections.Immutable;
+using Microsoft.VisualStudio.Commanding;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Mono.Addins;
+
+namespace MonoDevelop.TextEditor
+{
+ class CommandMappings
+ {
+ public static CommandMappings Instance { get; } = new CommandMappings ();
+
+ ImmutableDictionary<string, CommandMappingExtensionNode> mappings = ImmutableDictionary<string, CommandMappingExtensionNode>.Empty;
+
+ CommandMappings ()
+ {
+ AddinManager.AddExtensionNodeHandler ("/MonoDevelop/TextEditor/CommandMapping", ExtensionChanged);
+ }
+
+ void ExtensionChanged (object sender, ExtensionNodeEventArgs args)
+ {
+ switch (args.Change) {
+ case ExtensionChange.Add:
+ mappings = mappings.SetItem (args.ExtensionNode.Id, (CommandMappingExtensionNode) args.ExtensionNode);
+ break;
+ case ExtensionChange.Remove:
+ mappings = mappings.Remove (args.ExtensionNode.Id);
+ break;
+ }
+ }
+
+ public MappedEditorCommand GetMapping (object commandId)
+ {
+ if (commandId is string s && mappings.TryGetValue (s, out var node)) {
+ return node.GetMappedCommand ();
+ }
+ return null;
+ }
+
+ internal bool HasMapping (object commandId)
+ {
+ return commandId is string s && mappings.ContainsKey (s);
+ }
+ }
+
+ abstract class MappedEditorCommand
+ {
+ public abstract void Execute (IEditorCommandHandlerService service, Action nextCommandHandler);
+ public abstract CommandState GetCommandState (IEditorCommandHandlerService service, Func<CommandState> nextCommandHandler);
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs
new file mode 100644
index 0000000000..51ce3ac224
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/EditorCommandHandlers.cs
@@ -0,0 +1,514 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Commanding;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Utilities;
+using MonoDevelop.Components.Extensions;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Desktop;
+using MonoDevelop.Ide.Editor;
+
+namespace MonoDevelop.TextEditor.Cocoa
+{
+ [Name("Standalone Editor command handlers")]
+ [ContentType("any")]
+ [Order(After = DefaultOrderings.Lowest)]
+ [Export(typeof(ICommandHandler))]
+ class EditorCommandHandlers :
+ ICommandHandler<BackspaceKeyCommandArgs>,
+ ICommandHandler<BackTabKeyCommandArgs>,
+ ICommandHandler<CutCommandArgs>,
+ ICommandHandler<CopyCommandArgs>,
+ ICommandHandler<DeleteKeyCommandArgs>,
+ ICommandHandler<DownKeyCommandArgs>,
+ ICommandHandler<EscapeKeyCommandArgs>,
+ ICommandHandler<InsertSnippetCommandArgs>,
+ ICommandHandler<LeftKeyCommandArgs>,
+ ICommandHandler<LineEndCommandArgs>,
+ ICommandHandler<LineEndExtendCommandArgs>,
+ ICommandHandler<LineStartCommandArgs>,
+ ICommandHandler<LineStartExtendCommandArgs>,
+ ICommandHandler<MoveSelectedLinesDownCommandArgs>,
+ ICommandHandler<MoveSelectedLinesUpCommandArgs>,
+ ICommandHandler<PageDownKeyCommandArgs>,
+ ICommandHandler<PageUpKeyCommandArgs>,
+ ICommandHandler<PasteCommandArgs>,
+ ICommandHandler<RedoCommandArgs>,
+ ICommandHandler<RenameCommandArgs>,
+ ICommandHandler<ReturnKeyCommandArgs>,
+ ICommandHandler<RightKeyCommandArgs>,
+ ICommandHandler<SaveCommandArgs>,
+ ICommandHandler<SelectAllCommandArgs>,
+ ICommandHandler<SurroundWithCommandArgs>,
+ ICommandHandler<TabKeyCommandArgs>,
+ ICommandHandler<ToggleCompletionModeCommandArgs>,
+ ICommandHandler<TypeCharCommandArgs>,
+ ICommandHandler<UndoCommandArgs>,
+ ICommandHandler<UpKeyCommandArgs>,
+ ICommandHandler<WordDeleteToEndCommandArgs>,
+ ICommandHandler<WordDeleteToStartCommandArgs>,
+ ICommandHandler<FindReferencesCommandArgs>
+#if !WINDOWS
+ ,
+ ICommandHandler<ProvideEditorFeedbackCommandArgs>,
+ ICommandHandler<DisableEditorPreviewCommandArgs>,
+ ICommandHandler<LearnAboutTheEditorCommandArgs>
+#endif
+ {
+ [Import]
+ private IEditorOperationsFactoryService OperationsService { get; set; }
+
+ [Import]
+ private ITextUndoHistoryRegistry _undoHistoryRegistry { get; set; }
+
+ string INamed.DisplayName => "Standalone Editor command handlers";
+
+ public IEditorOperations3 GetOperations (ITextView textView)
+ {
+ return (IEditorOperations3)OperationsService.GetEditorOperations(textView);
+ }
+
+ /// <summary>
+ /// Returns<see cref="CommandState.Available"/> if <paramref name = "textView" /> has <see cref="PredefinedTextViewRoles.Editable"/>
+ /// among <see cref="ITextView.Roles"/>, or <see cref="CommandState.Unavailable"/> otherwise.
+ /// </summary>
+ private static CommandState AvailableInEditableView(ITextView textView)
+ {
+ return textView.Roles.Contains(PredefinedTextViewRoles.Editable) ? CommandState.Available : CommandState.Unavailable;
+ }
+
+ bool ICommandHandler<ReturnKeyCommandArgs>.ExecuteCommand(ReturnKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).InsertNewLine();
+ return true;
+ }
+
+ CommandState ICommandHandler<ReturnKeyCommandArgs>.GetCommandState(ReturnKeyCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs args, CommandExecutionContext executionContext)
+ {
+ if (args.TypedChar == '\0')
+ return false;
+
+ GetOperations(args.TextView).InsertText(args.TypedChar.ToString());
+ return true;
+ }
+
+ CommandState ICommandHandler<TypeCharCommandArgs>.GetCommandState(TypeCharCommandArgs args)
+ {
+ return args.TypedChar == '\0' ? CommandState.Unavailable : AvailableInEditableView(args.TextView);
+ }
+
+ CommandState ICommandHandler<BackspaceKeyCommandArgs>.GetCommandState(BackspaceKeyCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<BackspaceKeyCommandArgs>.ExecuteCommand(BackspaceKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).Backspace();
+ return true;
+ }
+
+ CommandState ICommandHandler<BackTabKeyCommandArgs>.GetCommandState(BackTabKeyCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<BackTabKeyCommandArgs>.ExecuteCommand(BackTabKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).Unindent();
+ return true;
+ }
+
+ CommandState ICommandHandler<CutCommandArgs>.GetCommandState(CutCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<CutCommandArgs>.ExecuteCommand(CutCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).CutSelection();
+ return true;
+ }
+
+ CommandState ICommandHandler<CopyCommandArgs>.GetCommandState(CopyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<CopyCommandArgs>.ExecuteCommand(CopyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).CopySelection();
+ return true;
+ }
+
+ CommandState ICommandHandler<DeleteKeyCommandArgs>.GetCommandState(DeleteKeyCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<DeleteKeyCommandArgs>.ExecuteCommand(DeleteKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).Delete();
+ return true;
+ }
+
+ CommandState ICommandHandler<DownKeyCommandArgs>.GetCommandState(DownKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<DownKeyCommandArgs>.ExecuteCommand(DownKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveLineDown(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<EscapeKeyCommandArgs>.GetCommandState(EscapeKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<EscapeKeyCommandArgs>.ExecuteCommand(EscapeKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).ResetSelection();
+ return true;
+ }
+
+ CommandState ICommandHandler<InsertSnippetCommandArgs>.GetCommandState(InsertSnippetCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<InsertSnippetCommandArgs>.ExecuteCommand(InsertSnippetCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ CommandState ICommandHandler<LeftKeyCommandArgs>.GetCommandState(LeftKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<LeftKeyCommandArgs>.ExecuteCommand(LeftKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToPreviousCharacter(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<LineEndCommandArgs>.GetCommandState(LineEndCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<LineEndCommandArgs>.ExecuteCommand(LineEndCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToEndOfLine(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<LineEndExtendCommandArgs>.GetCommandState(LineEndExtendCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<LineEndExtendCommandArgs>.ExecuteCommand(LineEndExtendCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToEndOfLine(extendSelection: true);
+ return true;
+ }
+
+ CommandState ICommandHandler<LineStartCommandArgs>.GetCommandState(LineStartCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<LineStartCommandArgs>.ExecuteCommand(LineStartCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToHome(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<LineStartExtendCommandArgs>.GetCommandState(LineStartExtendCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<LineStartExtendCommandArgs>.ExecuteCommand(LineStartExtendCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToStartOfLine(extendSelection: true);
+ return true;
+ }
+
+ CommandState ICommandHandler<MoveSelectedLinesDownCommandArgs>.GetCommandState(MoveSelectedLinesDownCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<MoveSelectedLinesDownCommandArgs>.ExecuteCommand(MoveSelectedLinesDownCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations (args.TextView).MoveSelectedLinesDown ();
+ return true;
+ }
+
+ CommandState ICommandHandler<MoveSelectedLinesUpCommandArgs>.GetCommandState(MoveSelectedLinesUpCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<MoveSelectedLinesUpCommandArgs>.ExecuteCommand(MoveSelectedLinesUpCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations (args.TextView).MoveSelectedLinesUp ();
+ return true;
+ }
+
+ CommandState ICommandHandler<PageDownKeyCommandArgs>.GetCommandState(PageDownKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<PageDownKeyCommandArgs>.ExecuteCommand(PageDownKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).PageDown(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<PageUpKeyCommandArgs>.GetCommandState(PageUpKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<PageUpKeyCommandArgs>.ExecuteCommand(PageUpKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).PageUp(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<PasteCommandArgs>.GetCommandState(PasteCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<PasteCommandArgs>.ExecuteCommand(PasteCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).Paste();
+ return true;
+ }
+
+ CommandState ICommandHandler<RedoCommandArgs>.GetCommandState(RedoCommandArgs args)
+ {
+ return GetUndoHistory(args.TextView).CanRedo ? CommandState.Available : CommandState.Unavailable;
+ }
+
+ bool ICommandHandler<RedoCommandArgs>.ExecuteCommand(RedoCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetUndoHistory(args.TextView).Redo(args.Count);
+ return true;
+ }
+
+ CommandState ICommandHandler<RenameCommandArgs>.GetCommandState(RenameCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<RenameCommandArgs>.ExecuteCommand(RenameCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ CommandState ICommandHandler<FindReferencesCommandArgs>.GetCommandState (FindReferencesCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<FindReferencesCommandArgs>.ExecuteCommand (FindReferencesCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ CommandState ICommandHandler<RightKeyCommandArgs>.GetCommandState(RightKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<RightKeyCommandArgs>.ExecuteCommand(RightKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveToNextCharacter(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<SaveCommandArgs>.GetCommandState(SaveCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<SaveCommandArgs>.ExecuteCommand(SaveCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ CommandState ICommandHandler<SelectAllCommandArgs>.GetCommandState(SelectAllCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<SelectAllCommandArgs>.ExecuteCommand(SelectAllCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).SelectAll();
+ return true;
+ }
+
+ CommandState ICommandHandler<SurroundWithCommandArgs>.GetCommandState(SurroundWithCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<SurroundWithCommandArgs>.ExecuteCommand(SurroundWithCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ CommandState ICommandHandler<TabKeyCommandArgs>.GetCommandState(TabKeyCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<TabKeyCommandArgs>.ExecuteCommand(TabKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).Indent();
+ return true;
+ }
+
+ CommandState ICommandHandler<ToggleCompletionModeCommandArgs>.GetCommandState(ToggleCompletionModeCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<ToggleCompletionModeCommandArgs>.ExecuteCommand(ToggleCompletionModeCommandArgs args, CommandExecutionContext executionContext)
+ {
+ // Do nothing. We merely enable others to call this command
+ return true;
+ }
+
+ private ITextUndoHistory GetUndoHistory(ITextView textView)
+ {
+ return _undoHistoryRegistry.GetHistory(textView.TextBuffer);
+ }
+
+ CommandState ICommandHandler<UndoCommandArgs>.GetCommandState(UndoCommandArgs args)
+ {
+ return GetUndoHistory(args.TextView).CanUndo ? CommandState.Available : CommandState.Unavailable;
+ }
+
+ bool ICommandHandler<UndoCommandArgs>.ExecuteCommand(UndoCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetUndoHistory(args.TextView).Undo(args.Count);
+ return true;
+ }
+
+ CommandState ICommandHandler<UpKeyCommandArgs>.GetCommandState(UpKeyCommandArgs args)
+ {
+ return CommandState.Available;
+ }
+
+ bool ICommandHandler<UpKeyCommandArgs>.ExecuteCommand(UpKeyCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).MoveLineUp(extendSelection: false);
+ return true;
+ }
+
+ CommandState ICommandHandler<WordDeleteToEndCommandArgs>.GetCommandState(WordDeleteToEndCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<WordDeleteToEndCommandArgs>.ExecuteCommand(WordDeleteToEndCommandArgs args, CommandExecutionContext executionContext)
+ {
+ GetOperations(args.TextView).DeleteToEndOfLine();
+ return true;
+ }
+
+ CommandState ICommandHandler<WordDeleteToStartCommandArgs>.GetCommandState(WordDeleteToStartCommandArgs args)
+ {
+ return AvailableInEditableView(args.TextView);
+ }
+
+ bool ICommandHandler<WordDeleteToStartCommandArgs>.ExecuteCommand(WordDeleteToStartCommandArgs args, CommandExecutionContext executionContext)
+ {
+ 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)
+ {
+ 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)
+ {
+ 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/Extensions/EditorContentProviderService.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/EditorContentProviderService.cs
new file mode 100644
index 0000000000..b7fbdace82
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/EditorContentProviderService.cs
@@ -0,0 +1,55 @@
+//
+// 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 System;
+using System.Linq;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.TextEditor
+{
+ [Export (typeof (EditorContentProviderService))]
+ sealed class EditorContentProviderService
+ {
+ [ImportMany (typeof (IEditorContentProvider))]
+ internal List<Lazy<IEditorContentProvider, IEditorContentProviderMetadata>> EditorContentProviders { get; set; }
+
+ public IEnumerable<IEditorContentProvider> GetContentProvidersForView (ITextView textView)
+ {
+ Func<string, bool> contentTypeMatch = textView.TextBuffer.ContentType.IsOfType;
+
+ foreach (var provider in EditorContentProviders) {
+ var meta = provider.Metadata;
+
+ if (meta.TextViewRoles != null && !textView.Roles.ContainsAny (meta.TextViewRoles)) {
+ continue;
+ }
+
+ if (!meta.ContentTypes.Any (contentTypeMatch)) {
+ continue;
+ }
+
+ yield return provider.Value;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/IEditorContentProvider.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/IEditorContentProvider.cs
new file mode 100644
index 0000000000..baf155bbf3
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Extensions/IEditorContentProvider.cs
@@ -0,0 +1,98 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Utilities;
+
+namespace MonoDevelop.TextEditor
+{
+ /// <summary>
+ /// MEF extension point to provide implementations of content interfaces on the text
+ /// editor.
+ /// </summary>
+ /// <remarks>
+ /// Implementations should be exported with [Export(IEditorContentProvider)] and
+ /// should specify an <see cref="OrderAttribute"/>, at least one <see cref="ContentTypeAttribute"/>, and
+ /// optionally one or more <see cref="TextViewRoleAttribute"/>s.
+ /// </remarks>
+ public interface IEditorContentProvider
+ {
+ /// <summary>
+ /// Gets an instance of the content interface <paramref name="type"/> for the <paramref name="view"/>.
+ /// </summary>
+ object GetContent (ITextView view, Type type);
+
+ /// <summary>
+ /// Gets multiple instance of the content interface <paramref name="type"/> for the <paramref name="view"/>.
+ /// </summary>
+ IEnumerable<object> GetContents (ITextView view, Type type);
+ }
+
+ /// <summary>
+ /// Metadata interface for <see cref="IEditorContentProvider" /> providers
+ /// </summary>
+ public interface IEditorContentProviderMetadata : INamedContentTypeMetadata
+ {
+ [DefaultValue (null)]
+ IEnumerable<string> TextViewRoles { get; }
+ }
+
+ /// <summary>
+ /// Base IEditorContentProvider implementation that lazily creates a content instance
+ /// for a <see cref="TextView"/>.
+ /// </summary>
+ /// <remarks>
+ /// If the content instance is <see cref="IDisposable"/>, it will be disposed when the view is closed.
+ /// </remarks>
+ public abstract class EditorContentInstanceProvider<T> : IEditorContentProvider
+ {
+ readonly Type extType = typeof (T);
+
+ public object GetContent (ITextView view, Type type)
+ {
+ if (!type.IsAssignableFrom (extType)) {
+ return null;
+ }
+ if (view.Properties.TryGetProperty<T> (extType, out var prop)) {
+ return prop;
+ }
+ prop = CreateInstance (view);
+ view.Properties.AddProperty (extType, prop);
+ if (prop is IDisposable disposable) {
+ view.Closed += (s, e) => disposable.Dispose ();
+ }
+ return prop;
+ }
+
+ protected abstract T CreateInstance (ITextView view);
+
+ public IEnumerable<object> GetContents (ITextView view, Type type)
+ {
+ var content = GetContent (view, type);
+ if (content != null) {
+ yield return content;
+ }
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/MonoDevelop.TextEditor.csproj b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/MonoDevelop.TextEditor.csproj
new file mode 100644
index 0000000000..30e59d1313
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/MonoDevelop.TextEditor.csproj
@@ -0,0 +1,28 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <Import Project="..\..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesVSEditor)" />
+ <Import Project="$(ReferencesGtk)" />
+ <PropertyGroup>
+ <AssemblyTitle>MonoDevelop Text Editor</AssemblyTitle>
+ <AssemblyDescription>Integrates the Visual Studio Editor into MonoDevelop</AssemblyDescription>
+ <AddinBuildDir>DisplayBindings\TextEditor</AddinBuildDir>
+ <AddMonoDevelopCoreReferences>true</AddMonoDevelopCoreReferences>
+ <DefineConstants Condition="$(OS) == 'Windows_NT'">$(DefineConstants);WINDOWS;WIN32</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\Find\Find.csproj" />
+ <ProjectReference Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Def\InfoBar\InfoBar.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <InternalsVisibleTo Include="MonoDevelop.TextEditor.Cocoa" />
+ <InternalsVisibleTo Include="MonoDevelop.TextEditor.Wpf" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="PresentationCore" />
+ <ProjectReference Include="..\..\MonoDevelop.DesignerSupport\MonoDevelop.DesignerSupport.csproj" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Impl\BaseViewImpl\VacuousTextDataModel.cs" Link="Util\VacuousTextDataModel.cs" />
+ <Compile Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\UIExtensionSelector.cs" Link="Util\UIExtensionSelector.cs" />
+ <Compile Include="..\..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\VacuousTextViewModel.cs" Link="Util\VacuousTextViewModel.cs" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/AddinInfo.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/AddinInfo.cs
new file mode 100644
index 0000000000..ed26dbba46
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/AddinInfo.cs
@@ -0,0 +1,37 @@
+//
+// 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 System;
+using Mono.Addins;
+using Mono.Addins.Description;
+
+[assembly:Addin ("TextEditor",
+ Namespace = "MonoDevelop",
+ Version = MonoDevelop.BuildInfo.Version,
+ Category = "MonoDevelop Core")]
+
+[assembly:AddinName ("MonoDevelop Text Editor")]
+[assembly:AddinDescription ("Integrates the Visual Studio text editor")]
+[assembly: AddinFlags (AddinFlags.Hidden)]
+
+[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
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
new file mode 100644
index 0000000000..a3a0e4f747
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/Properties/MonoDevelop.TextEditor.addin.xml
@@ -0,0 +1,272 @@
+<ExtensionModel>
+ <!-- Extension points -->
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/ContextMenu/Editor" name = "Editor context menu">
+ <Description>Context menu for the editor.</Description>;
+ <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet" />
+ <ConditionType id="FileType" type="MonoDevelop.Ide.Extensions.FileTypeCondition">
+ <Description>Type of the file being edited.</Description>
+ </ConditionType>
+ </ExtensionPoint>
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/CommandMapping" name = "Maps MonoDevelop commands to Visual Studio EditorCommandArgs types">
+ <Description>Context menu for the navigation bar.</Description>
+ <ExtensionNode name="Map" type="MonoDevelop.TextEditor.CommandMappingExtensionNode" />
+ </ExtensionPoint>
+<!--
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/ContextMenu/NavigationBar" name = "Navigation bar context menu">
+ <Description>Context menu for the navigation bar.</Description>
+ <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet" />
+ </ExtensionPoint>
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/ContextMenu/Scrollbar" name = "Scroll bar context menu">
+ <Description>Context menu for the navigation bar.</Description>
+ <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet" />
+ </ExtensionPoint>
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/IconContextMenu/Editor" name = "Editor context menu">
+ <Description>Context menu for the editor's icon margin.</Description>
+ <ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet" />
+ <ConditionType id="FileType" type="MonoDevelop.Ide.Extensions.FileTypeCondition">
+ <Description>Type of the file being edited.</Description>
+ </ConditionType>
+ </ExtensionPoint>
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/EditActions" name = "Custom edit actions">
+ <Description>Custom edit actions for the editor.</Description>
+ <ExtensionNode name="EditAction" type="MonoDevelop.SourceEditor.Codons.EditActionCodon"/>
+ </ExtensionPoint>
+
+ <ExtensionPoint path = "/MonoDevelop/TextEditor/Formatters" name = "Formatters">
+ <Description>Custom edit actions for the editor.</Description>
+ <ExtensionNode name="Class" />
+ </ExtensionPoint>
+
+ --><!-- Extensions -->
+
+ <Extension path="/MonoDevelop/Ide/Composition">
+ <!--
+ <Assembly file="../../../bin/Microsoft.CodeAnalysis.EditorFeatures.Wpf.dll"/>
+ <Assembly file="../../../bin/Microsoft.VisualStudio.Platform.VSEditor.dll"/>
+ -->
+ <Assembly file="MonoDevelop.TextEditor.dll"/>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/TextEditor/CommandMapping">
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Copy" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.CopyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Cut" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.CutCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Paste" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.PasteCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Rename" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.RenameCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Undo" argsType="@MonoDevelop.TextEditor.CommandArgsFactories.CreateUndoCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Redo" argsType="@MonoDevelop.TextEditor.CommandArgsFactories.CreateRedoCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.SelectAll" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.SelectAllCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.AddCodeComment" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.CommentSelectionCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.RemoveCodeComment" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.UncommentSelectionCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.ToggleCommentSelectionCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.InsertTab" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.TabKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.RemoveTab" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.BackTabKeyCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.LineEnd" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.LineEndCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.LineStart" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.LineStartCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.CharLeft" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.LeftKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.CharRight" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.RightKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.LineUp" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.UpKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.LineDown" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DownKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.PageUp" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.PageUpKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.PageDown" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.PageDownKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.DocumentStart" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DocumentStartCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.DocumentEnd" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DocumentEndCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.MoveBlockUp" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.MoveSelectedLinesUpCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.MoveBlockDown" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.MoveSelectedLinesDownCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.DeleteLeftChar" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.BackspaceKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.Delete" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DeleteKeyCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.EditCommands.DeleteRightChar" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.DeleteKeyCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.ShowCompletionWindow" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.InvokeCompletionListCommandArgs" />
+ <Map id="MonoDevelop.Ide.Commands.TextEditorCommands.ShowParameterCompletionWindow" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.InvokeSignatureHelpCommandArgs" />
+
+ <Map id="MonoDevelop.Refactoring.RefactoryCommands.QuickFix" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.InvokeQuickFixCommandArgs" />
+
+ <Map id="MonoDevelop.CSharp.Highlighting.MoveToUsagesCommand.NextUsage" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.NavigateToNextHighlightedReferenceCommandArgs" />
+ <Map id="MonoDevelop.CSharp.Highlighting.MoveToUsagesCommand.PrevUsage" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.NavigateToPreviousHighlightedReferenceCommandArgs" />
+
+ <Map id="MonoDevelop.Ide.CodeFormatting.CodeFormattingCommands.FormatBuffer" argsType="Microsoft.VisualStudio.Text.Editor.Commanding.Commands.FormatDocumentCommandArgs" />
+ </Extension>
+
+ <!--
+ <Extension path = "/MonoDevelop/Ide/Editor/TooltipProviders">
+ <Provider id="Debug" class="MonoDevelop.SourceEditor.DebugValueTooltipProvider" />
+ <Provider id="CompileError" class="MonoDevelop.SourceEditor.CompileErrorTooltipProvider" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Commands">
+ <Command id = "MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations"
+ defaultHandler = "MonoDevelop.SourceEditor.MarkerOperationsHandler"
+ _label = "MarkerOperations"
+ type = "array"/>
+ <Category _name = "Code Navigation" id = "CodeNavigation">
+ <Command id = "MonoDevelop.SourceEditor.SourceEditorCommands.NextIssue"
+ _label = "Next Issue in File"
+ shortcut = "Alt|Page_Down"
+ macShortcut = "Alt|Page_Down"
+ />
+ <Command id = "MonoDevelop.SourceEditor.SourceEditorCommands.PrevIssue"
+ _label = "Previous Issue in File"
+ shortcut = "Alt|Page_Up"
+ macShortcut = "Alt|Page_Up"
+ />
+ <Command id = "MonoDevelop.SourceEditor.SourceEditorCommands.NextIssueError"
+ _label = "Next Error"
+ shortcut = "Alt|Shift|Page_Down"
+ macShortcut = "Alt|Shift|Page_Down Shift|Meta|F12"
+ />
+ <Command id = "MonoDevelop.SourceEditor.SourceEditorCommands.PrevIssueError"
+ _label = "Previous Error"
+ shortcut = "Alt|Shift|Page_Up"
+ macShortcut = "Alt|Shift|Page_Up"
+ />
+ </Category>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Commands/Hidden">
+ <Command id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.Top"
+ _label = "_Top"/>
+ <Command id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.Bottom"
+ _label = "_Bottom"/>
+ <Command id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.PgUp"
+ _label = "_Page Up"/>
+ <Command id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.PgDown"
+ _label = "P_age Down"/>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Commands/TextEditor">
+ <Command id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.ShowMinimap"
+ _label = "Show _Minimap"
+ type = "check"/>
+ </Extension>
+-->
+ <!-- this is the old menu -->
+ <!--
+ <Extension path = "/MonoDevelop/TextEditor/ContextMenu/Editor">
+ <CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ExpressionEvaluator" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.RunToCursor" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.SetNextStatement" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowNextStatement" />
+ <SeparatorItem id = "Separator2" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Paste" />
+ <SeparatorItem id = "Separator3" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.IndentSelection" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.UnIndentSelection" />
+ <SeparatorItem id = "Separator4" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.TextEditorCommands.ShowCodeSurroundingsWindow" _label = "Surround With..." />
+ <CommandItem id = "MonoDevelop.Ide.Commands.TextEditorCommands.ShowCodeTemplateWindow" _label = "Insert Template..." />
+ <SeparatorItem id = "Separator5" />
+ </Extension>
+-->
+
+ <!-- temporary, need to align with old menu -->
+ <Extension path = "/MonoDevelop/TextEditor/ContextMenu/Editor">
+ <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.QuickFix" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Rename" />
+ <CommandItem id = "MonoDevelop.CSharp.Refactoring.Commands.SortAndRemoveImports" />
+ <SeparatorItem id = "Separator0" />
+ <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.GotoDeclaration" />
+ <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.GotoImplementation" />
+ <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.FindReferences" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Cut" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Copy" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Paste" />
+ <SeparatorItem id = "Separator2" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.ToggleCodeComment" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.IndentSelection" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.UnIndentSelection" />
+ <SeparatorItem id = "Separator3" />
+ </Extension>
+<!--
+ <Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/Scrollbar">
+ <CommandItem id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.Top" />
+ <CommandItem id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.Bottom" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.PgUp" />
+ <CommandItem id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.PgDown" />
+ <SeparatorItem id = "Separator2" />
+ <CommandItem id = "MonoDevelop.SourceEditor.QuickTasks.ScrollbarCommand.ShowMinimap" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/NavigationBar">
+ <CommandItem id = "MonoDevelop.SourceEditor.NavigationBarCommands.ToggleNavPanelViews" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/SourceEditor2/IconContextMenu/Editor">
+ <CommandItem id = "MonoDevelop.Ide.Editor.MessageBubbleCommands.Toggle" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ToggleBreakpoint" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.ToggleBookmark" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewBreakpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowBreakpointProperties" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.EnableDisableBreakpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.DisableAllBreakpoints" />
+ <SeparatorItem id = "Separator1" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.RemoveBreakpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ClearAllBreakpoints" />
+ <CommandItem id = "MonoDevelop.Ide.Commands.SearchCommands.ClearBookmarks" />
+ </Extension>
+
+ <Extension path="/MonoDevelop/Ide/GlobalOptionsDialog/TextEditor">
+ <Section id="General" insertbefore="Formatting" _label="General" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.GeneralOptionsPanel" icon="md-prefs-text-editor-general" />
+ <Section id="Markers" _label="Markers and Rulers" class="MonoDevelop.SourceEditor.OptionPanels.MarkerPanel" icon="md-prefs-markers-rulers" />
+ <Section id="Behavior" _label="Behavior" class="MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel" icon="md-prefs-text-editor-behavior" />
+ <Section id="CodeCompletion" _label="IntelliSense" icon="md-prefs-completion">
+ <Panel id="CompletionBehavior" _label="Behavior" class="MonoDevelop.SourceEditor.OptionPanels.CompletionOptionsPanel" icon="md-prefs-completion" />
+ --><!-- <Section id="CompletionCharacters" _label="Completion Characters" class="MonoDevelop.SourceEditor.OptionPanels.CompletionCharactersPanel" /> --><!--
+ <Panel id="CompletionAppearance" _label="Appearance" class="MonoDevelop.SourceEditor.OptionPanels.CompletionAppearancePanel" icon="md-prefs-completion" />
+ </Section>
+ <Section id="SyntaxHighlighting" _label="Color Theme" fill="true" class="MonoDevelop.SourceEditor.OptionPanels.HighlightingPanel" icon="md-prefs-syntax-highlighting" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/MainMenu/Search">
+ <ItemSet id = "Inspect" _label = "Inspect" insertafter="MonoDevelop.Ide.Commands.ViewCommands.ShowNext" insertbefore="Separator3">
+ <CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.PrevIssueError" />
+ <CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.NextIssueError" />
+ <SeparatorItem id = "InspectIssueSeparator" />
+ <CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.PrevIssue" />
+ <CommandItem id = "MonoDevelop.SourceEditor.SourceEditorCommands.NextIssue" />
+ </ItemSet>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/Editor/EditorFactory">
+ <Class id = "SourceEditor" class="MonoDevelop.SourceEditor.EditorFactory" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Ide/AutoInsertBracketHandler">
+ <Handler id = "Default" class="MonoDevelop.SourceEditor.DefaultAutoInsertBracketHandler" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Core/UserDataMigration">
+ --><!-- 2.4 --><!--
+ <Migration sourceVersion="2.4" kind="UserData" path="syntaxmodes" targetPath="HighlightingSchemes" isDirectory="true" />
+ --><!-- 2.6+ --><!--
+ <Migration sourceVersion="2.6+" kind="UserData" path="HighlightingSchemes" isDirectory="true" />
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Core/StockIcons">
+ <StockIcon stockid="md-prefs-markers-rulers" resource="prefs-markers-rulers-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-syntax-highlighting" resource="prefs-syntax-highlighting-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-text-editor-general" resource="prefs-text-editor-general-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-text-editor-behavior" resource="prefs-text-editor-behavior-16.png" size="Menu" />
+ <StockIcon stockid="md-prefs-completion" resource="prefs-completion-16.png" size="Menu" />
+ </Extension>
+
+-->
+</ExtensionModel>
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs
new file mode 100644
index 0000000000..268db9bb2f
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.Commands.cs
@@ -0,0 +1,265 @@
+//
+// 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 System;
+using System.Collections.Generic;
+
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Operations;
+
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Ide.Commands;
+
+#if WINDOWS
+using EditorOperationsInterface = Microsoft.VisualStudio.Text.Operations.IEditorOperations3;
+#else
+using EditorOperationsInterface = Microsoft.VisualStudio.Text.Operations.IEditorOperations4;
+#endif
+
+namespace MonoDevelop.TextEditor
+{
+ partial class TextViewContent<TView, TImports>
+ {
+ #region IEditorOperations Command Mapping
+
+ protected readonly struct EditorOperationCommand
+ {
+ public readonly Action<EditorOperationsInterface> Execute;
+ public readonly Action<EditorOperationsInterface, CommandInfo> Update;
+
+ public EditorOperationCommand (
+ Action<EditorOperationsInterface> execute,
+ Action<EditorOperationsInterface, CommandInfo> update = null)
+ {
+ Execute = execute;
+ Update = update;
+ }
+ }
+
+ protected sealed class EditorOperationsMap : Dictionary<object, EditorOperationCommand>
+ {
+ public new Action<EditorOperationsInterface> this[object id] {
+ get => base[id].Execute;
+ set => base[CommandManager.ToCommandId (id)] = new EditorOperationCommand (value);
+ }
+
+ public new void Add (object id, EditorOperationCommand command)
+ => base[CommandManager.ToCommandId (id)] = command;
+ }
+
+ protected readonly EditorOperationsMap EditorOperationCommands = new EditorOperationsMap {
+ [TextEditorCommands.ScrollLineUp] = op => op.ScrollUpAndMoveCaretIfNecessary (),
+ [TextEditorCommands.ScrollLineDown] = op => op.ScrollDownAndMoveCaretIfNecessary (),
+ [TextEditorCommands.ScrollPageUp] = op => op.ScrollPageUp (),
+ [TextEditorCommands.ScrollPageDown] = op => op.ScrollPageDown (),
+ [TextEditorCommands.ScrollTop] = op => op.ScrollLineTop (),
+ [TextEditorCommands.ScrollBottom] = op => op.ScrollLineBottom (),
+
+ [TextEditorCommands.InsertNewLine] = op => op.InsertNewLine (),
+ [TextEditorCommands.InsertNewLineAtEnd] = op => op.InsertFinalNewLine (),
+ [TextEditorCommands.InsertNewLinePreserveCaretPosition] = op => op.OpenLineAbove (),
+
+ [TextEditorCommands.TransposeCharacters] = op => op.TransposeCharacter (),
+ [TextEditorCommands.DuplicateLine] = op => op.DuplicateSelection (),
+
+ [TextEditorCommands.DeleteLine] = op => op.DeleteFullLine (),
+ [TextEditorCommands.DeleteToLineStart] = op => op.DeleteToBeginningOfLine (),
+ [TextEditorCommands.DeleteToLineEnd] = op => op.DeleteToEndOfLine (),
+ [TextEditorCommands.DeletePrevWord] = op => op.DeleteWordToLeft (),
+ [TextEditorCommands.DeleteNextWord] = op => op.DeleteWordToRight (),
+
+ [TextEditorCommands.MovePrevWord] = op => op.MoveToPreviousWord (extendSelection: false),
+ [TextEditorCommands.MoveNextWord] = op => op.MoveToNextWord (extendSelection: false),
+
+ [TextEditorCommands.ExpandSelection] = op => op.SelectEnclosing (),
+ [TextEditorCommands.ExpandSelectionToLine] = op => op.MoveToEndOfLine (extendSelection: true),
+
+ [TextEditorCommands.SelectionMoveLeft] = op => op.MoveToPreviousCharacter (extendSelection: true),
+ [TextEditorCommands.SelectionMoveRight] = op => op.MoveToNextCharacter (extendSelection: true),
+ [TextEditorCommands.SelectionMovePrevWord] = op => op.MoveToPreviousWord (extendSelection: true),
+ [TextEditorCommands.SelectionMoveNextWord] = op => op.MoveToNextWord (extendSelection: true),
+ [TextEditorCommands.SelectionMoveUp] = op => op.MoveLineUp (extendSelection: true),
+ [TextEditorCommands.SelectionMoveDown] = op => op.MoveLineDown (extendSelection: true),
+ [TextEditorCommands.SelectionMoveHome] = op => op.MoveToHome (extendSelection: true),
+ [TextEditorCommands.SelectionMoveEnd] = op => op.MoveToEndOfLine (extendSelection: true),
+ [TextEditorCommands.SelectionMoveToDocumentStart] = op => op.MoveToStartOfDocument (extendSelection: true),
+ [TextEditorCommands.SelectionMoveToDocumentEnd] = op => op.MoveToEndOfDocument (extendSelection: true),
+ [TextEditorCommands.SelectionPageUpAction] = op => op.PageUp (extendSelection: true),
+ [TextEditorCommands.SelectionPageDownAction] = op => op.PageDown (extendSelection: true),
+
+ [TextEditorCommands.RecenterEditor] = op => op.ScrollLineCenter (),
+
+ [EditCommands.InsertGuid] = op => op.InsertText (Guid.NewGuid ().ToString ()),
+ [EditCommands.IndentSelection] = op => op.IncreaseLineIndent (),
+ [EditCommands.UnIndentSelection] = op => op.DecreaseLineIndent (),
+ [EditCommands.UppercaseSelection] = op => op.MakeUppercase (),
+ [EditCommands.LowercaseSelection] = op => op.MakeLowercase (),
+ [EditCommands.RemoveTrailingWhiteSpaces] = op => op.TrimTrailingWhiteSpace (),
+
+ [ViewCommands.CenterAndFocusCurrentDocument] = op => op.ScrollLineCenter ()
+ };
+
+ protected virtual void InstallAdditionalEditorOperationsCommands ()
+ {
+ EditorOperationCommands[TextEditorCommands.SwitchCaretMode] = op => {
+ var overWriteMode = EditorOptions.GetOptionValue (DefaultTextViewOptions.OverwriteModeId);
+ EditorOptions.SetOptionValue (DefaultTextViewOptions.OverwriteModeId, !overWriteMode);
+ };
+ }
+
+ #endregion
+
+ #region Command Mapping Handlers
+
+ // FIXME: this is a hack to explicitly support a few commands when the find/replace view
+ // has focus. Longer term we need to improve the MD<->VS commanding to handle this without
+ // explicit context checks. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/821862
+ static readonly HashSet<object> commandsSupportedWhenFindPresenterIsFocused = new HashSet<object> {
+ CommandManager.ToCommandId (SearchCommands.Find),
+ CommandManager.ToCommandId (SearchCommands.Replace),
+ CommandManager.ToCommandId (SearchCommands.FindNext),
+ CommandManager.ToCommandId (SearchCommands.FindPrevious),
+ CommandManager.ToCommandId (SearchCommands.FindNextSelection),
+ CommandManager.ToCommandId (SearchCommands.FindPrevious)
+ };
+
+ bool CanHandleCommand (object commandId)
+ {
+ var findPresenter = Imports.FindPresenterFactory?.TryGetFindPresenter (TextView);
+ if (findPresenter != null && findPresenter.IsFocused)
+ return commandsSupportedWhenFindPresenterIsFocused.Contains (commandId);
+
+ return true;
+ }
+
+ ICommandHandler ICustomCommandTarget.GetCommandHandler (object commandId)
+ {
+ if (!CanHandleCommand (commandId))
+ return null;
+
+ if (CommandMappings.Instance.HasMapping (commandId) || EditorOperationCommands.ContainsKey (commandId))
+ return this;
+
+ return null;
+ }
+
+ ICommandUpdater ICustomCommandTarget.GetCommandUpdater (object commandId)
+ {
+ if (!CanHandleCommand (commandId))
+ return null;
+
+ if (CommandMappings.Instance.HasMapping (commandId) ||
+ (EditorOperationCommands.TryGetValue (commandId, out var editorOperationCommand) &&
+ editorOperationCommand.Update != null))
+ return this;
+
+ return null;
+ }
+
+ void ICommandHandler.Run (object cmdTarget, Command cmd)
+ {
+ var mapping = CommandMappings.Instance.GetMapping (cmd.Id);
+ if (mapping != null)
+ mapping.Execute (commandService, null);
+ else if (EditorOperationCommands.TryGetValue (cmd.Id, out var editorOperationCommand) &&
+ editorOperationCommand.Execute != null)
+ editorOperationCommand.Execute (EditorOperations);
+ }
+
+ void ICommandHandler.Run (object cmdTarget, Command cmd, object dataItem)
+ => throw new InvalidOperationException ("Array commands cannot be mapped to editor commands");
+
+ void ICommandUpdater.Run (object cmdTarget, CommandInfo info)
+ {
+ var mapping = CommandMappings.Instance.GetMapping (info.Command.Id);
+ if (mapping != null) {
+ var commandState = mapping.GetCommandState (commandService, null);
+ info.Enabled = commandState.IsAvailable;
+ info.Visible = !commandState.IsUnspecified;
+ info.Checked = commandState.IsChecked;
+ } else if (EditorOperationCommands.TryGetValue (info.Command.Id, out var editorOperationCommand) &&
+ editorOperationCommand.Update != null)
+ editorOperationCommand.Update (EditorOperations, info);
+ }
+
+ void ICommandUpdater.Run (object cmdTarget, CommandArrayInfo info)
+ => throw new InvalidOperationException ("Array commands cannot be mapped to editor commands");
+
+ #endregion
+
+ #region IZoomable
+
+
+#if !WINDOWS
+ public bool EnableZoomIn => EditorOperations.CanZoomIn;
+ public bool EnableZoomOut => EditorOperations.CanZoomOut;
+ public bool EnableZoomReset => EditorOperations.CanZoomReset;
+
+ public void ZoomIn () => EditorOperations.ZoomIn ();
+ public void ZoomOut () => EditorOperations.ZoomOut ();
+ public void ZoomReset () => EditorOperations.ZoomReset ();
+#endif
+
+ #endregion
+ }
+}
+
+// Missing EditCommands:
+// JoinWithNextLine,
+// MonodevelopPreferences,
+// DefaultPolicies,
+// InsertStandardHeader,
+// EnableDisableFolding,
+// ToggleFolding,
+// ToggleAllFoldings,
+// FoldDefinitions,
+// SortSelectedLines
+
+// Missing RefactoryCommands:
+// CurrentRefactoryOperations
+// FindReferences
+// FindAllReferences
+// FindDerivedClasses
+// DeclareLocal
+// ImportSymbol
+// QuickFix
+// QuickFixMenu
+
+// Missing TextEditorCommands:
+// ShowCodeTemplateWindow
+// ShowCodeSurroundingsWindow
+// MoveBlockUp
+// MoveBlockDown
+// ShowParameterCompletionWindow
+// GotoMatchingBrace
+// ShrinkSelection
+// CompleteStatement
+// MovePrevSubword
+// MoveNextSubword
+// SelectionMovePrevSubword
+// SelectionMoveNextSubword
+// DeletePrevSubword
+// DeleteNextSubword
+// ToggleCompletionSuggestionMode
+// ToggleBlockSelectionMode
+// DynamicAbbrev
+// PulseCaret
+// ShowQuickInfo
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.TextViewNavigationPoint.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.TextViewNavigationPoint.cs
new file mode 100644
index 0000000000..0ac228ad38
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.TextViewNavigationPoint.cs
@@ -0,0 +1,141 @@
+//
+// 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 System;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Navigation;
+
+namespace MonoDevelop.TextEditor
+{
+ partial class TextViewContent<TView, TImports>
+ {
+ public NavigationPoint BuildNavigationPoint ()
+ {
+ var document = TextView.TryGetParentDocument ();
+ if (document == null)
+ return null;
+ return new TextViewNavigationPoint (document, TextView);
+ }
+
+ void TryLogNavPoint (bool transient)
+ {
+ if (TextView.Properties.TryGetProperty<Document> (typeof (Document), out var doc) && doc == Ide.IdeApp.Workbench.ActiveDocument) {
+ NavigationHistoryService.LogNavigationPoint (new TextViewNavigationPoint (doc, TextView), transient);
+ }
+ }
+
+ class TextViewNavigationPoint : DocumentNavigationPoint
+ {
+ ITextView textView;
+ SnapshotPoint position;
+
+ public TextViewNavigationPoint (Document document, ITextView textView) : base (document)
+ {
+ //FIXME should we use tracking points instead of SnapshotPoint & TranslateTo
+ Initialize (textView, textView.Caret.Position.BufferPosition);
+ }
+
+ void Initialize (ITextView textView, SnapshotPoint position)
+ {
+ this.textView = textView;
+ this.position = textView.Caret.Position.BufferPosition;
+ CaptureLine ();
+ }
+
+ void CaptureLine ()
+ {
+ Offset = position;
+ var line = position.Snapshot.GetLineFromPosition (position);
+ Line = line.LineNumber;
+ }
+
+ void MakePositionCurrent () => position = position.TranslateTo (textView.TextBuffer.CurrentSnapshot, PointTrackingMode.Positive);
+
+ protected override void OnDocumentClosing ()
+ {
+ // when the document is closed, update the position and capture it as a line/offset
+ MakePositionCurrent ();
+ CaptureLine ();
+
+ // drop reference to the editor and snapshot so as not to leak them
+ textView = null;
+ position = default;
+ }
+
+ public int Line { get; private set; }
+ public int Offset { get; private set; }
+
+ // editor's line numbers are zero based, hence we add 1
+ // FIXME: add a snippet of text
+ public override string DisplayName => string.Format ("{0} : {1}", base.DisplayName, Line + 1);
+
+ protected override async Task<Document> DoShow ()
+ {
+ var doc = await base.DoShow ();
+ if (doc == null) {
+ return doc;
+ }
+
+ var view = doc.GetContent<ITextView> ();
+ if (view == null) {
+ return doc;
+ }
+
+ var point = new SnapshotPoint (view.TextBuffer.CurrentSnapshot, Offset);
+ view.Caret.MoveTo (point);
+ view.Caret.EnsureVisible ();
+
+ return doc;
+ }
+
+ public override bool ShouldReplace (NavigationPoint oldPoint)
+ {
+ //we can replace textview navpoints from the same file
+ if (!(oldPoint is TextViewNavigationPoint tf) || tf.FileName != FileName) {
+ return false;
+ }
+
+ // if it's detached (i.e the view that created it closed, but that file is now open again), reattach it
+ if (tf.textView == null) {
+ tf.SetDocument (Document);
+ tf.Initialize (
+ textView,
+ new SnapshotPoint (
+ textView.TextBuffer.CurrentSnapshot,
+ Math.Min (textView.TextBuffer.CurrentSnapshot.Length, tf.Offset)
+ )
+ );
+ }
+
+ //replace the point if it's within five lines of this one
+ return Math.Abs (Line - tf.Line) < 5;
+ }
+
+ public override bool Equals (object o) => o is TextViewNavigationPoint other && other.Offset == Offset && base.Equals (other);
+
+ public override int GetHashCode () => Offset ^ base.GetHashCode ();
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs
new file mode 100644
index 0000000000..0ceeebf0d4
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewContent.cs
@@ -0,0 +1,759 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Threading.Tasks;
+
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
+using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
+using Microsoft.VisualStudio.Text.Utilities;
+
+using Microsoft.VisualStudio.CodingConventions;
+using Microsoft.VisualStudio.Threading;
+using Microsoft.VisualStudio.Utilities;
+
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Text;
+using MonoDevelop.DesignerSupport;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Content;
+using MonoDevelop.Projects;
+using MonoDevelop.Projects.Policies;
+
+using AutoSave = MonoDevelop.Ide.Editor.AutoSave;
+using EditorConfigService = MonoDevelop.Ide.Editor.EditorConfigService;
+using DefaultSourceEditorOptions = MonoDevelop.Ide.Editor.DefaultSourceEditorOptions;
+
+#if WINDOWS
+using EditorOperationsInterface = Microsoft.VisualStudio.Text.Operations.IEditorOperations3;
+#else
+using EditorOperationsInterface = Microsoft.VisualStudio.Text.Operations.IEditorOperations4;
+#endif
+
+namespace MonoDevelop.TextEditor
+{
+ abstract partial class TextViewContent<TView, TImports> :
+ ViewContent,
+ INavigable,
+ ICustomCommandTarget,
+ ICommandHandler,
+ ICommandUpdater,
+ IPropertyPadProvider,
+ IDocumentReloadPresenter
+#if !WINDOWS
+ // implementing this correctly requires IEditorOperations4
+ , IZoomable
+#endif
+ where TView : ITextView
+ where TImports : TextViewImports
+ {
+ readonly string mimeType;
+ readonly IEditorCommandHandlerService commandService;
+ readonly List<IEditorContentProvider> contentProviders;
+ readonly DefaultSourceEditorOptions sourceEditorOptions;
+ readonly IInfoBarPresenter infoBarPresenter;
+
+ PolicyBag policyContainer;
+ ICodingConventionContext editorConfigContext;
+ bool warnOverwrite;
+
+ public TImports Imports { get; }
+ public TView TextView { get; }
+ public ITextDocument TextDocument { get; }
+ public ITextBuffer TextBuffer { get; }
+
+ protected EditorOperationsInterface EditorOperations { get; }
+ protected IEditorOptions EditorOptions { get; }
+
+ protected TextViewContent (
+ TImports imports,
+ FilePath fileName,
+ string mimeType,
+ Project ownerProject)
+ {
+ this.Imports = imports;
+ this.mimeType = mimeType;
+ this.sourceEditorOptions = DefaultSourceEditorOptions.Instance;
+
+ Project = ownerProject;
+ ContentName = fileName;
+
+ // FIXME: move this to the end of the .ctor after fixing margin options responsiveness
+ UpdateLineNumberMarginOption ();
+
+ //TODO: this can change when the file is renamed
+ var contentType = GetContentTypeFromMimeType (fileName, mimeType);
+
+ TextDocument = Imports.TextDocumentFactoryService.CreateAndLoadTextDocument (fileName, contentType);
+ TextBuffer = TextDocument.TextBuffer;
+
+ var roles = GetAllPredefinedRoles ();
+ //we have multiple copies of VacuousTextDataModel for back-compat reasons
+ #pragma warning disable CS0436 // Type conflicts with imported type
+ var dataModel = new VacuousTextDataModel (TextBuffer);
+ var viewModel = UIExtensionSelector.InvokeBestMatchingFactory (
+ Imports.TextViewModelProviders,
+ dataModel.ContentType,
+ roles,
+ provider => provider.CreateTextViewModel (dataModel, roles),
+ Imports.ContentTypeRegistryService,
+ Imports.GuardedOperations,
+ this) ?? new VacuousTextViewModel (dataModel);
+ #pragma warning restore CS0436 // Type conflicts with imported type
+
+ TextView = CreateTextView (viewModel, roles);
+ control = CreateControl ();
+
+ commandService = Imports.EditorCommandHandlerServiceFactory.GetService (TextView);
+ EditorOperations = (EditorOperationsInterface)Imports.EditorOperationsProvider.GetEditorOperations (TextView);
+ EditorOptions = Imports.EditorOptionsFactoryService.GetOptions (TextView);
+ UpdateTextEditorOptions (this, EventArgs.Empty);
+ contentProviders = new List<IEditorContentProvider> (Imports.EditorContentProviderService.GetContentProvidersForView (TextView));
+
+ TextView.Properties [typeof (ViewContent)] = this;
+
+ infoBarPresenter = Imports.InfoBarPresenterFactory?.TryGetInfoBarPresenter (TextView);
+
+ InstallAdditionalEditorOperationsCommands ();
+
+ SubscribeToEvents ();
+ }
+
+ public override bool IsReadOnly => TextView.Options.DoesViewProhibitUserInput ();
+
+ public override void GrabFocus ()
+ {
+ DefaultSourceEditorOptions.SetUseAsyncCompletion (true);
+ base.GrabFocus ();
+ }
+
+ protected override void OnContentNameChanged ()
+ {
+ base.OnContentNameChanged ();
+
+ if (TextDocument == null)
+ return;
+
+ if (editorConfigContext != null) {
+ editorConfigContext.CodingConventionsChangedAsync -= UpdateOptionsFromEditorConfigAsync;
+ EditorConfigService.RemoveEditConfigContext (TextDocument.FilePath).Ignore ();
+ editorConfigContext = null;
+ }
+
+ if (ContentName != TextDocument.FilePath && !string.IsNullOrEmpty (TextDocument.FilePath))
+ AutoSave.RemoveAutoSaveFile (TextDocument.FilePath);
+
+ if (ContentName != null) // Happens when a file is converted to an untitled file, but even in that case the text editor should be associated with the old location, otherwise typing can be messed up due to change of .editconfig settings etc.
+ TextDocument.Rename (ContentName);
+
+ // TODO: Actually implement file rename support. Below is from old editor.
+ // Need to remove or update mimeType field, too.
+
+ //if (this.WorkbenchWindow?.Document != null)
+ // textEditor.InitializeExtensionChain (this.WorkbenchWindow.Document);
+
+ UpdateTextEditorOptions (null, null);
+ }
+
+ protected override void OnSetProject (Project project)
+ {
+ base.OnSetProject (project);
+
+ if (TextDocument == null)
+ return;
+
+ UpdateTextEditorOptions (null, null);
+ }
+
+ protected abstract TView CreateTextView (ITextViewModel viewModel, ITextViewRoleSet roles);
+
+ // FIXME: ideally we could access this via ITextViewFactoryService
+ // but it hasn't been upstreamed to Windows yet
+ protected abstract ITextViewRoleSet GetAllPredefinedRoles ();
+
+ protected abstract Components.Control CreateControl ();
+
+ Components.Control control;
+ public override Components.Control Control => control;
+
+ public override string TabPageLabel
+ => GettextCatalog.GetString ("Source");
+
+ bool isDisposed;
+ public override void Dispose ()
+ {
+ if (isDisposed)
+ return;
+
+ isDisposed = true;
+
+ UnsubscribeFromEvents ();
+ TextDocument.Dispose ();
+
+ if (policyContainer != null)
+ policyContainer.PolicyChanged -= PolicyChanged;
+ if (editorConfigContext != null) {
+ editorConfigContext.CodingConventionsChangedAsync -= UpdateOptionsFromEditorConfigAsync;
+ EditorConfigService.RemoveEditConfigContext (ContentName).Ignore ();
+ }
+
+ base.Dispose ();
+ }
+
+ protected virtual void SubscribeToEvents ()
+ {
+ sourceEditorOptions.Changed += UpdateTextEditorOptions;
+ TextDocument.DirtyStateChanged += HandleTextDocumentDirtyStateChanged;
+ TextBuffer.Changed += HandleTextBufferChanged;
+ TextView.Caret.PositionChanged += CaretPositionChanged;
+ TextView.TextBuffer.Changed += TextBufferChanged;
+ }
+
+ protected virtual void UnsubscribeFromEvents ()
+ {
+ sourceEditorOptions.Changed -= UpdateTextEditorOptions;
+ TextDocument.DirtyStateChanged -= HandleTextDocumentDirtyStateChanged;
+ TextBuffer.Changed -= HandleTextBufferChanged;
+ TextView.Caret.PositionChanged -= CaretPositionChanged;
+ TextView.TextBuffer.Changed -= TextBufferChanged;
+ }
+
+ void UpdateLineNumberMarginOption ()
+ {
+ Imports.EditorOptionsFactoryService.GlobalOptions.SetOptionValue (
+ DefaultTextViewHostOptions.LineNumberMarginId,
+ sourceEditorOptions.ShowLineNumberMargin);
+ }
+
+ void UpdateTextEditorOptions (object sender, EventArgs e)
+ {
+ UpdateTextEditorOptionsAsync ().Forget ();
+ }
+
+ async Task UpdateTextEditorOptionsAsync ()
+ {
+ UpdateLineNumberMarginOption ();
+
+ var newPolicyContainer = Project?.Policies;
+ if (newPolicyContainer != policyContainer) {
+ if (policyContainer != null)
+ policyContainer.PolicyChanged -= PolicyChanged;
+ policyContainer = newPolicyContainer;
+ }
+ if (policyContainer != null)
+ policyContainer.PolicyChanged += PolicyChanged;
+
+ UpdateOptionsFromPolicy ();
+
+ var newEditorConfigContext = await EditorConfigService.GetEditorConfigContext (ContentName, default);
+ if (newEditorConfigContext != editorConfigContext) {
+ if (editorConfigContext != null)
+ editorConfigContext.CodingConventionsChangedAsync -= UpdateOptionsFromEditorConfigAsync;
+ editorConfigContext = newEditorConfigContext;
+ }
+ if (editorConfigContext != null)
+ editorConfigContext.CodingConventionsChangedAsync += UpdateOptionsFromEditorConfigAsync;
+
+ await UpdateOptionsFromEditorConfigAsync (null, null);
+ }
+
+ private void UpdateOptionsFromPolicy()
+ {
+ if (policyContainer == null) {
+ EditorOptions.ClearOptionValue (DefaultOptions.ConvertTabsToSpacesOptionName);
+ EditorOptions.ClearOptionValue (DefaultOptions.TabSizeOptionName);
+ EditorOptions.ClearOptionValue (DefaultOptions.IndentSizeOptionName);
+ EditorOptions.ClearOptionValue (DefaultOptions.NewLineCharacterOptionName);
+ EditorOptions.ClearOptionValue (DefaultOptions.TrimTrailingWhiteSpaceOptionName);
+
+ return;
+ }
+
+ var mimeTypes = Ide.DesktopService.GetMimeTypeInheritanceChain (mimeType);
+ var currentPolicy = policyContainer.Get<TextStylePolicy> (mimeTypes);
+
+ EditorOptions.SetOptionValue (DefaultOptions.ConvertTabsToSpacesOptionName, currentPolicy.TabsToSpaces);
+ EditorOptions.SetOptionValue (DefaultOptions.TabSizeOptionName, currentPolicy.TabWidth);
+ EditorOptions.SetOptionValue (DefaultOptions.IndentSizeOptionName, currentPolicy.IndentWidth);
+ EditorOptions.SetOptionValue (DefaultOptions.NewLineCharacterOptionName, currentPolicy.GetEolMarker ());
+ EditorOptions.SetOptionValue (DefaultOptions.TrimTrailingWhiteSpaceOptionName, currentPolicy.RemoveTrailingWhitespace);
+ }
+
+ private Task UpdateOptionsFromEditorConfigAsync (object sender, CodingConventionsChangedEventArgs args)
+ {
+ if (editorConfigContext == null)
+ return Task.FromResult (false);
+
+ if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetIndentStyle (out var indentStyle))
+ EditorOptions.SetOptionValue (DefaultOptions.ConvertTabsToSpacesOptionName, indentStyle == IndentStyle.Spaces);
+ if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetTabWidth (out var tabWidth))
+ EditorOptions.SetOptionValue (DefaultOptions.TabSizeOptionName, tabWidth);
+ if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetIndentSize (out var indentSize))
+ EditorOptions.SetOptionValue (DefaultOptions.IndentSizeOptionName, indentSize);
+ if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetLineEnding (out var lineEnding))
+ EditorOptions.SetOptionValue (DefaultOptions.NewLineCharacterOptionName, lineEnding);
+ if (editorConfigContext.CurrentConventions.UniversalConventions.TryGetAllowTrailingWhitespace (out var allowTrailingWhitespace))
+ EditorOptions.SetOptionValue (DefaultOptions.TrimTrailingWhiteSpaceOptionName, !allowTrailingWhitespace);
+
+ return Task.FromResult (true);
+ }
+
+ private void PolicyChanged (object sender, PolicyChangedEventArgs e)
+ => UpdateTextEditorOptions (sender, e);
+
+ protected override object OnGetContent (Type type)
+ {
+ foreach (var provider in contentProviders) {
+ var content = provider.GetContent (TextView, type);
+ if (content != null) {
+ return content;
+ }
+ }
+ return GetIntrinsicType (type);
+ }
+
+ protected override IEnumerable<object> OnGetContents (Type type)
+ {
+ foreach (var provider in contentProviders) {
+ var contents = provider.GetContents (TextView, type);
+ if (contents != null) {
+ foreach (var content in contents)
+ yield return content;
+ }
+ }
+
+ var intrinsicType = GetIntrinsicType (type);
+ if (intrinsicType != null) {
+ yield return intrinsicType;
+ }
+ }
+
+ object GetIntrinsicType (Type type)
+ {
+ if (type.IsInstanceOfType (TextBuffer))
+ return TextBuffer;
+ if (type.IsInstanceOfType (TextDocument))
+ return TextDocument;
+ if (type.IsInstanceOfType (TextView))
+ return TextView;
+ if (type.IsInstanceOfType (this))
+ return this;
+ return null;
+ }
+
+ public override Task Load (FileOpenInformation fileOpenInformation)
+ {
+ // We actually load initial content at construction time, so this
+ // overload only needs to cover reload and autosave scenarios
+
+ if (warnOverwrite) {
+ warnOverwrite = false;
+ DismissInfoBar ();
+ WorkbenchWindow.ShowNotification = false;
+ }
+
+ if (fileOpenInformation.IsReloadOperation) {
+ TextDocument.Reload ();
+ } else if (AutoSave.AutoSaveExists (fileOpenInformation.FileName)) {
+ var autosaveContent = AutoSave.LoadAutoSave (fileOpenInformation.FileName);
+
+ MarkDirty ();
+ warnOverwrite = true;
+
+ // Set editor read-only until user picks one of the above options.
+ var setWritable = !TextView.Options.DoesViewProhibitUserInput ();
+ if (setWritable)
+ TextView.Options.SetOptionValue (DefaultTextViewOptions.ViewProhibitUserInputId, true);
+
+ var (primaryMessageText, secondaryMessageText) = SplitMessageString (
+ BrandingService.BrandApplicationName (GettextCatalog.GetString (
+ "<b>An autosave file has been found for this file.</b>\n" +
+ "This could mean that another instance of MonoDevelop is editing this " +
+ "file, or that MonoDevelop crashed with unsaved changes.\n\n" +
+ "Do you want to use the original file, or load from the autosave file?")));
+
+ PresentInfobar (
+ primaryMessageText,
+ secondaryMessageText,
+ new InfoBarAction (
+ GetButtonString (GettextCatalog.GetString ("_Use original file")),
+ UseOriginalFile),
+ new InfoBarAction (
+ GetButtonString (GettextCatalog.GetString ("_Load from autosave")),
+ LoadFromAutosave,
+ isDefault: true));
+
+ void OnActionSelected ()
+ {
+ DismissInfoBar ();
+ if (setWritable)
+ TextView.Options.SetOptionValue (DefaultTextViewOptions.ViewProhibitUserInputId, false);
+ }
+
+ void LoadFromAutosave ()
+ {
+ try {
+ AutoSave.RemoveAutoSaveFile (fileOpenInformation.FileName);
+ ReplaceContent (autosaveContent.Text, autosaveContent.Encoding);
+ } catch (Exception e) {
+ LoggingService.LogError ("Could not load the autosave file", e);
+ } finally {
+ OnActionSelected ();
+ }
+ }
+
+ void UseOriginalFile ()
+ {
+ try {
+ AutoSave.RemoveAutoSaveFile (fileOpenInformation.FileName);
+ } catch (Exception e) {
+ LoggingService.LogError ("Could not remove the autosave file", e);
+ } finally {
+ OnActionSelected ();
+ }
+ }
+ }
+
+ return Task.CompletedTask;
+ }
+
+ /// <summary>
+ /// Replace document content with new content. This marks the document as dirty.
+ /// </summary>
+ void ReplaceContent (string newContent, Encoding newEncoding)
+ {
+ var currentSnapshot = TextBuffer.CurrentSnapshot;
+ TextDocument.Encoding = newEncoding;
+ TextBuffer.Replace (
+ new SnapshotSpan (currentSnapshot, 0, currentSnapshot.Length),
+ newContent);
+ }
+
+ void PresentInfobar (string title, string description, params InfoBarAction [] actions)
+ {
+ if (infoBarPresenter != null) {
+ DismissInfoBar ();
+ infoBarPresenter.Present (new InfoBarViewModel (title, description, actions));
+ }
+ }
+
+ void DismissInfoBar ()
+ => infoBarPresenter?.DismissAll ();
+
+ public override void DiscardChanges ()
+ {
+ // Parity behavior with the old editor
+ if (autoSaveTask != null)
+ autoSaveTask.Wait (TimeSpan.FromSeconds (5));
+ RemoveAutoSaveTimer ();
+ if (!string.IsNullOrEmpty (ContentName))
+ AutoSave.RemoveAutoSaveFile (ContentName);
+ }
+
+ // TODO: Switch to native timeout, this is copied from TextEditorViewContent
+ uint autoSaveTimer;
+ Task autoSaveTask;
+ void InformAutoSave ()
+ {
+ if (isDisposed)
+ return;
+ RemoveAutoSaveTimer ();
+ autoSaveTimer = GLib.Timeout.Add (500, delegate {
+ autoSaveTimer = 0;
+ if (autoSaveTask != null && !autoSaveTask.IsCompleted)
+ return false;
+
+ autoSaveTask = AutoSave.InformAutoSaveThread (
+ new AutoSaveTextSourceFacade(TextBuffer, TextDocument), ContentName, IsDirty);
+ return false;
+ });
+ }
+
+ void RemoveAutoSaveTimer ()
+ {
+ if (autoSaveTimer == 0)
+ return;
+ GLib.Source.Remove (autoSaveTimer);
+ autoSaveTimer = 0;
+ }
+
+ public override Task Save ()
+ => Save (default (FileSaveInformation));
+
+ public override Task Save (FileSaveInformation fileSaveInformation)
+ {
+ var fileName = fileSaveInformation?.FileName ?? ContentName;
+
+ if (warnOverwrite) {
+ if (string.Equals (fileName, ContentName, FilePath.PathComparison)) {
+ string question = GettextCatalog.GetString (
+ "This file {0} has been changed outside of {1}. Are you sure you want to overwrite the file?",
+ fileName, BrandingService.ApplicationName
+ );
+ if (MessageService.AskQuestion (question, AlertButton.Cancel, AlertButton.OverwriteFile) != AlertButton.OverwriteFile)
+ return Task.CompletedTask;
+ }
+
+ warnOverwrite = false;
+ DismissInfoBar ();
+ WorkbenchWindow.ShowNotification = false;
+ }
+
+ if (!string.IsNullOrEmpty (fileName))
+ AutoSave.RemoveAutoSaveFile (fileName);
+
+ FormatOnSave ();
+
+ if (fileSaveInformation != null)
+ TextDocument.SaveAs (fileSaveInformation.FileName, overwrite: true);
+ else
+ TextDocument.Save ();
+
+ return Task.CompletedTask;
+ }
+
+ void FormatOnSave ()
+ {
+ if (!PropertyService.Get ("AutoFormatDocumentOnSave", false))
+ return;
+ try {
+ commandService.Execute ((t, b) => new FormatDocumentCommandArgs (t, b), null);
+ } catch (Exception e) {
+ LoggingService.LogError ("Error while formatting on save", e);
+ }
+ }
+
+ public override bool IsDirty => TextDocument.IsDirty;
+
+ bool manuallyMarkingDirty;
+ void MarkDirty ()
+ {
+ manuallyMarkingDirty = true;
+ try {
+ TextDocument.UpdateDirtyState (true, DateTime.Now);
+ } finally {
+ manuallyMarkingDirty = false;
+ }
+ }
+
+ void HandleTextDocumentDirtyStateChanged (object sender, EventArgs e)
+ {
+ OnDirtyChanged ();
+ if (!manuallyMarkingDirty)
+ InformAutoSave ();
+ }
+
+ private void HandleTextBufferChanged (object sender, TextContentChangedEventArgs e)
+ => InformAutoSave ();
+
+ static readonly string[] textContentType = { "text" };
+
+ IContentType GetContentTypeFromMimeType (string filePath, string mimeType)
+ => Ide.MimeTypeCatalog.Instance.GetContentTypeForMimeType (mimeType)
+ ?? (ContentName != null ? Ide.Composition.CompositionManager.GetExportedValue<IFileToContentTypeService> ().GetContentTypeForFilePath (ContentName) : null)
+ ?? Microsoft.VisualStudio.Platform.PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType;
+
+ public override ProjectReloadCapability ProjectReloadCapability
+ => ProjectReloadCapability.Full;
+
+ void CaretPositionChanged (object sender, CaretPositionChangedEventArgs e)
+ {
+ TryLogNavPoint (true);
+ }
+
+ void TextBufferChanged (object sender, TextContentChangedEventArgs e)
+ {
+ TryLogNavPoint (false);
+ }
+
+ object IPropertyPadProvider.GetActiveComponent ()
+ {
+ if (WorkbenchWindow?.Document is Document doc && doc.HasProject) {
+ return Project.Files.GetFile (doc.Name);
+ }
+ return null;
+ }
+
+ object IPropertyPadProvider.GetProvider () => null;
+
+ void IPropertyPadProvider.OnEndEditing (object obj) { }
+
+ void IPropertyPadProvider.OnChanged (object obj)
+ {
+ if (WorkbenchWindow?.Document is Document doc && doc.HasProject) {
+ Ide.IdeApp.ProjectOperations.SaveAsync (doc.Project);
+ }
+ }
+
+ void IDocumentReloadPresenter.ShowFileChangedWarning (bool multiple)
+ {
+ var actions = new List<InfoBarAction> {
+ new InfoBarAction (GetButtonString (GettextCatalog.GetString ("_Reload from disk")), ReloadFromDisk),
+ new InfoBarAction (GetButtonString (GettextCatalog.GetString ("_Keep changes")), KeepChanges, isDefault: !multiple),
+ };
+
+ if (multiple) {
+ actions.Add (new InfoBarAction (GetButtonString (GettextCatalog.GetString ("_Reload all")), ReloadAll));
+ actions.Add (new InfoBarAction (GetButtonString (GettextCatalog.GetString ("_Ignore all")), IgnoreAll));
+ }
+
+ WorkbenchWindow.ShowNotification = true;
+ warnOverwrite = true;
+ MarkDirty ();
+
+ var (primaryMessageText, secondaryMessageText) = SplitMessageString (GettextCatalog.GetString (
+ "<b>The file \"{0}\" has been changed outside of {1}.</b>\n" +
+ "Do you want to keep your changes, or reload the file from disk?",
+ ContentName, BrandingService.ApplicationName));
+
+ PresentInfobar (
+ primaryMessageText,
+ secondaryMessageText,
+ actions.ToArray ());
+
+ void ReloadFromDisk ()
+ {
+ try {
+ if (isDisposed || !File.Exists (ContentName))
+ return;
+
+ Load (new FileOpenInformation (ContentName) { IsReloadOperation = true });
+ WorkbenchWindow.ShowNotification = false;
+ } catch (Exception ex) {
+ MessageService.ShowError ("Could not reload the file.", ex);
+ } finally {
+ DismissInfoBar ();
+ }
+ }
+
+ void KeepChanges ()
+ {
+ if (isDisposed)
+ return;
+ WorkbenchWindow.ShowNotification = false;
+ DismissInfoBar ();
+ }
+
+ void ReloadAll () => DocumentRegistry.ReloadAllChangedFiles ();
+
+ void IgnoreAll () => DocumentRegistry.IgnoreAllChangedFiles ();
+ }
+
+ void IDocumentReloadPresenter.RemoveMessageBar ()
+ => DismissInfoBar ();
+
+ /// <summary>
+ /// Converts strings to title case per the current locale and strips <c>_</c> mnemonic characters,
+ /// allowing us to retain original already localized strings from the old editor UI but present
+ /// them better in the new editor UI.
+ /// </summary>
+ static string GetButtonString (string originalButtonString)
+ => System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase (
+ originalButtonString.Replace ("_", string.Empty));
+
+ /// <summary>
+ /// Strips markup and returns the string before the first line break as a primary string and
+ /// everything after as a secondary string, allowing us to retain original already localized
+ /// strings from the old editor UI but presen them better in the new editor UI.
+ /// </summary>
+ static (string primaryString, string secondaryString) SplitMessageString (string originalString)
+ {
+ if (originalString == null)
+ return (null, null);
+
+ if (originalString == string.Empty)
+ return (string.Empty, null);
+
+ var strippedText = Xwt.FormattedText.FromMarkup (originalString).Text;
+ var secondLineOffset = strippedText.IndexOf ('\n');
+ if (secondLineOffset < 0)
+ return (strippedText, null);
+
+ return (
+ strippedText.Substring (0, secondLineOffset),
+ strippedText.Substring (secondLineOffset + 1).TrimStart ());
+ }
+
+ /// <summary>
+ /// An ITextSource that only implements enough pieces for AutoSave to work.
+ ///
+ /// This can go away when we update AutoSave to use the VS APIs.
+ /// </summary>
+ class AutoSaveTextSourceFacade : ITextSource
+ {
+ readonly ITextBuffer textBuffer;
+ readonly ITextDocument textDocument;
+
+ public AutoSaveTextSourceFacade (ITextBuffer textBuffer, ITextDocument textDocument)
+ {
+ this.textBuffer = textBuffer
+ ?? throw new ArgumentNullException (nameof (textBuffer));
+ this.textDocument = textDocument
+ ?? throw new ArgumentNullException (nameof (textDocument));
+ }
+
+ public char this [int offset] => throw new NotImplementedException ();
+
+ public ITextSourceVersion Version => throw new NotImplementedException ();
+
+ public Encoding Encoding => textDocument.Encoding;
+
+ public int Length => throw new NotImplementedException ();
+
+ public string Text => throw new NotImplementedException ();
+
+ public void CopyTo (int sourceIndex, char [] destination, int destinationIndex, int count)
+ => throw new NotImplementedException ();
+
+ public TextReader CreateReader ()
+ => throw new NotImplementedException ();
+
+ public TextReader CreateReader (int offset, int length)
+ => throw new NotImplementedException ();
+
+ public ITextSource CreateSnapshot ()
+ => throw new NotImplementedException ();
+
+ public ITextSource CreateSnapshot (int offset, int length)
+ => throw new NotImplementedException ();
+
+ public char GetCharAt (int offset)
+ => throw new NotImplementedException ();
+
+ public string GetTextAt (int offset, int length)
+ => throw new NotImplementedException ();
+
+ public void WriteTextTo (TextWriter writer)
+ => textBuffer.CurrentSnapshot.Write (writer);
+
+ public void WriteTextTo (TextWriter writer, int offset, int length)
+ => throw new NotImplementedException ();
+ }
+ }
+} \ 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
new file mode 100644
index 0000000000..4a083164c2
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewDisplayBinding.cs
@@ -0,0 +1,110 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.TextEditor
+{
+ abstract class TextViewDisplayBinding<TImports> : IViewDisplayBinding, IDisposable
+ where TImports : TextViewImports
+ {
+ ThemeToClassification themeToClassification;
+
+ public string Name => GettextCatalog.GetString ("New Editor Preview");
+
+ public bool CanUseAsDefault => true;
+
+ public bool CanHandle (FilePath fileName, string mimeType, Project ownerProject)
+ {
+ if (!DefaultSourceEditorOptions.Instance.EnableNewEditor) {
+ return false;
+ }
+
+ if (fileName == null || !(IsSupportedFileExtension (fileName) || IsSupportedAndroidFileName (fileName, ownerProject))) {
+ return false;
+ }
+
+ if (fileName != null)
+ return DesktopService.GetFileIsText (fileName, mimeType);
+
+ if (!string.IsNullOrEmpty (mimeType))
+ return DesktopService.GetMimeTypeIsText (mimeType);
+
+ return false;
+ }
+
+ static HashSet<string> supportedFileExtensions = new HashSet<string> (StringComparer.OrdinalIgnoreCase) {
+ ".cs",
+ ".csx"
+ //".cshtml",
+ //".css",
+ //".html",
+ //".js",
+ //".json",
+ //".ts",
+ //".xaml"
+ };
+
+ bool IsSupportedFileExtension (FilePath fileName)
+ {
+ return supportedFileExtensions.Contains (fileName.Extension);
+ }
+
+ bool IsSupportedAndroidFileName (FilePath fileName, Project ownerProject)
+ {
+ // disable Android XML for now
+ return false;
+
+ // We only care about .xml and .axml files that are marked as AndroidResource
+ if (!(fileName.HasExtension (".xml") || fileName.HasExtension (".axml")))
+ return false;
+
+ const string AndroidResourceBuildAction = "AndroidResource";
+ var buildAction = ownerProject.GetProjectFile (fileName)?.BuildAction;
+ return string.Equals (buildAction, AndroidResourceBuildAction, StringComparison.Ordinal);
+ }
+
+ public ViewContent CreateContent (FilePath fileName, string mimeType, Project ownerProject)
+ {
+ var imports = Ide.Composition.CompositionManager.GetExportedValue<TImports> ();
+ if (themeToClassification == null)
+ themeToClassification = CreateThemeToClassification (imports.EditorFormatMapService);
+
+ return CreateContent (imports, fileName, mimeType, ownerProject);
+ }
+
+ protected abstract ViewContent CreateContent (TImports imports, FilePath fileName, string mimeType, Project ownerProject);
+
+ protected abstract ThemeToClassification CreateThemeToClassification (Microsoft.VisualStudio.Text.Classification.IEditorFormatMapService editorFormatMapService);
+
+ public void Dispose ()
+ {
+ themeToClassification?.Dispose ();
+ themeToClassification = null;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewExtensions.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewExtensions.cs
new file mode 100644
index 0000000000..474035ea57
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewExtensions.cs
@@ -0,0 +1,50 @@
+//
+// 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 Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.TextEditor
+{
+ public static class TextViewExtensions
+ {
+ /// <summary>
+ /// Gets the parent <see cref="Ide.Gui.Document"/> from an <see cref="ITextView"/>
+ /// </summary>
+ public static Ide.Gui.Document TryGetParentDocument (this ITextView view)
+ {
+ // TOTEST
+ if (view.Properties.TryGetProperty<Ide.Gui.Document> (typeof (Ide.Gui.Document), out var document)) {
+ return document;
+ }
+ return null;
+ }
+
+ public static string GetFilePathOrNull (this ITextBuffer textBuffer)
+ {
+ if (textBuffer.Properties.TryGetProperty (typeof (Microsoft.VisualStudio.Text.ITextDocument), out Microsoft.VisualStudio.Text.ITextDocument textDocument)) {
+ return textDocument.FilePath;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs
new file mode 100644
index 0000000000..265bf93dd8
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/TextViewImports.cs
@@ -0,0 +1,78 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text.Editor.Commanding;
+using Microsoft.VisualStudio.Text.Utilities;
+using Microsoft.VisualStudio.Utilities;
+using Microsoft.VisualStudio.Text.Classification;
+using Microsoft.VisualStudio.Text.Operations;
+using Microsoft.VisualStudio.Text.Find;
+
+namespace MonoDevelop.TextEditor
+{
+ abstract class TextViewImports
+ {
+ [Import]
+ public ITextDocumentFactoryService TextDocumentFactoryService { get; set; }
+
+ [Import]
+ public ITextBufferFactoryService TextBufferFactoryService { get; set; }
+
+ [Import]
+ public IFileToContentTypeService FileToContentTypeService { get; set; }
+
+ [Import]
+ public IContentTypeRegistryService ContentTypeRegistryService { get; set; }
+
+ [ImportMany]
+ public List<Lazy<ITextViewModelProvider, IContentTypeAndTextViewRoleMetadata>> TextViewModelProviders { get; set; }
+
+ [Import]
+ public IGuardedOperations GuardedOperations { get; set; }
+
+ [Import]
+ internal IEditorOptionsFactoryService EditorOptionsFactoryService { get; set; }
+
+ [Import]
+ internal IEditorCommandHandlerServiceFactory EditorCommandHandlerServiceFactory { get; set; }
+
+ [Import]
+ internal IEditorOperationsFactoryService EditorOperationsProvider { get; set; }
+
+ [Import]
+ internal EditorContentProviderService EditorContentProviderService { get; set; }
+
+ [Import]
+ internal IEditorFormatMapService EditorFormatMapService { get; set; }
+
+ [Import]
+ internal IFindPresenterFactory FindPresenterFactory { get; set; }
+
+ [Import(AllowDefault = true)]
+ internal IInfoBarPresenterFactory InfoBarPresenterFactory { get; set; }
+ }
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/ThemeToClassification.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/ThemeToClassification.cs
new file mode 100644
index 0000000000..554b6f5e3d
--- /dev/null
+++ b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor/ThemeToClassification.cs
@@ -0,0 +1,376 @@
+//
+// 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 System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Media;
+using Microsoft.VisualStudio.Text.Classification;
+using MonoDevelop.Components;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Editor.Highlighting;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.TextEditor
+{
+ abstract class ThemeToClassification : IDisposable
+ {
+ readonly IEditorFormatMapService editorFormatMapService;
+
+ protected ThemeToClassification (IEditorFormatMapService editorFormatMapService)
+ {
+ this.editorFormatMapService = editorFormatMapService;
+ Ide.Editor.DefaultSourceEditorOptions.Instance.Changed += UpdateEditorFormatMap;
+ UpdateEditorFormatMap (null, null);
+ }
+
+ public void Dispose ()
+ {
+ Ide.Editor.DefaultSourceEditorOptions.Instance.Changed -= UpdateEditorFormatMap;
+ }
+
+ static readonly List<(string EditorFormatName, string MDThemeSettingName)> mappings = new List<(string, string)> {
+ ("preprocessor text", "Preprocessor region name"),
+ ("punctuation", "punctuation"),
+ ("string - verbatim", "String Verbatim"),
+ ("property name","User Property"),
+ ("field name","User Field"),
+ ("event name","User Event"),
+ ("enum member name","User Enum Member"),
+ ("class name", "User Types"),
+ ("method name", "User Method"),
+ ("constant name", "User Constant"),
+ ("parameter name", "User Parameter"),
+ ("delegate name", "User Types(Delegates)"),
+ ("enum name", "User Types(Enums)"),
+ ("interface name", "User Types(Interfaces)"),
+ ("module name", ""),
+ ("local name", "User Variable"),
+ ("struct name", "User Types(Value types)"),
+ ("type parameter name", "User Types(Type parameters)"),
+ ("xml doc comment - attribute name", "Comment XML Doc Comment"),
+ ("xml doc comment - attribute quotes", "Comment XML Doc Comment"),
+ ("xml doc comment - attribute value", "Comment XML Doc Comment"),
+ ("xml doc comment - cdata section", "Comment XML Doc Comment"),
+ ("xml doc comment - comment", "Comment XML Doc Comment"),
+ ("xml doc comment - delimiter", "Comment XML Doc Comment"),
+ ("xml doc comment - entity reference", "Comment XML Doc Comment"),
+ ("xml doc comment - name", "Comment XML Doc Comment"),
+ ("xml doc comment - processing instruction", "Comment XML Doc Comment"),
+ ("xml doc comment - text", "Comment XML Doc Comment"),
+ ("xml literal - attribute name", "Xml Attribute"),
+ ("xml literal - attribute quotes", "Xml Attribute Quotes"),
+ ("xml literal - attribute value", "Xml Attribute Value"),
+ ("xml literal - cdata section", "Xml CData Section"),
+ ("xml literal - comment", "Xml Comment"),
+ ("xml literal - delimiter", "Xml Delimiter"),
+ ("xml literal - embedded expression", ""),
+ ("xml literal - entity reference", ""),
+ ("xml literal - name", "Xml Name"),
+ ("xml literal - processing instruction", ""),
+ ("xml literal - text", "Xml Text"),
+ ("axml - attribute name", "Xml Attribute"),
+ ("axml - attribute quotes", "Xml Attribute Quotes"),
+ ("axml - attribute value", "Xml Attribute Value"),
+ ("axml - cdata section", "Xml CData Section"),
+ ("axml - comment", "Xml Comment"),
+ ("axml - delimiter", "Xml Delimiter"),
+ ("axml - embedded expression", ""),
+ ("axml - entity reference", ""),
+ ("axml - name", "Xml Name"),
+ ("axml - processing instruction", ""),
+ ("axml - text", "Xml Text"),
+ ("axml - resource url", "Xml Name"),
+ ("XAML Attribute", "Xml Attribute"),
+ ("XAML Attribute Quotes", "Xml Attribute Quotes"),
+ ("XAML Attribute Value", "Xml Attribute Value"),
+ ("XAML CData Section", "Xml CData Section"),
+ ("XAML Comment", "Xml Comment"),
+ ("XAML Delimiter", "Xml Delimiter"),
+ ("XAML Keyword", "Xml Name"),
+ ("XAML Markup Extension Class", "Xml Name"),
+ ("XAML Markup Extension Parameter Name", "Xml Name"),
+ ("XAML Markup Extension Parameter Value", "Xml Name"),
+ ("XAML Name", "Xml Name"),
+ ("XAML Processing Instruction", ""),
+ ("XAML Text", "Xml Text"),
+ ("Peek Background", ""),
+ ("Peek Background Unfocused", ""),
+ ("Peek History Selected", ""),
+ ("Peek History Hovered", ""),
+ ("Peek Focused Border", ""),
+ ("Peek Label Text", ""),
+ ("Peek Highlighted Text", ""),
+ ("Peek Highlighted Text Unfocused", ""),
+ ("Comment", "Comment"),
+ ("Excluded Code", "Excluded Code"),
+ ("Keyword", "Keyword"),
+ ("Preprocessor Keyword", "Preprocessor"),
+ ("Operator", "Keyword(Operator)"),
+ ("Literal", "Number"),
+ ("Markup Attribute", ""),
+ ("Markup Attribute Value", ""),
+ ("Markup Node", ""),
+ ("String", "String"),
+ ("Type", "User Types"),
+ ("Number", "Number"),
+ ("SymbolDefinitionClassificationFormat", ""),
+ ("SymbolReferenceClassificationFormat", ""),
+ ("Natural Language Priority", ""),
+ ("Formal Language Priority", ""),
+ ("outlining.collapsehintadornment", ""),
+ ("outlining.verticalrule", ""),
+ ("SigHelpDocumentationFormat", ""),
+ ("CurrentParameterFormat", ""),
+ ("bookmark", ""),
+ ("breakpoint", ""),
+ ("currentstatement", ""),
+ ("returnstatement", ""),
+ ("stepbackcurrentstatement", ""),
+ ("vivid", ""),
+ ("blue", ""),
+ ("remove line", ""),
+ ("add line", ""),
+ ("remove word", ""),
+ ("add word", ""),
+ ("bracehighlight", ""),
+ ("BraceCompletionClosingBrace", ""),
+ ("outlining.collapsehintadornment.background", "" )
+ };
+
+ void UpdateEditorFormatMap (object sender, EventArgs args)
+ {
+ var editorFormat = editorFormatMapService.GetEditorFormatMap ("text");
+ editorFormat.BeginBatchUpdate ();
+ var theme = SyntaxHighlightingService.GetEditorTheme (IdeApp.Preferences.ColorScheme.Value);
+ var settingsMap = new Dictionary<string, ThemeSetting> ();
+ var defaultSettings = theme.Settings[0];
+ for (var i = 1; i < theme.Settings.Count; i++) {
+ var setting = theme.Settings[i];
+ settingsMap[setting.Name] = setting;
+ }
+ CreatePlainText (editorFormat, defaultSettings);
+ CreateLineNumberAndSuggestion (editorFormat, defaultSettings);
+ CreateOutlining (editorFormat, defaultSettings);
+ CreateCaret (editorFormat, defaultSettings);
+ CreateSelection (editorFormat, defaultSettings);
+ CreateResourceDictionary (editorFormat, defaultSettings, "text", EditorThemeColors.Foreground, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "Identifier", EditorThemeColors.Foreground, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "TextView Background", EditorThemeColors.Background);
+ CreateResourceDictionary (editorFormat, defaultSettings, "MarkerFormatDefinition/FindHighlight", EditorThemeColors.FindHighlight);
+ CreateResourceDictionary (editorFormat, defaultSettings, "MarkerFormatDefinition/HighlightedReference", EditorThemeColors.UsagesRectangle);
+ CreateResourceDictionary (editorFormat, defaultSettings, "MarkerFormatDefinition/HighlightedDefinition", EditorThemeColors.ChangingUsagesRectangle);
+ CreateResourceDictionary (editorFormat, defaultSettings, "MarkerFormatDefinition/HighlightedWrittenReference", EditorThemeColors.ChangingUsagesRectangle);
+ CreateResourceDictionary (editorFormat, defaultSettings, "brace matching", EditorThemeColors.BracketsForeground);
+ CreateResourceDictionary (editorFormat, defaultSettings, "syntax error", EditorThemeColors.UnderlineError, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "compiler error", EditorThemeColors.UnderlineError, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "other error", EditorThemeColors.UnderlineError, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "compiler warning", EditorThemeColors.UnderlineWarning, EditorFormatDefinition.ForegroundColorId);
+ // This is commented out because VS Windows also doesn't have color set for suggestion underline
+ // which causes squiglly underlinings to be drawn where users don't expect it.
+ //CreateResourceDictionary (editorFormat, defaultSettings, "suggestion", EditorThemeColors.UnderlineSuggestion, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "hinted suggestion", EditorThemeColors.UnderlineSuggestion, EditorFormatDefinition.ForegroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "breakpoint", EditorThemeColors.BreakpointMarker);
+ CreateResourceDictionary (editorFormat, defaultSettings, "breakpoint-disabled", EditorThemeColors.BreakpointMarkerDisabled);
+ CreateResourceDictionary (editorFormat, defaultSettings, "breakpoint-invalid", EditorThemeColors.BreakpointMarkerInvalid);
+ CreateResourceDictionary (editorFormat, defaultSettings, "currentstatement", EditorThemeColors.DebuggerCurrentLineMarker);
+ CreateResourceDictionary (editorFormat, defaultSettings, "returnstatement", EditorThemeColors.DebuggerStackLineMarker);
+ CreateResourceDictionary (editorFormat, defaultSettings, "Indicator Margin", EditorThemeColors.IndicatorMargin);
+ CreateResourceDictionary (editorFormat, defaultSettings, "CurrentLineActiveFormat", EditorThemeColors.LineHighlight, EditorFormatDefinition.ForegroundColorId);
+ // We need theme support for foreground (border) vs background color for the current line highlighter.
+ // Until we have that, set the background brush explicitly since that's what the old editor did, and
+ // all the themes expect that. Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/804158
+ CreateResourceDictionary (editorFormat, defaultSettings, "CurrentLineActiveFormat", EditorThemeColors.LineHighlight, EditorFormatDefinition.BackgroundColorId);
+ CreateResourceDictionary (editorFormat, defaultSettings, "Block Structure Adornments", EditorThemeColors.IndentationGuide);
+ CreateRename (editorFormat, defaultSettings);
+ foreach (var mapping in mappings) {
+ if (settingsMap.TryGetValue (mapping.MDThemeSettingName, out var setting))
+ CreateResourceDictionary (editorFormat, mapping.EditorFormatName, setting);
+ }
+ editorFormat.EndBatchUpdate ();
+ }
+
+ private void CreateRename (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ if (defaultSettings.TryGetColor (EditorThemeColors.PrimaryTemplateHighlighted2, out var selectionColor)) {
+ var resourceDictionary = editorFormat.GetProperties ("RoslynRenameFieldBackgroundAndBorderTag");
+ var (r, g, b, a) = selectionColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.BackgroundColorId] = c;
+ resourceDictionary [MarkerFormatDefinition.BorderId] = new Pen (new SolidColorBrush (c), 2);
+ editorFormat.SetProperties ("RoslynRenameFieldBackgroundAndBorderTag", resourceDictionary);
+ }
+ }
+
+ void CreateSelection (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ if (defaultSettings.TryGetColor (EditorThemeColors.Selection, out var selectionColor)) {
+ var (r, g, b, a) = selectionColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ var resourceDictionary = editorFormat.GetProperties ("Selected Text");
+ resourceDictionary [EditorFormatDefinition.BackgroundBrushId] = new SolidColorBrush (c);
+ editorFormat.SetProperties ("Selected Text", resourceDictionary);
+ }
+ if (defaultSettings.TryGetColor (EditorThemeColors.InactiveSelection, out var inactiveSelectionColor)) {
+ var (r, g, b, a) = inactiveSelectionColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ var resourceDictionary = editorFormat.GetProperties ("Inactive Selected Text");
+ resourceDictionary [EditorFormatDefinition.BackgroundBrushId] = new SolidColorBrush (c);
+ editorFormat.SetProperties ("Inactive Selected Text", resourceDictionary);
+ }
+ }
+
+ void CreateCaret (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ if (defaultSettings.TryGetColor (EditorThemeColors.Caret, out var primaryColor)) {
+ var (r, g, b, a) = primaryColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ var resourceDictionary = editorFormat.GetProperties ("Caret (Primary)");
+ resourceDictionary [EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ editorFormat.SetProperties ("Caret (Primary)", resourceDictionary);
+ }
+ //TODO: Use different color for secondary caret
+ if (defaultSettings.TryGetColor (EditorThemeColors.Caret, out var secondaryColor)) {
+ var (r, g, b, a) = secondaryColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ var resourceDictionary = editorFormat.GetProperties ("Caret (Secondary)");
+ resourceDictionary [EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ editorFormat.SetProperties ("Caret (Secondary)", resourceDictionary);
+ }
+ }
+
+ void SetBrushes (IEditorFormatMap editorFormat, ThemeSetting defaultSettings, string name, string foregroundKey, string backgroundKey = null)
+ {
+ var squareResources = editorFormat.GetProperties (name);
+ if (defaultSettings.TryGetColor (foregroundKey, out var squareForeground)) {
+ var (r, g, b, a) = squareForeground.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ squareResources[EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ }
+ if (backgroundKey != null && defaultSettings.TryGetColor (backgroundKey, out var squareBackground)) {
+ var (r, g, b, a) = squareBackground.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ squareResources[EditorFormatDefinition.BackgroundBrushId] = new SolidColorBrush (c);
+ }
+ editorFormat.SetProperties (name, squareResources);
+ }
+
+ void CreateOutlining (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ // There is EditorThemeColors.FoldCross and EditorThemeColors.FoldCrossBackground
+ // but old editor is using ForeGround and FoldLine colors...
+ SetBrushes (editorFormat, defaultSettings, "outlining.square", EditorThemeColors.Foreground, EditorThemeColors.FoldLine);
+ SetBrushes (editorFormat, defaultSettings, "outlining.collapsehintadornment", EditorThemeColors.LineHighlight, EditorThemeColors.LineHighlight);
+ SetBrushes (editorFormat, defaultSettings, "outlining.verticalrule", EditorThemeColors.FoldLine);
+ SetBrushes (editorFormat, defaultSettings, "Collapsible Text (Collapsed)", EditorThemeColors.CollapsedText);
+ }
+
+ void CreateResourceDictionary (IEditorFormatMap editorFormat, string formatName, ThemeSetting setting)
+ {
+ var resourceDictionary = editorFormat.GetProperties (formatName);
+ HslColor color;
+ if (setting.TryGetColor (EditorThemeColors.Foreground, out color)) {
+ var (r, g, b, a) = color.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.ForegroundColorId] = c;
+ resourceDictionary [EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ }
+ if (setting.TryGetColor (EditorThemeColors.Background, out color)) {
+ var (r, g, b, a) = color.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.BackgroundColorId] = c;
+ resourceDictionary [EditorFormatDefinition.BackgroundBrushId] = new SolidColorBrush (c);
+ }
+
+ if (setting.TryGetSetting ("fontStyle", out var style)) {
+ resourceDictionary [ClassificationFormatDefinition.IsBoldId] = style.Contains ("bold");
+ }
+ editorFormat.SetProperties (formatName, resourceDictionary);
+ }
+
+ static void CreateResourceDictionary (IEditorFormatMap editorFormat, ThemeSetting defaultSettings, string vsName, string settingName, string key = EditorFormatDefinition.BackgroundColorId, string brushKey = null)
+ {
+ ResourceDictionary resourceDictionary = editorFormat.GetProperties (vsName);
+ if (defaultSettings.TryGetColor (settingName, out var backgroundColor)) {
+ var (r, g, b, a) = backgroundColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [key] = c;
+
+ if (brushKey == null) {
+ if (key == EditorFormatDefinition.ForegroundColorId) {
+ brushKey = EditorFormatDefinition.ForegroundBrushId;
+ } else if (key == EditorFormatDefinition.BackgroundColorId) {
+ brushKey = EditorFormatDefinition.BackgroundBrushId;
+ }
+ }
+ if (brushKey != null) {
+ resourceDictionary [brushKey] = new SolidColorBrush (c);
+ }
+ }
+ editorFormat.SetProperties (vsName, resourceDictionary);
+ }
+
+ static readonly string [] editorFormatDefinitionNamesForLineNumberMarginTheme = { "Line Number", "Suggestion Margin" };
+
+ static void CreateLineNumberAndSuggestion (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ foreach (var definitionName in editorFormatDefinitionNamesForLineNumberMarginTheme) {
+ var resourceDictionary = editorFormat.GetProperties (definitionName);
+ if (defaultSettings.TryGetColor ("gutterForeground", out var foregroundColor)) {
+ var (r, g, b, a) = foregroundColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.ForegroundColorId] = c;
+ resourceDictionary [EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ }
+ if (defaultSettings.TryGetColor ("gutter", out var backgroundColor)) {
+ var (r, g, b, a) = backgroundColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.BackgroundColorId] = c;
+ resourceDictionary [EditorFormatDefinition.BackgroundBrushId] = new SolidColorBrush (c);
+ }
+ editorFormat.SetProperties (definitionName, resourceDictionary);
+ }
+ }
+
+ void CreatePlainText (IEditorFormatMap editorFormat, ThemeSetting defaultSettings)
+ {
+ var resourceDictionary = editorFormat.GetProperties ("Plain Text");
+ if (defaultSettings.TryGetColor ("foreground", out var foregroundColor)) {
+ var (r, g, b, a) = foregroundColor.ToRgba ();
+ var c = Color.FromArgb (a, r, g, b);
+ resourceDictionary [EditorFormatDefinition.ForegroundColorId] = c;
+ resourceDictionary [EditorFormatDefinition.ForegroundBrushId] = new SolidColorBrush (c);
+ }
+ var fontName = Ide.Editor.DefaultSourceEditorOptions.Instance.FontName;
+ if (!double.TryParse (fontName.Substring (fontName.LastIndexOf (' ') + 1), out var fontSize)) {
+ fontSize = 12;
+ LoggingService.LogError ($"Failed to parse font size from font name {fontName}");
+ }
+ fontName = fontName.Remove (fontName.LastIndexOf (' '));
+
+ AddFontToDictionary (resourceDictionary, fontName, fontSize);
+
+ editorFormat.SetProperties ("Plain Text", resourceDictionary);
+ }
+
+ protected abstract void AddFontToDictionary (ResourceDictionary resourceDictionary, string fontName, double fontSize);
+ }
+}
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/Makefile.am b/main/src/addins/MonoDevelop.UnitTesting.NUnit/Makefile.am
deleted file mode 100644
index 313b99438e..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-SUBDIRS = NUnitRunner NUnit3Runner .
-
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/MonoDevelop.UnitTesting.NUnit.csproj b/main/src/addins/MonoDevelop.UnitTesting.NUnit/MonoDevelop.UnitTesting.NUnit.csproj
index d1986634aa..143ff30a44 100644
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/MonoDevelop.UnitTesting.NUnit.csproj
+++ b/main/src/addins/MonoDevelop.UnitTesting.NUnit/MonoDevelop.UnitTesting.NUnit.csproj
@@ -15,10 +15,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Core" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/Makefile.am b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnit3Runner.csproj b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnit3Runner.csproj
index 71f54a1bb6..45e051fb25 100644
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnit3Runner.csproj
+++ b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/NUnit3Runner.csproj
@@ -13,26 +13,13 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="nunit.engine">
- <HintPath>..\..\..\..\packages\NUnit.Engine.3.0.1\lib\nunit.engine.dll</HintPath>
- </Reference>
- <Reference Include="nunit.engine.api">
- <HintPath>..\..\..\..\packages\NUnit.Engine.3.0.1\lib\nunit.engine.api.dll</HintPath>
- </Reference>
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\..\packages\NUnit.Engine.3.0.1\lib\Mono.Cecil.dll</HintPath>
- </Reference>
- <Reference Include="nunit-agent">
- <HintPath>..\..\..\..\packages\NUnit.Engine.3.0.1\lib\nunit-agent.exe</HintPath>
- </Reference>
- <Reference Include="nunit-agent-x86">
- <HintPath>..\..\..\..\packages\NUnit.Engine.3.0.1\lib\nunit-agent-x86.exe</HintPath>
- </Reference>
<Reference Include="System.Xml" />
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
+ <PackageReference Include="NUnit.Engine" Version="$(NuGetVersionNUnit3)" PrivateAssets="runtime" />
+ <IncludeCopyLocal Include="Mono.Cecil.dll" />
+ <IncludeCopyLocal Include="nunit-agent-x86.exe" />
+ <IncludeCopyLocal Include="nunit-agent.exe" />
+ <IncludeCopyLocal Include="nunit.engine.api.dll" />
+ <IncludeCopyLocal Include="nunit.engine.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
@@ -48,8 +35,5 @@
<Compile Include="NUnitTestRunner.cs" />
<Compile Include="EventListenerWrapper.cs" />
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/packages.config b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/packages.config
deleted file mode 100644
index e97c693122..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnit3Runner/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="NUnit.Engine" version="3.0.1" targetFramework="net45" />
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/Makefile.am b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/NUnitRunner.csproj b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/NUnitRunner.csproj
index 313e369fc1..227b513900 100644
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/NUnitRunner.csproj
+++ b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/NUnitRunner.csproj
@@ -13,22 +13,15 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="nunit.framework">
- <HintPath>..\..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="nunit.core">
- <HintPath>..\..\..\..\packages\NUnit.Runners.2.6.4\tools\lib\nunit.core.dll</HintPath>
- </Reference>
- <Reference Include="nunit.core.interfaces">
- <HintPath>..\..\..\..\packages\NUnit.Runners.2.6.4\tools\lib\nunit.core.interfaces.dll</HintPath>
- </Reference>
- <Reference Include="nunit.util">
- <HintPath>..\..\..\..\packages\NUnit.Runners.2.6.4\tools\lib\nunit.util.dll</HintPath>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
+ <PackageReference Include="NUnit" Version="$(NuGetVersionNUnit2)" PrivateAssets="runtime" />
+ <PackageReference Include="NUnitV2.Core" Version="$(NuGetVersionNUnit2)" PrivateAssets="runtime" />
+ <!-- this is hacky but there is no package that exposes nunit.util.dll as a lib assembly -->
+ <DownloadNupkg Include="NUnit.Runners" Version="$(NuGetVersionNUnit2)" />
+ <Reference Include="nunit.util" HintPath="$(DownloadNupkgDirectory)NUnit.Runners.$(NuGetVersionNUnit2)\tools\lib\nunit.util.dll" />
+ <IncludeCopyLocal Include="nunit.framework.dll" />
+ <IncludeCopyLocal Include="nunit.core.dll" />
+ <IncludeCopyLocal Include="nunit.core.interfaces.dll" />
+ <IncludeCopyLocal Include="nunit.util.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="NUnitTestRunner.cs" />
@@ -44,8 +37,5 @@
<Link>RemoteTestResult.cs</Link>
</Compile>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/packages.config b/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/packages.config
deleted file mode 100644
index 78668f5172..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting.NUnit/NUnitRunner/packages.config
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="NUnit" version="2.6.4" targetFramework="net40" />
- <package id="NUnit.Runners" version="2.6.4" targetFramework="net40" />
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Makefile.am b/main/src/addins/MonoDevelop.UnitTesting/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/MonoDevelop.UnitTesting.Tests.csproj b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/MonoDevelop.UnitTesting.Tests.csproj
index 038b342b64..98c4976552 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/MonoDevelop.UnitTesting.Tests.csproj
+++ b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/MonoDevelop.UnitTesting.Tests.csproj
@@ -14,30 +14,12 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="System.Runtime.InteropServices.RuntimeInformation">
- <HintPath>..\..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.CoreUtilities">
- <HintPath>..\..\..\..\packages\Microsoft.TestPlatform.ObjectModel.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.PlatformAbstractions">
- <HintPath>..\..\..\..\packages\Microsoft.TestPlatform.ObjectModel.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel">
- <HintPath>..\..\..\..\packages\Microsoft.TestPlatform.ObjectModel.15.5.0-preview-20170919-04\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
- </Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
- </Reference>
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BasicTests.cs" />
@@ -50,10 +32,12 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\tests\UnitTests\UnitTests.csproj">
<Project>{1497D0A8-AFF1-4938-BC22-BE79B358BA5B}</Project>
<Name>UnitTests</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
@@ -68,6 +52,7 @@
<ProjectReference Include="..\MonoDevelop.UnitTesting.csproj">
<Project>{A7A4246D-CEC4-42DF-A3C1-C31B9F51C4EC}</Project>
<Name>MonoDevelop.UnitTesting</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\MonoDevelop.DotNetCore\MonoDevelop.DotNetCore.csproj">
<Project>{6868153E-41EA-43A4-A81A-C1E7256373F7}</Project>
@@ -75,8 +60,5 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/packages.config b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/packages.config
deleted file mode 100644
index e1bc7cc738..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.Tests/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.TestPlatform.ObjectModel" version="15.5.0-preview-20170919-04" targetFramework="net461" />
- <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
- <package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
- <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs
index a70082fb5c..5e17f52100 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestAdapter.cs
@@ -210,6 +210,8 @@ namespace MonoDevelop.UnitTesting.VsTest
{
string vsTestConsoleExeFolder = Path.Combine (Path.GetDirectoryName (typeof (VsTestAdapter).Assembly.Location), "VsTestConsole");
string vsTestConsoleExe = Path.Combine (vsTestConsoleExeFolder, "vstest.console.exe");
+ if (!File.Exists (vsTestConsoleExe))
+ LoggingService.LogError ("vstest.console.exe not found : " + vsTestConsoleExe);
var executionCommand = Runtime.ProcessService.CreateCommand (vsTestConsoleExe);
executionCommand.Arguments = GetVSTestArguments (vsTestConsoleExe, port);
executionCommand.WorkingDirectory = vsTestConsoleExeFolder;
diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestUnitTest.cs b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestUnitTest.cs
index fe4b4fc3eb..899b262ed6 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestUnitTest.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.VsTest/VsTestUnitTest.cs
@@ -39,7 +39,7 @@ namespace MonoDevelop.UnitTesting.VsTest
{
class VsTestUnitTest : UnitTest, IVsTestTestProvider
{
- public Project Project { get; private set; }
+ public MonoDevelop.Projects.Project Project { get; private set; }
TestCase test;
IVsTestTestRunner testRunner;
string name;
@@ -48,7 +48,7 @@ namespace MonoDevelop.UnitTesting.VsTest
protected VsTestUnitTest(string displayName) : base (displayName)
{ }
- public VsTestUnitTest (IVsTestTestRunner testRunner, TestCase test, Project project)
+ public VsTestUnitTest (IVsTestTestRunner testRunner, TestCase test, MonoDevelop.Projects.Project project)
: base (test.DisplayName)
{
this.Project = project;
diff --git a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj
index c46aebd964..8c886db1e9 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj
+++ b/main/src/addins/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.csproj
@@ -15,48 +15,17 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Core" />
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Runtime.InteropServices.RuntimeInformation">
- <HintPath>..\..\..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.ObjectModel">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.ObjectModel.15.5.0-preview-20170919-04\lib\net451\Microsoft.VisualStudio.TestPlatform.ObjectModel.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.CommunicationUtilities">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.CommunicationUtilities.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.CoreUtilities">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.PlatformAbstractions">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.PlatformAbstractions.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TestPlatform.VsTestConsole.TranslationLayer">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0-preview-20170919-04\lib\net451\Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.TestPlatform.Common">
- <HintPath>..\..\..\packages\Microsoft.TestPlatform.TranslationLayer.15.5.0-preview-20170919-04\lib\net451\Microsoft.VisualStudio.TestPlatform.Common.dll</HintPath>
- </Reference>
+ <PackageReference Include="Microsoft.TestPlatform.TranslationLayer" Version="$(NuGetVersionMicrosoftTestPlatform)" />
+ <IncludeCopyLocal Include="Microsoft.TestPlatform.CoreUtilities.dll" />
+ <IncludeCopyLocal Include="Microsoft.TestPlatform.PlatformAbstractions.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.TestPlatform.ObjectModel.dll" />
+ <IncludeCopyLocal Include="Microsoft.TestPlatform.CommunicationUtilities.dll" />
+ <IncludeCopyLocal Include="Microsoft.TestPlatform.VsTestConsole.TranslationLayer.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.TestPlatform.Common.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -183,26 +152,27 @@
<Compile Include="MonoDevelop.UnitTesting.VsTest\VsTestRunAdapter.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
<InternalsVisibleTo Include="MonoDevelop.UnitTesting.Tests" />
</ItemGroup>
<ItemGroup>
- <VsTestConsole Include="..\..\..\packages\Microsoft.TestPlatform.15.5.0-preview-20170919-04\tools\net451\**\*.*">
- <Visible>false</Visible>
- </VsTestConsole>
- <VsTestConsole Remove="..\..\..\packages\Microsoft.TestPlatform.15.5.0-preview-20170919-04\tools\net451\Extensions\**\*.*" />
- </ItemGroup>
- <ItemGroup>
- <VsTestConsoleExtensions Include="..\..\..\packages\Microsoft.TestPlatform.15.5.0-preview-20170919-04\tools\net451\Extensions\Microsoft.TestPlatform.TestHostRuntimeProvider.dll">
- <Visible>false</Visible>
- </VsTestConsoleExtensions>
- <VsTestConsoleExtensions Include="..\..\..\packages\Microsoft.TestPlatform.15.5.0-preview-20170919-04\tools\net451\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll">
- <Visible>false</Visible>
- </VsTestConsoleExtensions>
+ <DownloadNupkg Include="Microsoft.TestPlatform" Version="$(NuGetVersionMicrosoftTestPlatform)" />
</ItemGroup>
- <Target Name="CopyTestAdapters" BeforeTargets="Build">
+
+ <Target Name="CopyTestAdapters" AfterTargets="DownloadNupkg">
+ <ItemGroup>
+ <VsTestConsole Include="$(DownloadNupkgDirectory)Microsoft.TestPlatform.$(NuGetVersionMicrosoftTestPlatform)\tools\net451\**\*.*">
+ <Visible>false</Visible>
+ </VsTestConsole>
+ <VsTestConsole Remove="$(DownloadNupkgDirectory)Microsoft.TestPlatform.$(NuGetVersionMicrosoftTestPlatform)\tools\net451\Extensions\**\*.*" />
+ </ItemGroup>
+ <ItemGroup>
+ <VsTestConsoleExtensions Include="$(DownloadNupkgDirectory)Microsoft.TestPlatform.$(NuGetVersionMicrosoftTestPlatform)\tools\net451\Extensions\Microsoft.TestPlatform.TestHostRuntimeProvider.dll">
+ <Visible>false</Visible>
+ </VsTestConsoleExtensions>
+ <VsTestConsoleExtensions Include="$(DownloadNupkgDirectory)Microsoft.TestPlatform.$(NuGetVersionMicrosoftTestPlatform)\tools\net451\Extensions\Microsoft.VisualStudio.TestPlatform.Extensions.Trx.TestLogger.dll">
+ <Visible>false</Visible>
+ </VsTestConsoleExtensions>
+ </ItemGroup>
<Copy SourceFiles="@(VsTestConsole)" DestinationFolder="$(OutputPath)\VsTestConsole\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(VsTestConsoleExtensions)" DestinationFolder="$(OutputPath)\VsTestConsole\Extensions\" SkipUnchangedFiles="true" />
</Target>
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs
index 62b40b80b6..ba03343c15 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractResultsStore.cs
@@ -403,11 +403,11 @@ namespace MonoDevelop.UnitTesting
[Serializable]
public class TestRecordCollection: CollectionBase
{
- public new TestRecord this [int n] {
+ public TestRecord this [int n] {
get { return (TestRecord) ((IList)this) [n]; }
}
- public new TestRecord this [string name] {
+ public TestRecord this [string name] {
get {
for (int n=0; n<List.Count; n++)
if (((TestRecord)List [n]).Name == name)
@@ -425,7 +425,7 @@ namespace MonoDevelop.UnitTesting
[Serializable]
public class UnitTestResultCollection: CollectionBase
{
- public new UnitTestResult this [int n] {
+ public UnitTestResult this [int n] {
get { return (UnitTestResult) ((IList)this) [n]; }
}
diff --git a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractUnitTestEditorExtension.cs b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractUnitTestEditorExtension.cs
index 27464ad5b2..b10ef4840b 100644
--- a/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractUnitTestEditorExtension.cs
+++ b/main/src/addins/MonoDevelop.UnitTesting/Services/AbstractUnitTestEditorExtension.cs
@@ -42,6 +42,7 @@ using MonoDevelop.UnitTesting.Commands;
namespace MonoDevelop.UnitTesting
{
+ [Obsolete ("Needs to be ported to new editor")]
public abstract class AbstractUnitTestTextEditorExtension : TextEditorExtension
{
const string TestMarkersPath = "/MonoDevelop/UnitTesting/UnitTestMarkers";
diff --git a/main/src/addins/MonoDevelop.UnitTesting/packages.config b/main/src/addins/MonoDevelop.UnitTesting/packages.config
deleted file mode 100644
index 483a5ea57a..0000000000
--- a/main/src/addins/MonoDevelop.UnitTesting/packages.config
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.TestPlatform" version="15.5.0-preview-20170919-04" targetFramework="net461" />
- <package id="Microsoft.TestPlatform.ObjectModel" version="15.5.0-preview-20170919-04" targetFramework="net461" />
- <package id="Microsoft.TestPlatform.TranslationLayer" version="15.5.0-preview-20170919-04" targetFramework="net461" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
- <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
- <package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
- <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.WebReferences/Makefile.am b/main/src/addins/MonoDevelop.WebReferences/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/MonoDevelop.WebReferences/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
index dd917ce6e6..074e7fb168 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
@@ -19,10 +19,6 @@
<Reference Include="System.Core" />
<Reference Include="System.Configuration" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
diff --git a/main/src/addins/MonoDeveloperExtensions/Makefile.am b/main/src/addins/MonoDeveloperExtensions/Makefile.am
deleted file mode 100644
index f558ab2716..0000000000
--- a/main/src/addins/MonoDeveloperExtensions/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-SUBDIRS = . NUnit
-
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_MONOEXTENSIONS
-SKIP=y
-endif
diff --git a/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am b/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am
deleted file mode 100644
index 2665c7ea88..0000000000
--- a/main/src/addins/MonoDeveloperExtensions/NUnit/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_MONOEXTENSIONS
-SKIP=y
-endif
diff --git a/main/src/addins/PerformanceDiagnostics/Makefile.am b/main/src/addins/PerformanceDiagnostics/Makefile.am
deleted file mode 100644
index ead76902f1..0000000000
--- a/main/src/addins/PerformanceDiagnostics/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-SUBDIRS = \
- PerformanceDiagnostics \
- UIThreadMonitorDaemon
-
diff --git a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/Makefile.am b/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/PerformanceDiagnosticsAddIn.csproj b/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/PerformanceDiagnosticsAddIn.csproj
index e224c3e5dc..7d97443164 100644
--- a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/PerformanceDiagnosticsAddIn.csproj
+++ b/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/PerformanceDiagnosticsAddIn.csproj
@@ -16,10 +16,6 @@
<HintPath>..\..\..\..\external\Xamarin.Mac.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -37,6 +33,9 @@
<EmbeddedResource Include="Properties\PerformanceDiagnostics.addin.xml" />
</ItemGroup>
<ItemGroup>
+ <IncludeCopyLocal Include="UIThreadMonitorDaemon.exe" />
+ </ItemGroup>
+ <ItemGroup>
<ProjectReference Include="..\..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
<Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
<Name>MonoDevelop.Ide</Name>
@@ -55,11 +54,9 @@
<ProjectReference Include="..\UIThreadMonitorDaemon\UIThreadMonitorDaemon.csproj">
<Project>{3FDB97B5-916E-4817-8098-41659687A8FF}</Project>
<Name>UIThreadMonitorDaemon</Name>
+ <Private>true</Private>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
diff --git a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/packages.config b/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/PerformanceDiagnostics/PerformanceDiagnostics/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/PerformanceDiagnostics/UIThreadMonitorDaemon/Makefile.am b/main/src/addins/PerformanceDiagnostics/UIThreadMonitorDaemon/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/PerformanceDiagnostics/UIThreadMonitorDaemon/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/TextTemplating/Makefile.am b/main/src/addins/TextTemplating/Makefile.am
deleted file mode 100644
index 0a3a6e73dd..0000000000
--- a/main/src/addins/TextTemplating/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = \
- MonoDevelop.TextTemplating
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
index a1591b8030..f4d393e913 100644
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
@@ -7,6 +7,10 @@
<ProjectGuid>{8CCA39DD-8412-4547-BE7F-0C3D3ACC6FAC}</ProjectGuid>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\..\build\AddIns\MonoDevelop.TextTemplating</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -33,15 +37,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Mono.TextTemplating">
- <HintPath>..\..\..\..\packages\Mono.TextTemplating.1.3.1\lib\net45\Mono.TextTemplating.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
+ <PackageReference Include="Mono.TextTemplating" Version="1.3.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -69,19 +65,12 @@
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
+ <IncludeCopyLocal Include="Mono.TextTemplating.dll" />
</ItemGroup>
<ItemGroup>
- <None Include="Templates\T4TemplateCSharp.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Templates\T4PreprocessedTemplateCSharp.xft.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="packages.config" />
- <None Include="..\..\..\..\packages\Mono.TextTemplating.1.3.1\tools\TextTransform.exe">
- <Link>TextTransform.exe</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
+ <ExtensionContent Include="Templates\**\*.*" />
+ <DownloadNupkg Include="Mono.TextTemplating" Version="1.3.1" />
+ <ExtensionContent Include="$(DownloadNupkgDirectory)Mono.TextTemplating.1.3.1\tools\TextTransform.exe" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config
deleted file mode 100644
index 6cdb1c91af..0000000000
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Mono.TextTemplating" version="1.3.1" targetFramework="net45" />
-</packages>
diff --git a/main/src/addins/VBNetBinding/Makefile.am b/main/src/addins/VBNetBinding/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/VBNetBinding/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/VBNetBinding/VBNetBinding.csproj b/main/src/addins/VBNetBinding/VBNetBinding.csproj
index 8803188490..eb2f06e2db 100644
--- a/main/src/addins/VBNetBinding/VBNetBinding.csproj
+++ b/main/src/addins/VBNetBinding/VBNetBinding.csproj
@@ -39,26 +39,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Drawing" />
<Reference Include="System.Core" />
- <Reference Include="Microsoft.CodeAnalysis.VisualBasic">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
diff --git a/main/src/addins/VersionControl/Makefile.am b/main/src/addins/VersionControl/Makefile.am
deleted file mode 100644
index 9b8e787dbb..0000000000
--- a/main/src/addins/VersionControl/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-
-SUBDIRS = \
- MonoDevelop.VersionControl \
- MonoDevelop.VersionControl.Subversion \
- MonoDevelop.VersionControl.Subversion.Unix \
- MonoDevelop.VersionControl.Git \
- MonoDevelop.VersionControl.Subversion.Tests \
- Subversion.Win32 \
- Subversion.Win32.Tests \
- MonoDevelop.VersionControl.Git.Tests
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
index 88cfbf497e..0ddce1ace5 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/BaseGitRepositoryTests.cs
@@ -192,50 +192,175 @@ namespace MonoDevelop.VersionControl.Git.Tests
Assert.AreEqual (commitCount, repo2.GetHistory (repo2.RootPath, null).Length, "stash2 added extra commit.");
}
- static string GetStashMessageForBranch (string branch)
- {
- return string.Format ("On {0}: __MD_{0}\n\n", branch);
- }
- [Test]
- public void TestGitBranchCreation ()
+ [TestCase (true)]
+ [TestCase (false)]
+ public void TestGitStagedModifiedStatus (bool withDiff)
{
var repo2 = (GitRepository)Repo;
- var monitor = new ProgressMonitor ();
+ var testFile = "file1";
+ var testPath = LocalPath.Combine ("file1");
+ string difftext = string.Empty;
+ AddFile (testFile, "test 1\n", true, true);
+
+ // new file added and committed
+ var status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsFalse (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.Versioned, status.Status);
+ if (withDiff)
+ Assert.IsTrue (string.IsNullOrEmpty (repo2.GenerateDiff (testPath, status).Content));
+
+ // modify the file without staging
+ File.AppendAllText (testPath, "test 2\n");
+ status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsTrue (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.Modified | VersionStatus.Versioned, status.Status);
+
+ if (withDiff) {
+ difftext = @"--- a/file1
++++ b/file1
+@@ -1 +1,2 @@
+ test 1
++test 2
+".Replace ("file1", testFile);
+ var diff = repo2.GenerateDiff (testPath, status);
+ Assert.AreEqual (difftext, diff.Content);
+ }
- AddFile ("file1", "text", true, true);
+ // stage changes
+ LibGit2Sharp.Commands.Stage (repo2.RootRepository, testPath);
+ Assert.IsTrue (status.Equals (Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache)));
- Task.Run (() => repo2.CreateBranch ("branch1", null, null)).Wait ();
+ if (withDiff) {
+ var diff = repo2.GenerateDiff (testPath, status);
+ Assert.AreEqual (difftext, diff.Content);
+ }
- Task.Run (() => repo2.SwitchToBranch (monitor, "branch1")).Wait ();
- // Nothing could be stashed for master. Branch1 should be popped in any case if it exists.
- Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("master")));
- Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+ // modify the file again
+ File.AppendAllText (testPath, "test 3\n");
+ Assert.IsTrue (status.Equals (Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache)));
- Assert.AreEqual ("branch1", repo2.GetCurrentBranch ());
- Assert.IsTrue (File.Exists (LocalPath + "file1"), "Branch not inheriting from current.");
- AddFile ("file2", "text", true, false);
- Task.Run (() => repo2.CreateBranch ("branch2", null, null)).Wait ();
+ if (withDiff) {
+ difftext = @"--- a/file1
++++ b/file1
+@@ -1 +1,3 @@
+ test 1
++test 2
++test 3
+".Replace ("file1", testFile);
+ var diff = repo2.GenerateDiff (testPath, status);
+ Assert.AreEqual (difftext, diff.Content);
+ }
+
+ }
- Task.Run (() => repo2.SwitchToBranch (monitor, "branch2")).Wait ();
- // Branch1 has a stash created and assert clean workdir. Branch2 should be popped in any case.
- Assert.IsTrue (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
- Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch2")));
- Assert.IsTrue (!File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed");
+ [TestCase (false)]
+ [TestCase (true, Ignore = true, IgnoreReason = "Needs to be fixed")]
+ public void TestGitStagedNewFileStatus (bool testUnstagedRemove)
+ {
+ var repo2 = (GitRepository)Repo;
+ var testFile = "file1";
+ var testPath = LocalPath.Combine ("file1");
+ AddFile ("file", null, true, true);
+ AddFile (testFile, "test 1\n", false, false);
+
+ // new file added but not staged
+ var status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsFalse (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.Unversioned, status.Status);
+
+ // stage added file
+ LibGit2Sharp.Commands.Stage (repo2.RootRepository, testPath);
+ status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsTrue (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.ScheduledAdd | VersionStatus.Versioned, status.Status);
+
+ // modify the file without staging
+ File.AppendAllText (testPath, "test 2\n");
+ status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsTrue (status.Equals (Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache)));
+
+ // remove the staged file
+ File.Delete (testPath);
+ // TODO: at this point the file still exists in the index, but should be detected as Unversioned
+ if (testUnstagedRemove) {
+ status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsFalse (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.Unversioned, status.Status);
+ }
- AddFile ("file2", "text", true, false);
- Task.Run (() => repo2.SwitchToBranch (monitor, "branch1")).Wait ();
- // Branch2 has a stash created. Branch1 should be popped with file2 reinstated.
- Assert.True (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch2")));
- Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
- Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed correctly");
+ // stage removed file
+ LibGit2Sharp.Commands.Stage (repo2.RootRepository, testPath);
+ status = Repo.GetVersionInfo (testPath, VersionInfoQueryFlags.IgnoreCache);
+ Assert.IsFalse (status.HasLocalChanges);
+ Assert.AreEqual (VersionStatus.Unversioned, status.Status);
+ }
- Task.Run (() => repo2.SwitchToBranch (monitor, "master")).Wait ();
- Task.Run (() => repo2.RemoveBranch ("branch1")).Wait ();
- Assert.IsFalse (repo2.GetBranches ().Any (b => b.FriendlyName == "branch1"), "Failed to delete branch");
+ static string GetStashMessageForBranch (string branch)
+ {
+ return string.Format ("On {0}: __MD_{0}\n\n", branch);
+ }
- repo2.RenameBranch ("branch2", "branch3");
- Assert.IsTrue (repo2.GetBranches ().Any (b => b.FriendlyName == "branch3") && repo2.GetBranches ().All (b => b.FriendlyName != "branch2"), "Failed to rename branch");
+ [TestCase (false)]
+ [TestCase (true, Ignore = true, IgnoreReason = "We stash now only if there are conflicts, this needs to be updated")]
+ public void TestGitBranchCreation (bool automaticStashCreation)
+ {
+ var autoStashDefault = GitService.StashUnstashWhenSwitchingBranches.Value;
+ GitService.StashUnstashWhenSwitchingBranches.Value = automaticStashCreation;
+ try {
+ var repo2 = (GitRepository)Repo;
+ var monitor = new ProgressMonitor ();
+
+ AddFile ("file1", "text", true, true);
+
+ Task.Run (() => repo2.CreateBranch ("branch1", null, null)).Wait ();
+
+ Task.Run (() => repo2.SwitchToBranch (monitor, "branch1")).Wait ();
+ // Nothing could be stashed for master. Branch1 should be popped in any case if it exists.
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("master")));
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+
+ Assert.AreEqual ("branch1", repo2.GetCurrentBranch ());
+ Assert.IsTrue (File.Exists (LocalPath + "file1"), "Branch not inheriting from current.");
+
+ AddFile ("file2", "text", true, false);
+ Task.Run (() => repo2.CreateBranch ("branch2", null, null)).Wait ();
+
+ Task.Run (() => repo2.SwitchToBranch (monitor, "branch2")).Wait ();
+ if (automaticStashCreation) {
+ // Branch1 has a stash created and assert clean workdir. Branch2 should be popped in any case.
+ Assert.IsTrue (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch2")));
+ Assert.IsTrue (!File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed");
+ } else {
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("master")));
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+ Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were stashed");
+ }
+
+ AddFile ("file2", "text", true, false);
+ Task.Run (() => repo2.SwitchToBranch (monitor, "branch1")).Wait ();
+ // Branch2 has a stash created. Branch1 should be popped with file2 reinstated.
+
+ if (automaticStashCreation) {
+ Assert.True (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch2")));
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+ Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were not stashed correctly");
+ } else {
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch2")));
+ Assert.IsFalse (repo2.GetStashes ().Any (s => s.Message == GetStashMessageForBranch ("branch1")));
+ Assert.IsTrue (File.Exists (LocalPath + "file2"), "Uncommitted changes were stashed");
+ }
+
+ Task.Run (() => repo2.SwitchToBranch (monitor, "master")).Wait ();
+ Task.Run (() => repo2.RemoveBranch ("branch1")).Wait ();
+ Assert.IsFalse (repo2.GetBranches ().Any (b => b.FriendlyName == "branch1"), "Failed to delete branch");
+
+ repo2.RenameBranch ("branch2", "branch3");
+ Assert.IsTrue (repo2.GetBranches ().Any (b => b.FriendlyName == "branch3") && repo2.GetBranches ().All (b => b.FriendlyName != "branch2"), "Failed to rename branch");
+ } finally {
+ GitService.StashUnstashWhenSwitchingBranches.Value = autoStashDefault;
+ }
// TODO: Add CreateBranchFromCommit tests.
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/Makefile.am
deleted file mode 100644
index 5a8c3c50e0..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git.Tests/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_GIT
-SKIP=y
-endif
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am
deleted file mode 100644
index 5a8c3c50e0..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_GIT
-SKIP=y
-endif
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj
index 570f99ad9a..5b156373db 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git.csproj
@@ -127,6 +127,7 @@
<Link>libssh2.license.txt</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+ <IncludeCopyLocal Include="LibGit2Sharp.dll" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="MonoDevelop.VersionControl.Git.Tests" />
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
index cc80abceda..c82a36cb7b 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitRepository.cs
@@ -37,6 +37,7 @@ using ProgressMonitor = MonoDevelop.Core.ProgressMonitor;
using LibGit2Sharp;
using System.Threading.Tasks;
using System.Runtime.ExceptionServices;
+using System.Threading;
namespace MonoDevelop.VersionControl.Git
{
@@ -480,6 +481,14 @@ namespace MonoDevelop.VersionControl.Git
return readingOperationFactory.StartNew (action).RunWaitAndCapture ();
}
+ internal Task<T> RunOperationAsync<T> (Func<T> action, bool hasUICallbacks = false, CancellationToken cancellationToken = default)
+ {
+ EnsureInitialized ();
+ if (hasUICallbacks)
+ EnsureBackgroundThread ();
+ return readingOperationFactory.StartNew (action, cancellationToken);
+ }
+
internal T RunOperation<T> (FilePath localPath, Func<LibGit2Sharp.Repository, T> action, bool hasUICallbacks = false)
{
EnsureInitialized ();
@@ -492,7 +501,12 @@ namespace MonoDevelop.VersionControl.Git
{
if (hasUICallbacks)
EnsureBackgroundThread ();
- blockingOperationFactory.StartNew (action).RunWaitAndCapture ();
+ try {
+ FileService.FreezeEvents ();
+ blockingOperationFactory.StartNew (action).RunWaitAndCapture ();
+ } finally {
+ FileService.ThawEvents ();
+ }
}
internal void RunBlockingOperation (FilePath localPath, Action<LibGit2Sharp.Repository> action, bool hasUICallbacks = false)
@@ -500,7 +514,12 @@ namespace MonoDevelop.VersionControl.Git
EnsureInitialized ();
if (hasUICallbacks)
EnsureBackgroundThread ();
- blockingOperationFactory.StartNew (() => action (GetRepository (localPath))).RunWaitAndCapture ();
+ try {
+ FileService.FreezeEvents ();
+ blockingOperationFactory.StartNew (() => action (GetRepository (localPath))).RunWaitAndCapture ();
+ } finally {
+ FileService.ThawEvents ();
+ }
}
internal T RunBlockingOperation<T> (Func<T> action, bool hasUICallbacks = false)
@@ -508,7 +527,12 @@ namespace MonoDevelop.VersionControl.Git
EnsureInitialized ();
if (hasUICallbacks)
EnsureBackgroundThread ();
- return blockingOperationFactory.StartNew (action).RunWaitAndCapture ();
+ try {
+ FileService.FreezeEvents ();
+ return blockingOperationFactory.StartNew (action).RunWaitAndCapture ();
+ } finally {
+ FileService.ThawEvents ();
+ }
}
internal T RunBlockingOperation<T> (FilePath localPath, Func<LibGit2Sharp.Repository, T> action, bool hasUICallbacks = false)
@@ -516,7 +540,12 @@ namespace MonoDevelop.VersionControl.Git
EnsureInitialized ();
if (hasUICallbacks)
EnsureBackgroundThread ();
- return blockingOperationFactory.StartNew (() => action (GetRepository (localPath))).RunWaitAndCapture ();
+ try {
+ FileService.FreezeEvents ();
+ return blockingOperationFactory.StartNew (() => action (GetRepository (localPath))).RunWaitAndCapture ();
+ } finally {
+ FileService.ThawEvents ();
+ }
}
LibGit2Sharp.Repository GetRepository (FilePath localPath)
@@ -594,7 +623,7 @@ namespace MonoDevelop.VersionControl.Git
protected override RevisionPath[] OnGetRevisionChanges (Revision revision)
{
- var rev = (GitRevision) revision;
+ var rev = (GitRevision)revision;
return RunOperation (() => {
var commit = rev.GetCommit (RootRepository);
if (commit == null)
@@ -620,6 +649,47 @@ namespace MonoDevelop.VersionControl.Git
});
}
+ protected override Task<RevisionPath []> OnGetRevisionChangesAsync (Revision revision, CancellationToken cancellationToken = default)
+ {
+ var rev = (GitRevision)revision;
+ return RunOperationAsync (() => {
+ var commit = rev.GetCommit (RootRepository);
+ if (commit == null)
+ return new RevisionPath [0];
+
+ var paths = new List<RevisionPath> ();
+ var parent = commit.Parents.FirstOrDefault ();
+ var changes = RootRepository.Diff.Compare<TreeChanges> (parent?.Tree, commit.Tree);
+
+ foreach (var entry in changes.Added) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.Path), RevisionAction.Add, null));
+ }
+ foreach (var entry in changes.Copied) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.Path), RevisionAction.Add, null));
+ }
+ foreach (var entry in changes.Deleted) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.OldPath), RevisionAction.Delete, null));
+ }
+ foreach (var entry in changes.Renamed) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.Path), RootRepository.FromGitPath (entry.OldPath), RevisionAction.Replace, null));
+ }
+ foreach (var entry in changes.Modified) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.Path), RevisionAction.Modify, null));
+ }
+ foreach (var entry in changes.TypeChanged) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ paths.Add (new RevisionPath (RootRepository.FromGitPath (entry.Path), RevisionAction.Modify, null));
+ }
+ return paths.ToArray ();
+ }, cancellationToken: cancellationToken);
+ }
+
+
protected override IEnumerable<VersionInfo> OnGetVersionInfo (IEnumerable<FilePath> paths, bool getRemoteStatus)
{
try {
@@ -768,7 +838,7 @@ namespace MonoDevelop.VersionControl.Git
fstatus |= VersionStatus.ScheduledAdd;
else if ((status & (FileStatus.DeletedFromIndex | FileStatus.DeletedFromWorkdir)) != 0)
fstatus |= VersionStatus.ScheduledDelete;
- else if ((status & (FileStatus.TypeChangeInWorkdir | FileStatus.ModifiedInWorkdir)) != 0)
+ else if ((status & (FileStatus.TypeChangeInWorkdir | FileStatus.TypeChangeInIndex | FileStatus.ModifiedInWorkdir | FileStatus.ModifiedInIndex)) != 0)
fstatus |= VersionStatus.Modified;
else if ((status & (FileStatus.RenamedInIndex | FileStatus.RenamedInWorkdir)) != 0)
fstatus |= VersionStatus.ScheduledReplace;
@@ -876,9 +946,9 @@ namespace MonoDevelop.VersionControl.Git
GitUpdateOptions options = GitService.StashUnstashWhenUpdating ? GitUpdateOptions.NormalUpdate : GitUpdateOptions.UpdateSubmodules;
if (GitService.UseRebaseOptionWhenPulling)
- Rebase (RootRepository.Head.TrackedBranch.FriendlyName, options, monitor);
+ Rebase (RootRepository.Head.TrackedBranch.FriendlyName, options, monitor, true);
else
- Merge (RootRepository.Head.TrackedBranch.FriendlyName, options, monitor);
+ Merge (RootRepository.Head.TrackedBranch.FriendlyName, options, monitor, true);
monitor.Step (1);
}
@@ -965,8 +1035,9 @@ namespace MonoDevelop.VersionControl.Git
monitor.EndTask ();
}
- bool CommonPreMergeRebase (GitUpdateOptions options, ProgressMonitor monitor, out int stashIndex)
+ bool CommonPreMergeRebase (GitUpdateOptions options, ProgressMonitor monitor, out int stashIndex, string branch, string actionButtonTitle, bool isUpdate)
{
+ FileService.FreezeEvents ();
stashIndex = -1;
monitor.Step (1);
@@ -977,12 +1048,11 @@ namespace MonoDevelop.VersionControl.Git
modified = true;
if (modified) {
- if (MessageService.GenericAlert (
- MonoDevelop.Ide.Gui.Stock.Question,
- GettextCatalog.GetString ("You have uncommitted changes"),
- GettextCatalog.GetString ("What do you want to do?"),
- AlertButton.Cancel,
- new AlertButton (GettextCatalog.GetString ("Stash"))) == AlertButton.Cancel)
+ if (!PromptToStash (
+ GettextCatalog.GetString ("There are local changes that conflict with changes committed in the <b>{0}</b> branch. Would you like to stash the changes and continue?", branch),
+ actionButtonTitle,
+ isUpdate ? GettextCatalog.GetString ("Automatically stash/unstash changes when merging/rebasing") : null,
+ isUpdate ? GitService.StashUnstashWhenUpdating : null))
return false;
options |= GitUpdateOptions.SaveLocalChanges;
@@ -1001,6 +1071,27 @@ namespace MonoDevelop.VersionControl.Git
return true;
}
+ bool PromptToStash (string messageText, string actionButtonTitle, string dontAskLabel = null, ConfigurationProperty<bool> dontAskProperty = null)
+ {
+ bool showDontAsk = !string.IsNullOrEmpty (dontAskLabel) && dontAskProperty != null;
+ var message = new GenericMessage {
+ Text = GettextCatalog.GetString ("Conflicting local changes found"),
+ SecondaryText = messageText,
+ Icon = Ide.Gui.Stock.Question
+ };
+ if (showDontAsk) {
+ message.AddOption (nameof (dontAskLabel), dontAskLabel, dontAskProperty.Value);
+ }
+ message.Buttons.Add (AlertButton.Cancel);
+ message.Buttons.Add (new AlertButton (actionButtonTitle));
+ message.DefaultButton = 1;
+
+ var result = MessageService.GenericAlert (message) != AlertButton.Cancel;
+ if (result && showDontAsk)
+ dontAskProperty.Value = message.GetOptionValue (nameof (dontAskLabel));
+ return result;
+ }
+
bool ConflictResolver(LibGit2Sharp.Repository repository, ProgressMonitor monitor, Commit resetToIfFail, string message)
{
foreach (var conflictFile in repository.Index.Conflicts) {
@@ -1026,32 +1117,41 @@ namespace MonoDevelop.VersionControl.Git
void CommonPostMergeRebase(int stashIndex, GitUpdateOptions options, ProgressMonitor monitor, Commit oldHead)
{
- if ((options & GitUpdateOptions.SaveLocalChanges) == GitUpdateOptions.SaveLocalChanges) {
- monitor.Step (1);
-
- // Restore local changes
- if (stashIndex != -1) {
- monitor.Log.WriteLine (GettextCatalog.GetString ("Restoring local changes"));
- ApplyStash (monitor, stashIndex);
- // FIXME: No StashApplyStatus.Conflicts here.
- if (RootRepository.Index.Conflicts.Any () && !ConflictResolver (RootRepository, monitor, oldHead, string.Empty))
- PopStash (monitor, stashIndex);
- else
- RunBlockingOperation (() => RootRepository.Stashes.Remove (stashIndex));
+ try {
+ if ((options & GitUpdateOptions.SaveLocalChanges) == GitUpdateOptions.SaveLocalChanges) {
monitor.Step (1);
+
+ // Restore local changes
+ if (stashIndex != -1) {
+ monitor.Log.WriteLine (GettextCatalog.GetString ("Restoring local changes"));
+ ApplyStash (monitor, stashIndex);
+ // FIXME: No StashApplyStatus.Conflicts here.
+ if (RootRepository.Index.Conflicts.Any () && !ConflictResolver (RootRepository, monitor, oldHead, string.Empty))
+ PopStash (monitor, stashIndex);
+ else
+ RunBlockingOperation (() => RootRepository.Stashes.Remove (stashIndex));
+ monitor.Step (1);
+ }
}
+ } finally {
+ FileService.ThawEvents ();
+ monitor.EndTask ();
}
- monitor.EndTask ();
}
public void Rebase (string branch, GitUpdateOptions options, ProgressMonitor monitor)
{
+ Rebase (branch, options, monitor, false);
+ }
+
+ void Rebase (string branch, GitUpdateOptions options, ProgressMonitor monitor, bool isUpdate)
+ {
int stashIndex = -1;
var oldHead = RootRepository.Head.Tip;
try {
monitor.BeginTask (GettextCatalog.GetString ("Rebasing"), 5);
- if (!CommonPreMergeRebase (options, monitor, out stashIndex))
+ if (!CommonPreMergeRebase (options, monitor, out stashIndex, branch, GettextCatalog.GetString ("Stash and Rebase"), isUpdate))
return;
RunBlockingOperation (() => {
@@ -1086,6 +1186,11 @@ namespace MonoDevelop.VersionControl.Git
public void Merge (string branch, GitUpdateOptions options, ProgressMonitor monitor, FastForwardStrategy strategy = FastForwardStrategy.Default)
{
+ Merge (branch, options, monitor, false, strategy);
+ }
+
+ void Merge (string branch, GitUpdateOptions options, ProgressMonitor monitor, bool isUpdate, FastForwardStrategy strategy = FastForwardStrategy.Default)
+ {
int stashIndex = -1;
Signature sig = GetSignature ();
@@ -1096,7 +1201,8 @@ namespace MonoDevelop.VersionControl.Git
try {
monitor.BeginTask (GettextCatalog.GetString ("Merging"), 5);
- CommonPreMergeRebase (options, monitor, out stashIndex);
+ if (!CommonPreMergeRebase (options, monitor, out stashIndex, branch, GettextCatalog.GetString ("Stash and Merge"), isUpdate))
+ return;
// Do a merge.
MergeResult mergeResult = RunBlockingOperation (() =>
RootRepository.Merge (branch, sig, new MergeOptions {
@@ -1456,7 +1562,7 @@ namespace MonoDevelop.VersionControl.Git
{
try {
return RunOperation (versionInfo.LocalPath, repository => {
- var patch = repository.Diff.Compare<Patch> (new [] { repository.ToGitPath (versionInfo.LocalPath) });
+ var patch = repository.Diff.Compare<Patch> (repository.Head?.Tip?.Tree, DiffTargets.WorkingDirectory | DiffTargets.Index, new [] { repository.ToGitPath (versionInfo.LocalPath) });
// Trim the header by taking out the first 2 lines.
int diffStart = patch.Content.IndexOf ('\n', patch.Content.IndexOf ('\n') + 1);
return new DiffInfo (baseLocalPath, versionInfo.LocalPath, patch.Content.Substring (diffStart + 1));
@@ -1676,6 +1782,33 @@ namespace MonoDevelop.VersionControl.Git
return RunOperation (() => RootRepository.Head.FriendlyName);
}
+ void SwitchBranchInternal (ProgressMonitor monitor, string branch)
+ {
+ int progress = 0;
+ RunBlockingOperation (() => LibGit2Sharp.Commands.Checkout (RootRepository, branch, new CheckoutOptions {
+ OnCheckoutProgress = (path, completedSteps, totalSteps) => OnCheckoutProgress (completedSteps, totalSteps, monitor, ref progress),
+ OnCheckoutNotify = (string path, CheckoutNotifyFlags flags) => RefreshFile (path, flags),
+ CheckoutNotifyFlags = refreshFlags,
+ }), true);
+ monitor.Step (1);
+
+ if (GitService.StashUnstashWhenSwitchingBranches) {
+ try {
+ // Restore the branch stash
+ var stashIndex = RunOperation (() => GetStashForBranch (RootRepository.Stashes, branch));
+ if (stashIndex != -1)
+ PopStash (monitor, stashIndex);
+ } catch (Exception e) {
+ monitor.ReportError (GettextCatalog.GetString ("Restoring stash for branch {0} failed", branch), e);
+ }
+ }
+ monitor.Step (1);
+
+ Runtime.RunInMainThread (() => {
+ BranchSelectionChanged?.Invoke (this, EventArgs.Empty);
+ }).Ignore ();
+ }
+
public bool SwitchToBranch (ProgressMonitor monitor, string branch)
{
Signature sig = GetSignature ();
@@ -1684,10 +1817,31 @@ namespace MonoDevelop.VersionControl.Git
if (sig == null)
return false;
- monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), GitService.StashUnstashWhenSwitchingBranches ? 4 : 2);
+ FileService.FreezeEvents ();
+ try {
+ // try to switch without stashing
+ monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), 2);
+ SwitchBranchInternal (monitor, branch);
+ } catch (CheckoutConflictException ex) {
+ // retry with stashing
+ monitor.EndTask ();
+ if (!GitService.StashUnstashWhenSwitchingBranches) {
+ if (!PromptToStash (
+ GettextCatalog.GetString ("There are local changes that conflict with changes committed in the <b>{0}</b> branch. Would you like to stash the changes and continue with the checkout?", branch),
+ GettextCatalog.GetString ("Stash and Switch"),
+ GettextCatalog.GetString ("Automatically stash/unstash changes when switching branches"),
+ GitService.StashUnstashWhenSwitchingBranches)) {
+ // if canceled, report the error and return
+ monitor.ReportError (GettextCatalog.GetString ("Switching to branch {0} failed", branch), ex);
+ return false;
+ }
+ }
- if (GitService.StashUnstashWhenSwitchingBranches) {
+ // stash automatically is selected or user requested a stash
+
+ monitor.BeginTask (GettextCatalog.GetString ("Switching to branch {0}", branch), 4);
// Remove the stash for this branch, if exists
+ // TODO: why do with do this?
string currentBranch = RootRepository.Head.FriendlyName;
stashIndex = RunOperation (() => GetStashForBranch (RootRepository.Stashes, currentBranch));
if (stashIndex != -1)
@@ -1697,31 +1851,21 @@ namespace MonoDevelop.VersionControl.Git
return false;
monitor.Step (1);
- }
- try {
- int progress = 0;
- RunBlockingOperation (() => LibGit2Sharp.Commands.Checkout (RootRepository, branch, new CheckoutOptions {
- OnCheckoutProgress = (path, completedSteps, totalSteps) => OnCheckoutProgress (completedSteps, totalSteps, monitor, ref progress),
- OnCheckoutNotify = (string path, CheckoutNotifyFlags flags) => RefreshFile (path, flags),
- CheckoutNotifyFlags = refreshFlags,
- }), true);
- } finally {
- // Restore the branch stash
- if (GitService.StashUnstashWhenSwitchingBranches) {
- stashIndex = RunOperation (() => GetStashForBranch (RootRepository.Stashes, branch));
- if (stashIndex != -1)
- PopStash (monitor, stashIndex);
- monitor.Step (1);
+ try {
+ SwitchBranchInternal (monitor, branch);
+ return true;
+ } catch (Exception e) {
+ monitor.ReportError (GettextCatalog.GetString ("Switching to branch {0} failed", branch), e);
+ } finally {
}
+ } catch (Exception ex) {
+ monitor.ReportError (GettextCatalog.GetString ("Switching to branch {0} failed", branch), ex);
+ } finally {
+ monitor.EndTask ();
+ FileService.ThawEvents ();
}
-
- Runtime.RunInMainThread (() => {
- BranchSelectionChanged?.Invoke (this, EventArgs.Empty);
- }).Ignore ();
-
- monitor.EndTask ();
- return true;
+ return false;
}
static string GetStashName (string branchName)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
index 56758d6a20..5ca708d42d 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitService.cs
@@ -38,8 +38,8 @@ namespace MonoDevelop.VersionControl.Git
public static class GitService
{
public static ConfigurationProperty<bool> UseRebaseOptionWhenPulling = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.UseRebaseOptionWhenPulling", true);
- public static ConfigurationProperty<bool> StashUnstashWhenUpdating = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenUpdating", true);
- public static ConfigurationProperty<bool> StashUnstashWhenSwitchingBranches = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenSwitchingBranches", true);
+ public static ConfigurationProperty<bool> StashUnstashWhenUpdating = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenUpdating", false);
+ public static ConfigurationProperty<bool> StashUnstashWhenSwitchingBranches = ConfigurationProperty.Create ("MonoDevelop.VersionControl.Git.StashUnstashWhenSwitchingBranches", false);
public static void Push (GitRepository repo)
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs
index eaa0f68658..bdfc63799a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/GitVersionControl.cs
@@ -52,6 +52,17 @@ namespace MonoDevelop.VersionControl.Git
get {
return true;
}
+ }
+
+ static GitVersionControl ()
+ {
+ // soft settings migration for 8.0 without slowing down Ide initialization
+ // should work fine for most users using git on regular basis
+ if (Ide.IdeApp.IsInitialRunAfterUpgrade && Ide.IdeApp.UpgradedFromVersion < new System.Version (8, 0, 1, 2800)) {
+ GitService.StashUnstashWhenSwitchingBranches.Set (false);
+ GitService.StashUnstashWhenUpdating.Set (false);
+ PropertyService.SaveProperties ();
+ }
}
public override Repository GetRepositoryReference (FilePath path, string id)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/IGitCredentialsProvider.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/IGitCredentialsProvider.cs
index abf7bda887..50bf1cfa7c 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/IGitCredentialsProvider.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Git/MonoDevelop.VersionControl.Git/IGitCredentialsProvider.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Mono.Addins;
namespace MonoDevelop.VersionControl.Git
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/Makefile.am
deleted file mode 100644
index a6dcb0e8e1..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Tests/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_SUBVERSION
-SKIP=y
-endif
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/Makefile.am
deleted file mode 100644
index a6dcb0e8e1..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion.Unix/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_SUBVERSION
-SKIP=y
-endif
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/Makefile.am
deleted file mode 100644
index a6dcb0e8e1..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_SUBVERSION
-SKIP=y
-endif
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am b/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs
index 718adcd7ab..cd80d2ceac 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Dialogs/SelectRepositoryDialog.cs
@@ -345,7 +345,7 @@ namespace MonoDevelop.VersionControl.Dialogs
if (dlg.Run ()) {
defaultPath = dlg.SelectedFile;
VersionControlDefaultPath.Value = defaultPath;
- AppendRelativePath ();
+ entryFolder.Text = defaultPath;
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
index 76b1765619..54824f5ab1 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/CellRendererDiff.cs
@@ -6,7 +6,6 @@ using Gdk;
using MonoDevelop.Ide;
using MonoDevelop.Components;
using System.Text;
-using Mono.TextEditor;
using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.VersionControl.Views
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
index 3c1d3e50ab..4d50359bb6 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/ComparisonWidget.cs
@@ -56,6 +56,18 @@ namespace MonoDevelop.VersionControl.Views
}
}
+ public DropDownBox OriginalCombo {
+ get {
+ return originalComboBox;
+ }
+ }
+
+ public DropDownBox DiffCombo {
+ get {
+ return diffComboBox;
+ }
+ }
+
internal override MonoTextEditor MainEditor {
get {
return editors[1];
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
index c8de96214b..2f2e24858e 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DiffView.cs
@@ -94,7 +94,8 @@ namespace MonoDevelop.VersionControl.Views
protected override void OnSelected ()
{
info.Start ();
- ComparisonWidget.UpdateLocalText ();
+ if (ComparisonWidget.originalComboBox.Text == GettextCatalog.GetString ("Local"))
+ ComparisonWidget.UpdateLocalText ();
var buffer = info.Controller.GetContent<MonoDevelop.Ide.Editor.TextEditor> ();
if (buffer != null) {
var loc = buffer.CaretLocation;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
index b98b5a3148..42b5aca81a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/DropDownBox.cs
@@ -28,7 +28,6 @@ using System;
using System.ComponentModel;
using MonoDevelop.Ide;
using Gtk;
-using Mono.TextEditor;
using MonoDevelop.Components;
namespace MonoDevelop.VersionControl.Views
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
index 6ead3827a4..c95bcc643e 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/LogWidget.cs
@@ -1,4 +1,4 @@
-//
+//
// LogWidget.cs
//
// Author:
@@ -37,6 +37,8 @@ using System.Linq;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Fonts;
using Humanizer;
+using System.Diagnostics;
+using System.Threading.Tasks;
namespace MonoDevelop.VersionControl.Views
{
@@ -204,7 +206,7 @@ namespace MonoDevelop.VersionControl.Views
treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated;
scrolledwindowFiles.Child = treeviewFiles;
scrolledwindowFiles.ShowAll ();
-
+
changedpathstore = new TreeStore (typeof(Xwt.Drawing.Image), typeof (string), // icon/file name
typeof(Xwt.Drawing.Image), typeof (string), // icon/operation
typeof (string), // path
@@ -218,7 +220,7 @@ namespace MonoDevelop.VersionControl.Views
colChangedFile.Title = GettextCatalog.GetString ("File");
colChangedFile.PackStart (crp, false);
colChangedFile.PackStart (crt, true);
- colChangedFile.AddAttribute (crp, "image", 2);
+ colChangedFile.SetCellDataFunc (crp, HandleNodeCellDataFunc);
colChangedFile.AddAttribute (crt, "text", 3);
treeviewFiles.AppendColumn (colChangedFile);
@@ -284,6 +286,15 @@ namespace MonoDevelop.VersionControl.Views
Ide.Gui.Styles.Changed += HandleStylesChanged;
}
+ static void HandleNodeCellDataFunc (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
+ {
+ var cri = (CellRendererImage)cell;
+ var image = tree_model.GetValue (iter, 2) as Xwt.Drawing.Image;
+ cri.Visible = image != null;
+ if (image != null)
+ cri.Image = image;
+ }
+
[GLib.ConnectBeforeAttribute]
void LabelRevision_ButtonPressEvent (object o, ButtonPressEventArgs args)
{
@@ -566,6 +577,8 @@ namespace MonoDevelop.VersionControl.Views
protected override void OnDestroyed ()
{
+ selectionCancellationTokenSource.Cancel ();
+
textviewDetails.ButtonPressEvent -= TextviewDetails_ButtonPressEvent;
labelDate.ButtonPressEvent -= LabelDate_ButtonPressEvent;
@@ -732,71 +745,79 @@ namespace MonoDevelop.VersionControl.Views
} while (treeviewLog.Model.IterNext (ref iter));
}
}
-
+
+ CancellationTokenSource selectionCancellationTokenSource = new CancellationTokenSource ();
+
void TreeSelectionChanged (object o, EventArgs args)
{
Revision d = SelectedRevision;
changedpathstore.Clear ();
textviewDetails.Buffer.Clear ();
-
if (d == null)
return;
- revertButton.GetNativeWidget<Gtk.Widget> ().Sensitive = revertToButton.GetNativeWidget<Gtk.Widget> ().Sensitive = true;
- Gtk.TreeIter selectIter = Gtk.TreeIter.Zero;
- bool select = false;
- foreach (RevisionPath rp in info.Repository.GetRevisionChanges (d)) {
- Xwt.Drawing.Image actionIcon;
- string action = null;
- if (rp.Action == RevisionAction.Add) {
- action = GettextCatalog.GetString ("Add");
- actionIcon = ImageService.GetIcon (Gtk.Stock.Add, Gtk.IconSize.Menu);
- } else if (rp.Action == RevisionAction.Delete) {
- action = GettextCatalog.GetString ("Delete");
- actionIcon = ImageService.GetIcon (Gtk.Stock.Remove, Gtk.IconSize.Menu);
- } else if (rp.Action == RevisionAction.Modify) {
- action = GettextCatalog.GetString ("Modify");
- actionIcon = ImageService.GetIcon ("gtk-edit", Gtk.IconSize.Menu);
- } else if (rp.Action == RevisionAction.Replace) {
- action = GettextCatalog.GetString ("Replace");
- actionIcon = ImageService.GetIcon ("gtk-edit", Gtk.IconSize.Menu);
- } else {
- action = rp.ActionDescription;
- actionIcon = ImageService.GetIcon (MonoDevelop.Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);
+ changedpathstore.AppendValues (null, null, null, GettextCatalog.GetString ("Retrieving history…"), null, null, null);
+
+ selectionCancellationTokenSource.Cancel ();
+ selectionCancellationTokenSource = new CancellationTokenSource ();
+ var token = selectionCancellationTokenSource.Token;
+ Task.Run (() => info.Repository.GetRevisionChangesAsync (d, token)).ContinueWith (result => {
+ changedpathstore.Clear ();
+ revertButton.GetNativeWidget<Gtk.Widget> ().Sensitive = revertToButton.GetNativeWidget<Gtk.Widget> ().Sensitive = true;
+ Gtk.TreeIter selectIter = Gtk.TreeIter.Zero;
+ bool select = false;
+ foreach (RevisionPath rp in result.Result) {
+ Xwt.Drawing.Image actionIcon;
+ string action = null;
+ if (rp.Action == RevisionAction.Add) {
+ action = GettextCatalog.GetString ("Add");
+ actionIcon = ImageService.GetIcon (Gtk.Stock.Add, Gtk.IconSize.Menu);
+ } else if (rp.Action == RevisionAction.Delete) {
+ action = GettextCatalog.GetString ("Delete");
+ actionIcon = ImageService.GetIcon (Gtk.Stock.Remove, Gtk.IconSize.Menu);
+ } else if (rp.Action == RevisionAction.Modify) {
+ action = GettextCatalog.GetString ("Modify");
+ actionIcon = ImageService.GetIcon ("gtk-edit", Gtk.IconSize.Menu);
+ } else if (rp.Action == RevisionAction.Replace) {
+ action = GettextCatalog.GetString ("Replace");
+ actionIcon = ImageService.GetIcon ("gtk-edit", Gtk.IconSize.Menu);
+ } else {
+ action = rp.ActionDescription;
+ actionIcon = ImageService.GetIcon (MonoDevelop.Ide.Gui.Stock.Empty, Gtk.IconSize.Menu);
+ }
+ Xwt.Drawing.Image fileIcon = DesktopService.GetIconForFile (rp.Path, Gtk.IconSize.Menu);
+ var iter = changedpathstore.AppendValues (actionIcon, action, fileIcon, System.IO.Path.GetFileName (rp.Path), System.IO.Path.GetDirectoryName (rp.Path), rp.Path, null);
+ changedpathstore.AppendValues (iter, null, null, null, null, null, rp.Path, null);
+ if (rp.Path == preselectFile) {
+ selectIter = iter;
+ select = true;
+ }
}
- Xwt.Drawing.Image fileIcon = IdeServices.DesktopService.GetIconForFile (rp.Path, Gtk.IconSize.Menu);
- var iter = changedpathstore.AppendValues (actionIcon, action, fileIcon, System.IO.Path.GetFileName (rp.Path), System.IO.Path.GetDirectoryName (rp.Path), rp.Path, null);
- changedpathstore.AppendValues (iter, null, null, null, null, null, rp.Path, null);
- if (rp.Path == preselectFile) {
- selectIter = iter;
- select = true;
+ if (!string.IsNullOrEmpty (d.Email)) {
+ imageUser.Show ();
+ imageUser.LoadUserIcon (d.Email, 32);
+ } else
+ imageUser.Hide ();
+
+ labelAuthor.Text = d.Author;
+ labelDate.Text = d.Time.ToString ();
+ string rev = d.Name;
+ if (rev.Length > 15) {
+ currentRevisionShortened = true;
+ rev = d.ShortName;
+ } else
+ currentRevisionShortened = false;
+
+ labelRevision.Text = GettextCatalog.GetString ("Revision: {0}", rev);
+ textviewDetails.Buffer.Text = d.Message;
+
+ if (select) {
+ treeviewFiles.Selection.SelectIter (selectIter);
+ treeviewFiles.ExpandRow (treeviewFiles.Model.GetPath (selectIter), true);
}
- }
- if (!string.IsNullOrEmpty (d.Email)) {
- imageUser.Show ();
- imageUser.LoadUserIcon (d.Email, 32);
- }
- else
- imageUser.Hide ();
-
- labelAuthor.Text = d.Author;
- labelDate.Text = d.Time.ToString ();
- string rev = d.Name;
- if (rev.Length > 15) {
- currentRevisionShortened = true;
- rev = d.ShortName;
- } else
- currentRevisionShortened = false;
-
- labelRevision.Text = GettextCatalog.GetString ("Revision: {0}", rev);
- textviewDetails.Buffer.Text = d.Message;
-
- if (select) {
- treeviewFiles.Selection.SelectIter (selectIter);
- treeviewFiles.ExpandRow (treeviewFiles.Model.GetPath (selectIter), true);
- }
+ }, token, TaskContinuationOptions.OnlyOnRanToCompletion, Runtime.MainTaskScheduler);
}
-
+
void UpdateHistory ()
{
scrolledLoading.Hide ();
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
index a662180f1e..0341fce554 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/StatusView.cs
@@ -12,7 +12,6 @@ using MonoDevelop.Components;
using MonoDevelop.Components.Commands;
using MonoDevelop.Projects;
using MonoDevelop.Ide;
-using Mono.TextEditor;
using System.Text;
using MonoDevelop.Ide.Gui.Documents;
using MonoDevelop.Ide.Gui;
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
index e9317f97b6..37d3c1edde 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
@@ -527,7 +527,7 @@
<InternalsVisibleTo Include="MonoDevelop.MacDev" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
+ <PackageReference Include="Humanizer.Core" Version="2.2.0" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
index 4242b48760..6153628e47 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Repository.cs
@@ -10,6 +10,7 @@ using System.Linq;
using System.Threading;
using MonoDevelop.Core.Instrumentation;
using MonoDevelop.Ide;
+using System.Threading.Tasks;
namespace MonoDevelop.VersionControl
{
@@ -29,7 +30,9 @@ namespace MonoDevelop.VersionControl
get;
protected set;
}
-
+
+ internal FilePath RepositoryPath { get; set; }
+
public event EventHandler NameChanged;
protected Repository ()
@@ -103,6 +106,8 @@ namespace MonoDevelop.VersionControl
}
}
+ VersionControlService.repositoryCache.TryRemove (RepositoryPath.CanonicalPath, out _);
+
infoCache?.Dispose ();
infoCache = null;
}
@@ -489,7 +494,7 @@ namespace MonoDevelop.VersionControl
/// <param name='revision'>
/// A revision
/// </param>
- public RevisionPath[] GetRevisionChanges (Revision revision)
+ public RevisionPath [] GetRevisionChanges (Revision revision)
{
using (var tracker = Instrumentation.GetRevisionChangesCounter.BeginTiming (new RepositoryMetadata (VersionControlSystem))) {
try {
@@ -500,8 +505,20 @@ namespace MonoDevelop.VersionControl
}
}
}
-
-
+
+ public Task<RevisionPath []> GetRevisionChangesAsync (Revision revision, CancellationToken cancellationToken = default)
+ {
+ using (var tracker = Instrumentation.GetRevisionChangesCounter.BeginTiming (new RepositoryMetadata (VersionControlSystem))) {
+ try {
+ return OnGetRevisionChangesAsync (revision, cancellationToken);
+ } catch {
+ tracker.Metadata.SetFailure ();
+ throw;
+ }
+ }
+ }
+
+
// Returns the content of the file in the base revision of the working copy.
public abstract string GetBaseText (FilePath localFile);
@@ -652,8 +669,8 @@ namespace MonoDevelop.VersionControl
var metadata = new RevertMetadata (VersionControlSystem) { PathsCount = localPaths.Length, Recursive = recurse, OperationType = RevertMetadata.RevertType.LocalChanges };
using (var tracker = Instrumentation.RevertCounter.BeginTiming (metadata, monitor.CancellationToken)) {
try {
- ClearCachedVersionInfo (localPaths);
OnRevert (localPaths, recurse, monitor);
+ ClearCachedVersionInfo (localPaths);
} catch {
metadata.SetFailure ();
throw;
@@ -786,10 +803,13 @@ namespace MonoDevelop.VersionControl
public void DeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
+ FileUpdateEventArgs args = new FileUpdateEventArgs ();
var metadata = new DeleteMetadata (VersionControlSystem) { PathsCount = localPaths.Length, Force = force, KeepLocal = keepLocal };
using (var tracker = Instrumentation.DeleteCounter.BeginTiming (metadata, monitor.CancellationToken)) {
try {
OnDeleteFiles (localPaths, force, monitor, keepLocal);
+ foreach (var path in localPaths)
+ args.Add (new FileUpdateEventInfo (this, path, false));
} catch (Exception e) {
LoggingService.LogError ("Failed to delete file", e);
metadata.SetFailure ();
@@ -799,6 +819,8 @@ namespace MonoDevelop.VersionControl
}
}
ClearCachedVersionInfo (localPaths);
+ if (args.Any ())
+ VersionControlService.NotifyFileStatusChanged (args);
}
protected abstract void OnDeleteFiles (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal);
@@ -810,10 +832,13 @@ namespace MonoDevelop.VersionControl
public void DeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal = true)
{
+ FileUpdateEventArgs args = new FileUpdateEventArgs ();
var metadata = new DeleteMetadata (VersionControlSystem) { PathsCount = localPaths.Length, Force = force, KeepLocal = keepLocal };
using (var tracker = Instrumentation.DeleteCounter.BeginTiming (metadata, monitor.CancellationToken)) {
try {
OnDeleteDirectories (localPaths, force, monitor, keepLocal);
+ foreach (var path in localPaths)
+ args.Add (new FileUpdateEventInfo (this, path, true));
} catch (Exception e) {
LoggingService.LogError ("Failed to delete directory", e);
metadata.SetFailure ();
@@ -823,6 +848,8 @@ namespace MonoDevelop.VersionControl
}
}
ClearCachedVersionInfo (localPaths);
+ if (args.Any ())
+ VersionControlService.NotifyFileStatusChanged (args);
}
protected abstract void OnDeleteDirectories (FilePath[] localPaths, bool force, ProgressMonitor monitor, bool keepLocal);
@@ -1012,7 +1039,12 @@ namespace MonoDevelop.VersionControl
/// <param name='revision'>
/// A revision
/// </param>
- protected abstract RevisionPath[] OnGetRevisionChanges (Revision revision);
+ protected abstract RevisionPath [] OnGetRevisionChanges (Revision revision);
+
+ protected virtual Task<RevisionPath []> OnGetRevisionChangesAsync (Revision revision, CancellationToken cancellationToken)
+ {
+ return Task.FromResult (OnGetRevisionChanges (revision));
+ }
// Ignores a file for version control operations.
public void Ignore (FilePath[] localPath)
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Revision.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Revision.cs
index 64f3a36a2e..f7c164a311 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Revision.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Revision.cs
@@ -1,6 +1,5 @@
using System;
using System.Text;
-using Mono.TextEditor;
namespace MonoDevelop.VersionControl
{
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UrlBasedRepositoryEditor.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UrlBasedRepositoryEditor.cs
index 33c295cfc0..3944e0a52a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UrlBasedRepositoryEditor.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/UrlBasedRepositoryEditor.cs
@@ -146,7 +146,7 @@ namespace MonoDevelop.VersionControl
{
if (repo.Uri != null || repo.SupportedProtocols.Any (p => repositoryUrlEntry.Text.StartsWith (p + "://", StringComparison.Ordinal))) {
repositoryPathEntry.Sensitive = true;
- bool isUrl = Protocol != "file";
+ bool isUrl = IsUrl;
repositoryServerEntry.Sensitive = isUrl;
repositoryUserEntry.Sensitive = isUrl;
repositoryPortSpin.Sensitive = isUrl;
@@ -157,20 +157,33 @@ namespace MonoDevelop.VersionControl
repositoryPortSpin.Sensitive = false;
}
}
-
+
+ const string FileProtocol = "file";
+ bool IsUrl => Protocol != FileProtocol;
+
void SetRepoUrl ()
{
if (!repo.SupportedProtocols.Contains (Protocol)) {
repo.Url = string.Empty;
return;
}
- UriBuilder ub = new UriBuilder ();
- ub.Host = repositoryServerEntry.Text;
- ub.Scheme = Protocol;
- ub.UserName = repositoryUserEntry.Text;
- ub.Port = (int)repositoryPortSpin.Value;
- ub.Path = repositoryPathEntry.Text;
- repo.Url = ub.ToString ();
+
+ if (IsUrl) {
+ var ub = new UriBuilder ();
+ ub.Scheme = Protocol;
+ ub.Host = repositoryServerEntry.Text;
+ ub.UserName = repositoryUserEntry.Text;
+ ub.Port = (int)repositoryPortSpin.Value;
+ ub.Path = repositoryPathEntry.Text;
+
+ if (string.IsNullOrEmpty (ub.Host)) {
+ repo.Url = string.Format ("{0}://", Protocol);
+ } else {
+ repo.Url = ub.ToString ();
+ }
+ } else {
+ repo.Url = string.Format ("{0}://{1}", Protocol, repositoryPathEntry.Text);
+ }
}
protected virtual void OnRepositoryServerEntryChanged(object sender, System.EventArgs e)
@@ -217,13 +230,11 @@ namespace MonoDevelop.VersionControl
protected void OnRepositoryUrlEntryClipboardPasted (object sender, EventArgs e)
{
- Gtk.Clipboard clip = GetClipboard (Gdk.Atom.Intern ("CLIPBOARD", false));
+ var clip = GetClipboard (Gdk.Atom.Intern ("CLIPBOARD", false));
clip.RequestText (delegate (Gtk.Clipboard clp, string text) {
- if (String.IsNullOrEmpty (text))
+ if (string.IsNullOrEmpty (text))
return;
-
- Uri url;
- if (Uri.TryCreate (text, UriKind.Absolute, out url))
+ if (repo.IsUrlValid (text))
repositoryUrlEntry.Text = text;
});
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
index 18f500f298..c5d9b098d2 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionControlService.cs
@@ -5,8 +5,8 @@ using System.IO;
using System.Xml;
using System.Collections;
using System.Collections.Generic;
-using System.Threading;
-using System.Runtime.Serialization.Formatters.Binary;
+using System.Threading;
+using System.Runtime.Serialization.Formatters.Binary;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Core;
@@ -23,16 +23,16 @@ namespace MonoDevelop.VersionControl
{
public class VersionControlService
{
- static Xwt.Drawing.Image overlay_modified;
- static Xwt.Drawing.Image overlay_removed;
- static Xwt.Drawing.Image overlay_renamed;
- static Xwt.Drawing.Image overlay_conflicted;
- static Xwt.Drawing.Image overlay_added;
- internal static Xwt.Drawing.Image overlay_controled;
- static Xwt.Drawing.Image overlay_unversioned;
- static Xwt.Drawing.Image overlay_protected;
- static Xwt.Drawing.Image overlay_locked;
- static Xwt.Drawing.Image overlay_unlocked;
+ static Xwt.Drawing.Image overlay_modified;
+ static Xwt.Drawing.Image overlay_removed;
+ static Xwt.Drawing.Image overlay_renamed;
+ static Xwt.Drawing.Image overlay_conflicted;
+ static Xwt.Drawing.Image overlay_added;
+ internal static Xwt.Drawing.Image overlay_controled;
+ static Xwt.Drawing.Image overlay_unversioned;
+ static Xwt.Drawing.Image overlay_protected;
+ static Xwt.Drawing.Image overlay_locked;
+ static Xwt.Drawing.Image overlay_unlocked;
static Xwt.Drawing.Image overlay_ignored;
static Xwt.Drawing.Image icon_modified;
@@ -49,9 +49,9 @@ namespace MonoDevelop.VersionControl
static VersionControlConfiguration configuration;
static DataContext dataContext = new DataContext ();
- public static event FileUpdateEventHandler FileStatusChanged;
- public static event CommitEventHandler PrepareCommit;
- public static event CommitEventHandler BeginCommit;
+ public static event FileUpdateEventHandler FileStatusChanged;
+ public static event CommitEventHandler PrepareCommit;
+ public static event CommitEventHandler BeginCommit;
public static event CommitEventHandler EndCommit;
static VersionControlService ()
@@ -69,7 +69,7 @@ namespace MonoDevelop.VersionControl
overlay_unlocked = Xwt.Drawing.Image.FromResource("unlocked-overlay-16.png");
overlay_locked = Xwt.Drawing.Image.FromResource("locked-overlay-16.png");
overlay_ignored = Xwt.Drawing.Image.FromResource("ignored-overlay-16.png");
-
+
icon_modified = ImageService.GetIcon ("vc-file-modified", Gtk.IconSize.Menu);
icon_removed = ImageService.GetIcon ("vc-file-removed", Gtk.IconSize.Menu);
icon_conflicted = ImageService.GetIcon ("vc-file-conflicted", Gtk.IconSize.Menu);
@@ -93,9 +93,9 @@ namespace MonoDevelop.VersionControl
};
AddinManager.AddExtensionNodeHandler ("/MonoDevelop/VersionControl/VersionControlSystems", OnExtensionChanged);
- }
+ }
- // This exists for the sole purpose of calling the static constructor.
+ // This exists for the sole purpose of calling the static constructor.
public static void Initialize ()
{
}
@@ -136,7 +136,7 @@ namespace MonoDevelop.VersionControl
handlers.Remove (vcs);
}
}
-
+
public static Xwt.Drawing.Image LoadOverlayIconForStatus(VersionStatus status)
{
if ((status & VersionStatus.Ignored) != 0)
@@ -146,17 +146,17 @@ namespace MonoDevelop.VersionControl
return overlay_unversioned;
switch (status & VersionStatus.LocalChangesMask) {
- case VersionStatus.Modified:
- case VersionStatus.ScheduledIgnore:
+ case VersionStatus.Modified:
+ case VersionStatus.ScheduledIgnore:
return overlay_modified;
case VersionStatus.ScheduledReplace:
return overlay_renamed;
- case VersionStatus.Conflicted:
+ case VersionStatus.Conflicted:
return overlay_conflicted;
- case VersionStatus.ScheduledAdd:
+ case VersionStatus.ScheduledAdd:
return overlay_added;
- case VersionStatus.Missing:
- case VersionStatus.ScheduledDelete:
+ case VersionStatus.Missing:
+ case VersionStatus.ScheduledDelete:
return overlay_removed;
}
@@ -169,46 +169,46 @@ namespace MonoDevelop.VersionControl
if ((status & VersionStatus.LockRequired) != 0)
return overlay_protected;
- return null;
+ return null;
}
-
+
public static Xwt.Drawing.Image LoadIconForStatus (VersionStatus status)
{
switch (status & VersionStatus.LocalChangesMask) {
- case VersionStatus.Modified:
- case VersionStatus.ScheduledReplace:
+ case VersionStatus.Modified:
+ case VersionStatus.ScheduledReplace:
return icon_modified;
- case VersionStatus.Conflicted:
+ case VersionStatus.Conflicted:
return icon_conflicted;
- case VersionStatus.ScheduledAdd:
+ case VersionStatus.ScheduledAdd:
return icon_added;
- case VersionStatus.Missing:
- case VersionStatus.ScheduledDelete:
+ case VersionStatus.Missing:
+ case VersionStatus.ScheduledDelete:
return icon_removed;
}
- return null;
+ return null;
}
-
+
public static string GetStatusLabel (VersionStatus status)
{
if ((status & VersionStatus.Versioned) == 0)
return GettextCatalog.GetString ("Unversioned");
-
+
switch (status & VersionStatus.LocalChangesMask) {
- case VersionStatus.Modified:
- return GettextCatalog.GetString ("Modified");
- case VersionStatus.ScheduledReplace:
+ case VersionStatus.Modified:
+ return GettextCatalog.GetString ("Modified");
+ case VersionStatus.ScheduledReplace:
return GettextCatalog.GetString ("Renamed");
- case VersionStatus.Conflicted:
+ case VersionStatus.Conflicted:
return GettextCatalog.GetString ("Conflict");
- case VersionStatus.ScheduledAdd:
+ case VersionStatus.ScheduledAdd:
return GettextCatalog.GetString ("Add");
- case VersionStatus.ScheduledDelete:
+ case VersionStatus.ScheduledDelete:
return GettextCatalog.GetString ("Delete");
- case VersionStatus.Missing:
+ case VersionStatus.Missing:
return GettextCatalog.GetString ("Missing");
}
- return String.Empty;
+ return String.Empty;
}
internal static ConcurrentDictionary<Repository, InternalRepositoryReference> referenceCache = new ConcurrentDictionary<Repository, InternalRepositoryReference> ();
@@ -261,6 +261,7 @@ namespace MonoDevelop.VersionControl
var result = detectedVCS?.GetRepositoryReference (p, id);
if (result != null) {
Instrumentation.Repositories.Inc (new RepositoryMetadata (detectedVCS));
+ result.RepositoryPath = p.CanonicalPath;
return result;
}
// never add null values
@@ -317,18 +318,18 @@ namespace MonoDevelop.VersionControl
static Hashtable GetCommitComments ()
{
if (comments != null)
- return comments;
-
+ return comments;
+
ResolveEventHandler localResolve = (s, args) =>
AppDomain.CurrentDomain.GetAssemblies ()
- .FirstOrDefault (asm => asm.GetName ().FullName == args.Name);
-
+ .FirstOrDefault (asm => asm.GetName ().FullName == args.Name);
+
string file = CommitMessagesFile;
if (File.Exists (file)) {
FileStream stream = null;
- try {
- AppDomain.CurrentDomain.AssemblyResolve += localResolve;
-
+ try {
+ AppDomain.CurrentDomain.AssemblyResolve += localResolve;
+
stream = File.OpenRead (file);
BinaryFormatter formatter = new BinaryFormatter ();
comments = (Hashtable) formatter.Deserialize (stream);
@@ -350,8 +351,8 @@ namespace MonoDevelop.VersionControl
// If there is an error, just discard the file
LoggingService.LogError (ex.ToString ());
comments = new Hashtable ();
- } finally {
- AppDomain.CurrentDomain.AssemblyResolve -= localResolve;
+ } finally {
+ AppDomain.CurrentDomain.AssemblyResolve -= localResolve;
if (stream != null)
stream.Close ();
}
@@ -462,8 +463,8 @@ namespace MonoDevelop.VersionControl
SetCommitComment (it.LocalPath, null, false);
SaveComments ();
}
- }
-
+ }
+
public static void NotifyFileStatusChanged (IEnumerable<VersionControlItem> items)
{
FileUpdateEventArgs vargs = new FileUpdateEventArgs ();
@@ -568,17 +569,17 @@ namespace MonoDevelop.VersionControl
if (!file.StartsWith (rootPath + Path.DirectorySeparatorChar, StringComparison.Ordinal))
return;
if (!File.Exists (file))
- return;
- if (files.Add (file)) {
- string dir = Path.GetDirectoryName (file);
- while (dir != rootPath && files.Add (dir))
- dir = Path.GetDirectoryName (dir);
+ return;
+ if (files.Add (file)) {
+ string dir = Path.GetDirectoryName (file);
+ while (dir != rootPath && files.Add (dir))
+ dir = Path.GetDirectoryName (dir);
}
}
static void OnEntryAdded (object o, SolutionItemEventArgs args)
- {
- if (args is SolutionItemChangeEventArgs && ((SolutionItemChangeEventArgs) args).Reloading)
+ {
+ if (args is SolutionItemChangeEventArgs && ((SolutionItemChangeEventArgs) args).Reloading)
return;
// handles addition of solutions and projects
@@ -604,16 +605,21 @@ namespace MonoDevelop.VersionControl
// While we /could/ call repo.Add with `recursive = true', we don't
// necessarily want to add files under the project/solution directory
- // that may not be a part of this project/solution.
-
+ // that may not be a part of this project/solution.
+
var files = new HashSet<string> { path };
SolutionItemAddFiles (path, entry, files);
-
+
+ if (entry is SolutionFolder && files.Count == 1)
+ return;
+
using (ProgressMonitor monitor = GetStatusMonitor ()) {
- var status = repo.GetDirectoryVersionInfo (path, false, true);
- foreach (var v in status) {
- if (!v.IsVersioned && files.Contains (v.LocalPath))
- repo.Add (v.LocalPath, false, monitor);
+ foreach (var file in files) {
+ var status = repo.GetDirectoryVersionInfo (file, false, false);
+ foreach (var v in status) {
+ if (!v.IsVersioned && files.Contains (v.LocalPath))
+ repo.Add (v.LocalPath, false, monitor);
+ }
}
}
@@ -818,8 +824,8 @@ namespace MonoDevelop.VersionControl
}
class InternalRepositoryReference: IDisposable
- {
- readonly Repository repo;
+ {
+ readonly Repository repo;
public InternalRepositoryReference (Repository repo)
{
this.repo = repo;
@@ -834,7 +840,6 @@ namespace MonoDevelop.VersionControl
public void Dispose ()
{
VersionControlService.referenceCache.TryRemove (repo, out _);
- VersionControlService.repositoryCache.TryRemove (repo.RootPath.CanonicalPath, out _);
repo.Unref ();
}
}
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
index 6fddfbe30c..84593eb239 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/VersionInfoCache.cs
@@ -23,20 +23,19 @@
// 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.Core;
using System.Collections.Generic;
using System.Linq;
-using System.Threading;
using System;
-
+using System.Collections.Concurrent;
+
namespace MonoDevelop.VersionControl
{
class VersionInfoCache : IDisposable
{
- ReaderWriterLockSlim fileLock = new ReaderWriterLockSlim();
- Dictionary<FilePath,VersionInfo> fileStatus = new Dictionary<FilePath, VersionInfo> ();
- ReaderWriterLockSlim directoryLock = new ReaderWriterLockSlim ();
- Dictionary<FilePath,DirectoryStatus> directoryStatus = new Dictionary<FilePath, DirectoryStatus> ();
+ readonly ConcurrentDictionary<FilePath, VersionInfo> fileStatus = new ConcurrentDictionary<FilePath, VersionInfo> ();
+ readonly ConcurrentDictionary<FilePath, DirectoryStatus> directoryStatus = new ConcurrentDictionary<FilePath, DirectoryStatus> ();
Repository repo;
public VersionInfoCache (Repository repo)
@@ -46,68 +45,54 @@ namespace MonoDevelop.VersionControl
public void ClearCachedVersionInfo (FilePath rootPath)
{
- var canonicalPath = rootPath.CanonicalPath;
-
- try {
- fileLock.EnterWriteLock ();
- foreach (var p in fileStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == canonicalPath))
- p.Value.RequiresRefresh = true;
- } finally {
- fileLock.ExitWriteLock ();
+ FileUpdateEventArgs args = null;
+ var canonicalPath = rootPath.CanonicalPath;
+
+ foreach (var p in fileStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == canonicalPath)) {
+ p.Value.RequiresRefresh = true;
+
+ var a = new FileUpdateEventArgs (repo, p.Value.LocalPath, p.Value.IsDirectory);
+ if (args == null)
+ args = a;
+ else
+ args.MergeWith (a);
}
-
- try {
- directoryLock.EnterWriteLock ();
- foreach (var p in directoryStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == canonicalPath))
- p.Value.RequiresRefresh = true;
- } finally {
- directoryLock.ExitWriteLock ();
+
+ foreach (var p in directoryStatus.Where (e => e.Key.IsChildPathOf (rootPath) || e.Key == canonicalPath)) {
+ p.Value.RequiresRefresh = true;
+ }
+
+ if (args != null) {
+ // Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
+ VersionControlService.NotifyFileStatusChanged (args);
}
}
public VersionInfo GetStatus (FilePath localPath)
- {
- try {
- fileLock.EnterReadLock ();
-
- VersionInfo vi;
- fileStatus.TryGetValue (localPath, out vi);
- return vi;
- } finally {
- fileLock.ExitReadLock ();
- }
+ {
+ fileStatus.TryGetValue (localPath, out var vi);
+
+ return vi;
}
public DirectoryStatus GetDirectoryStatus (FilePath localPath)
- {
- try {
- directoryLock.EnterReadLock ();
-
- DirectoryStatus vis;
- if (directoryStatus.TryGetValue (localPath.CanonicalPath, out vis))
- return vis;
- return null;
- } finally {
- directoryLock.ExitReadLock ();
- }
+ {
+ if (directoryStatus.TryGetValue (localPath.CanonicalPath, out var vis))
+ return vis;
+ return null;
}
public void SetStatus (VersionInfo versionInfo, bool notify = true)
- {
- try {
- fileLock.EnterWriteLock ();
+ {
+ if (!versionInfo.IsInitialized)
+ versionInfo.Init (repo);
- if (!versionInfo.IsInitialized)
- versionInfo.Init (repo);
- VersionInfo vi;
- if (fileStatus.TryGetValue (versionInfo.LocalPath, out vi) && vi.Equals (versionInfo)) {
- vi.RequiresRefresh = false;
- return;
- }
- fileStatus [versionInfo.LocalPath] = versionInfo;
- } finally {
- fileLock.ExitWriteLock ();
- }
+ if (fileStatus.TryGetValue (versionInfo.LocalPath, out var vi) && vi.Equals (versionInfo)) {
+ vi.RequiresRefresh = false;
+ return;
+ }
+
+ fileStatus [versionInfo.LocalPath] = versionInfo;
if (notify)
VersionControlService.NotifyFileStatusChanged (new FileUpdateEventArgs (repo, versionInfo.LocalPath, versionInfo.IsDirectory));
@@ -115,79 +100,60 @@ namespace MonoDevelop.VersionControl
public void SetStatus (IEnumerable<VersionInfo> versionInfos)
{
- FileUpdateEventArgs args = null;
-
- try {
- fileLock.EnterWriteLock ();
- foreach (var versionInfo in versionInfos) {
- if (!versionInfo.IsInitialized)
- versionInfo.Init (repo);
- VersionInfo vi;
- if (fileStatus.TryGetValue (versionInfo.LocalPath, out vi) && vi.Equals (versionInfo)) {
- vi.RequiresRefresh = false;
- continue;
- }
- fileStatus [versionInfo.LocalPath] = versionInfo;
- var a = new FileUpdateEventArgs (repo, versionInfo.LocalPath, versionInfo.IsDirectory);
- if (args == null)
- args = a;
- else
- args.MergeWith (a);
- }
- } finally {
- fileLock.ExitWriteLock ();
+ FileUpdateEventArgs args = null;
+
+ foreach (var versionInfo in versionInfos) {
+ if (!versionInfo.IsInitialized)
+ versionInfo.Init (repo);
+
+ if (fileStatus.TryGetValue (versionInfo.LocalPath, out var vi) && vi.Equals (versionInfo)) {
+ vi.RequiresRefresh = false;
+ continue;
+ }
+
+ fileStatus [versionInfo.LocalPath] = versionInfo;
+
+ var a = new FileUpdateEventArgs (repo, versionInfo.LocalPath, versionInfo.IsDirectory);
+ if (args == null)
+ args = a;
+ else
+ args.MergeWith (a);
}
+
if (args != null) {
- // Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
+ // Console.WriteLine ("Notifying Status " + string.Join (", ", args.Select (p => p.FilePath.FullPath)));
VersionControlService.NotifyFileStatusChanged (args);
}
}
- public void SetDirectoryStatus (FilePath localDirectory, VersionInfo[] versionInfos, bool hasRemoteStatus)
- {
- try {
- directoryLock.EnterWriteLock ();
-
- DirectoryStatus vis;
- if (directoryStatus.TryGetValue (localDirectory.CanonicalPath, out vis)) {
- if (versionInfos.Length == vis.FileInfo.Length && (hasRemoteStatus == vis.HasRemoteStatus)) {
- bool allEqual = true;
- for (int n = 0; n < versionInfos.Length; n++) {
- if (!versionInfos [n].Equals (vis.FileInfo [n])) {
- allEqual = false;
- break;
- }
- }
- if (allEqual) {
- vis.RequiresRefresh = false;
- return;
+ public void SetDirectoryStatus (FilePath localDirectory, VersionInfo [] versionInfos, bool hasRemoteStatus)
+ {
+ if (directoryStatus.TryGetValue (localDirectory.CanonicalPath, out var vis)) {
+ if (versionInfos.Length == vis.FileInfo.Length && (hasRemoteStatus == vis.HasRemoteStatus)) {
+ bool allEqual = true;
+ for (int n = 0; n < versionInfos.Length; n++) {
+ if (!versionInfos [n].Equals (vis.FileInfo [n])) {
+ allEqual = false;
+ break;
}
}
+ if (allEqual) {
+ vis.RequiresRefresh = false;
+ return;
+ }
}
- directoryStatus [localDirectory.CanonicalPath] = new DirectoryStatus { FileInfo = versionInfos, HasRemoteStatus = hasRemoteStatus };
- SetStatus (versionInfos);
- } finally {
- directoryLock.ExitWriteLock ();
}
+ directoryStatus [localDirectory.CanonicalPath] = new DirectoryStatus { FileInfo = versionInfos, HasRemoteStatus = hasRemoteStatus };
+ SetStatus (versionInfos);
}
public void Dispose ()
{
- if (fileLock != null) {
- fileLock.Dispose ();
- fileLock = null;
- }
- if (directoryLock != null) {
- directoryLock.Dispose ();
- directoryLock = null;
- }
if (fileStatus != null) {
fileStatus.Clear ();
- fileStatus = null;
}
if (directoryStatus != null) {
directoryStatus.Clear ();
- directoryStatus = null;
}
repo = null;
}
@@ -195,9 +161,8 @@ namespace MonoDevelop.VersionControl
class DirectoryStatus
{
- public VersionInfo[] FileInfo { get; set; }
+ public VersionInfo [] FileInfo { get; set; }
public bool HasRemoteStatus { get; set; }
public bool RequiresRefresh { get; set; }
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config b/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config
deleted file mode 100644
index f3aeebbbc7..0000000000
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Humanizer.Core" version="2.2.0" targetFramework="net471" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/VersionControl/Subversion.Win32.Tests/Makefile.am b/main/src/addins/VersionControl/Subversion.Win32.Tests/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/VersionControl/Subversion.Win32.Tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/VersionControl/Subversion.Win32/Makefile.am b/main/src/addins/VersionControl/Subversion.Win32/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/VersionControl/Subversion.Win32/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
index 14880ee24b..d79fab0a07 100644
--- a/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
+++ b/main/src/addins/VersionControl/Subversion.Win32/VersionControl.Subversion.Win32.csproj
@@ -14,12 +14,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<ItemGroup>
<Reference Include="System" />
- <Reference Include="SharpSvn">
- <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8013.3694.107\lib\net40\SharpSvn.dll</HintPath>
- </Reference>
- <Reference Include="SharpSvn.UI">
- <HintPath>..\..\..\..\packages\SharpSvn.1.8-x86.1.8013.3694.107\lib\net40\SharpSvn.UI.dll</HintPath>
- </Reference>
+ <PackageReference Include="SharpSvn.1.8-x86" Version="1.8013.3694.107" PrivateAssets="runtime" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="VersionControl.Subversion.Win32.Tests" />
@@ -76,16 +71,5 @@
<Private>False</Private>
</ProjectReference>
</ItemGroup>
- <ItemGroup>
- <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8013.3694.107\lib\net40\SharpPlink-Win32.svnExe">
- <Link>SharpPlink-Win32.svnExe</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="..\..\..\..\packages\SharpSvn.1.8-x86.1.8013.3694.107\lib\net40\SharpSvn-DB44-20-win32.svnDll">
- <Link>SharpSvn-DB44-20-win32.svnDll</Link>
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/VersionControl/Subversion.Win32/packages.config b/main/src/addins/VersionControl/Subversion.Win32/packages.config
deleted file mode 100644
index a4956b6c07..0000000000
--- a/main/src/addins/VersionControl/Subversion.Win32/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="SharpSvn.1.8-x86" version="1.8013.3694.107" targetFramework="net45" />
-</packages> \ No newline at end of file
diff --git a/main/src/addins/Web/Makefile.am b/main/src/addins/Web/Makefile.am
deleted file mode 100644
index d9cd4205a7..0000000000
--- a/main/src/addins/Web/Makefile.am
+++ /dev/null
@@ -1,2 +0,0 @@
-SUBDIRS = \
- MonoDevelop.AspNet
diff --git a/main/src/addins/WindowsPlatform/Makefile.am b/main/src/addins/WindowsPlatform/Makefile.am
deleted file mode 100644
index afdf22dae4..0000000000
--- a/main/src/addins/WindowsPlatform/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = \
- WindowsPlatform \
- WindowsAPICodePack
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj
index ed8221bf2d..797d5cc7f4 100644
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Core.csproj
@@ -4,6 +4,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2E1FB0DF-F9BB-4909-9F32-2D9D022A8E57}</ProjectGuid>
+ <TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<RootNamespace>Microsoft.WindowsAPICodePack</RootNamespace>
<AssemblyName>Microsoft.WindowsAPICodePack</AssemblyName>
<OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am
deleted file mode 100644
index 24e07e9bf5..0000000000
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Core/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_WINDOWSPLATFORM
-SKIP=y
-endif
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am
deleted file mode 100644
index 841093782b..0000000000
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = \
- Core \
- Shell
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs
index 27e6ef5482..a2b707afe7 100644
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/CommonFileDialogs/CommonSaveFileDialog.cs
@@ -153,7 +153,7 @@ namespace Microsoft.WindowsAPICodePack.Dialogs
// The string we pass to PSGetPropertyDescriptionListFromString must
// start with "prop:", followed a list of canonical names for each
// property that is to collected.
- if (propertyList != null && propertyList.Length > 0 && propertyList[0] != null)
+ if (propertyList != null && propertyList.Length > 0)
{
StringBuilder sb = new StringBuilder("prop:");
foreach (PropertyKey key in propertyList)
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am
deleted file mode 100644
index 24e07e9bf5..0000000000
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_WINDOWSPLATFORM
-SKIP=y
-endif
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj
index 964a86c2e2..bb45d71b83 100644
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/Shell.csproj
@@ -4,6 +4,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AA0C00CB-8699-4F37-BFAE-40CA87ACC06D}</ProjectGuid>
+ <TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<RootNamespace>Microsoft.WindowsAPICodePack.Shell</RootNamespace>
<AssemblyName>Microsoft.WindowsAPICodePack.Shell</AssemblyName>
<OutputPath>..\..\..\..\..\build\AddIns\WindowsPlatform</OutputPath>
@@ -26,6 +27,7 @@
<Reference Include="WindowsBase" />
<Reference Include="WindowsFormsIntegration" />
<Reference Include="System.Xaml" />
+ <SuppressCopyLocal Include="Microsoft.WindowsAPICodePack.dll" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.WindowsAPICodePack.ShellExtensions" />
diff --git a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs
index b607fb0e67..d24a41ece0 100644
--- a/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs
+++ b/main/src/addins/WindowsPlatform/WindowsAPICodePack/Shell/ShellObjectWatcher/ShellObjectNotificationEventArgs.cs
@@ -1,9 +1,9 @@
-using System;
+using System;
namespace Microsoft.WindowsAPICodePack.Shell
{
/// <summary>
- /// Base class for the Event Args for change notifications raised by <typeparamref name="ShellObjectWatcher"/>.
+ /// Base class for the Event Args for change notifications raised by <see cref="ShellObjectWatcher"/>.
/// </summary>
public class ShellObjectNotificationEventArgs : EventArgs
{
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am b/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am
deleted file mode 100644
index 24e07e9bf5..0000000000
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-if ! ENABLE_WINDOWSPLATFORM
-SKIP=y
-endif
diff --git a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj
index 055d750318..9739a3ea01 100644
--- a/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj
+++ b/main/src/addins/WindowsPlatform/WindowsPlatform/WindowsPlatform.csproj
@@ -58,6 +58,10 @@
<Project>{C93D746E-1586-4D4F-B411-BF5A966E6A08}</Project>
<Name>Xwt.WPF</Name>
</ProjectReference>
+ <IncludeCopyLocal Include="Microsoft.WindowsAPICodePack.dll" />
+ <IncludeCopyLocal Include="Microsoft.WindowsAPICodePack.Shell.dll" />
+ <IncludeCopyLocal Include="Xwt.Gtk.Windows.dll" />
+ <IncludeCopyLocal Include="Xwt.WPF.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="Dialogs\AddFileDialogHandler.cs" />
diff --git a/main/src/addins/Xml/Makefile.am b/main/src/addins/Xml/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/addins/Xml/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/addins/Xml/MonoDevelop.Xml.csproj b/main/src/addins/Xml/MonoDevelop.Xml.csproj
index d85653a3f6..270568d443 100644
--- a/main/src/addins/Xml/MonoDevelop.Xml.csproj
+++ b/main/src/addins/Xml/MonoDevelop.Xml.csproj
@@ -8,6 +8,10 @@
<OutputType>Library</OutputType>
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\build\AddIns\Xml</OutputPath>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -17,18 +21,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\build\bin\System.Collections.Immutable.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -153,9 +145,6 @@
<Compile Include="Editor\XmlExpandSelectionHandler.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
<Content Include="schemas\appconfig.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
diff --git a/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj b/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj
index 0d71e05910..1a07bf6ca3 100644
--- a/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj
+++ b/main/src/addins/Xml/Tests/MonoDevelop.Xml.Tests.csproj
@@ -1,5 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="..\..\..\..\MonoDevelop.props" />
+ <Import Project="$(ReferencesGtk)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,6 +10,10 @@
<TargetFrameworkVersion>$(MDFrameworkVersion)</TargetFrameworkVersion>
<OutputPath>..\..\..\..\build\tests</OutputPath>
<DefineConstants>TRACE</DefineConstants>
+ <!--
+ This needs to be ported to the new editor, and currently makes use of many, many deprecated APIs.
+ -->
+ <NoWarn>$(NoWarn);618;612</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
@@ -26,6 +31,7 @@
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
<Project>{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}</Project>
<Name>GuiUnit_NET_4_5</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\MonoDevelop.Xml.csproj">
<Project>{86DFC74A-B0B6-4C73-9E05-9098DA8FA5F1}</Project>
@@ -35,24 +41,17 @@
<ProjectReference Include="..\..\..\..\tests\IdeUnitTests\IdeUnitTests.csproj">
<Project>{F7B2B155-7CF4-42C4-B5AF-63C0667D2E4F}</Project>
<Name>IdeUnitTests</Name>
+ <Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\tests\UnitTests\UnitTests.csproj">
<Project>{1497D0A8-AFF1-4938-BC22-BE79B358BA5B}</Project>
<Name>UnitTests</Name>
+ <Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
- <Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\..\build\bin\Microsoft.CodeAnalysis.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup>
<ItemGroup>
<Compile Include="Parser\ActiveElementStartPathTestFixture.cs" />
@@ -125,11 +124,5 @@
<Link>Resources\xhtml1-strict.xsd</Link>
</EmbeddedResource>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="CodeCompletion\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/addins/Xml/Tests/packages.config b/main/src/addins/Xml/Tests/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/addins/Xml/Tests/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/addins/Xml/packages.config b/main/src/addins/Xml/packages.config
deleted file mode 100644
index 6e418c6a68..0000000000
--- a/main/src/addins/Xml/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/core/Makefile.am b/main/src/core/Makefile.am
deleted file mode 100644
index c1366fb682..0000000000
--- a/main/src/core/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-SUBDIRS = \
- MonoDevelop.Projects.Formats.MSBuild \
- MonoDevelop.Core \
- Mono.TextEditor.Shared \
- Mono.TextEditor.Platform \
- Mono.Texteditor \
- MonoDevelop.Ide MonoDevelop.Startup \
- MonoDevelop.TextEditor.Tests
-
diff --git a/main/src/core/Mono.TextEditor.Platform/Makefile.am b/main/src/core/Mono.TextEditor.Platform/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/core/Mono.TextEditor.Platform/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/core/Mono.TextEditor.Shared/Makefile.am b/main/src/core/Mono.TextEditor.Shared/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/core/Mono.TextEditor.Shared/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Actions/MiscActions.cs b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Actions/MiscActions.cs
index de561d4142..21bd475c43 100644
--- a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Actions/MiscActions.cs
+++ b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Actions/MiscActions.cs
@@ -31,7 +31,6 @@ using System.Diagnostics;
using System.Text;
using System.Linq;
using MonoDevelop.Ide.Editor;
-using Microsoft.VisualStudio.Text.Implementation;
using Microsoft.CodeAnalysis.Text;
namespace Mono.TextEditor
@@ -244,14 +243,22 @@ namespace Mono.TextEditor
data.EnsureCaretIsNotVirtual ();
var oldCaretLine = data.Caret.Location.Line;
-
- string indentString = data.GetIndentationString (data.Caret.Location);
+ var indentString = data.IndentationTracker.GetIndentationString (data.Caret.Line);
data.InsertAtCaret (data.EolMarker);
- // Don't insert the indent string if the EOL insertion modified the caret location in an unexpected fashion
- // (This likely means someone has custom logic regarding insertion of the EOL)
- if (data.Caret.Location.Line == oldCaretLine + 1 && data.Caret.Location.Column == 1)
- data.InsertAtCaret (indentString);
+ if (data.HasIndentationTracker) {
+ // Don't insert the indent string if the EOL insertion modified the caret location in an unexpected fashion
+ // (This likely means someone has custom logic regarding insertion of the EOL)
+ if (data.Caret.Location.Line == oldCaretLine + 1 && data.Caret.Location.Column == 1) {
+ var line = data.GetLine (data.Caret.Line);
+ var currentIndent = line.GetIndentation (data.Document);
+ var currentCalculatedIndent = data.IndentationTracker.GetIndentationString (data.Caret.Line);
+ if (!string.IsNullOrEmpty (currentCalculatedIndent))
+ indentString = currentCalculatedIndent;
+ if (indentString != currentIndent)
+ data.InsertAtCaret (indentString);
+ }
+ }
}
}
diff --git a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/CaretImpl.cs b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/CaretImpl.cs
index 7ad29ede3d..245e069daa 100644
--- a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/CaretImpl.cs
+++ b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/CaretImpl.cs
@@ -1,4 +1,4 @@
-// Caret.cs
+// Caret.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
@@ -28,6 +28,7 @@
using System;
using System.Linq;
using Microsoft.VisualStudio.Text;
+using MonoDevelop.Core;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Editor;
@@ -329,10 +330,14 @@ namespace Mono.TextEditor
protected override void OnPositionChanged (CaretLocationEventArgs args)
{
- TextEditorData.Document.EnsureOffsetIsUnfolded (Offset);
- base.OnPositionChanged (args);
- PositionChanged_ITextCaret (args);
- currentBuffer = TextEditorData.Document.TextBuffer.CurrentSnapshot;
+ try {
+ TextEditorData.Document.EnsureOffsetIsUnfolded (Offset);
+ base.OnPositionChanged (args);
+ PositionChanged_ITextCaret (args);
+ currentBuffer = TextEditorData.Document.TextBuffer.CurrentSnapshot;
+ } catch (Exception ex) {
+ LoggingService.LogInternalError ("Error when updating caret position", ex);
+ }
}
protected virtual void OnModeChanged ()
diff --git a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs
index c801947809..29a8923d7b 100644
--- a/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs
+++ b/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs
@@ -1,22 +1,22 @@
-//
+//
// TextDocument.cs
-//
+//
// Author:
// Mike Krüger <mkrueger@xamarin.com>
-//
+//
// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
// Copyright (c) 2012 Xamarin Inc. (http://xamarin.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
@@ -28,18 +28,19 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
-using Mono.TextEditor.Highlighting;
-using Mono.TextEditor.Utils;
+using System.IO;
using System.Linq;
-using System.ComponentModel;
using System.Text;
-using System.Threading.Tasks;
using System.Threading;
-using MonoDevelop.Ide.Composition;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Platform;
+using Microsoft.VisualStudio.Text.Utilities;
+using Microsoft.VisualStudio.Utilities;
+using Mono.TextEditor.Utils;
+using MonoDevelop.Core;
using MonoDevelop.Core.Text;
+using MonoDevelop.Ide;
using MonoDevelop.Ide.Editor;
-using MonoDevelop.Core;
-using System.IO;
using MonoDevelop.Ide.Editor.Highlighting;
using Microsoft.VisualStudio.Platform;
using Microsoft.VisualStudio.Text.Tagging;
@@ -58,59 +59,32 @@ namespace Mono.TextEditor
public Microsoft.VisualStudio.Text.ITextBuffer TextBuffer { get { return this.VsTextDocument.TextBuffer; } }
- bool lineEndingMismatch;
-
//HACK ImmutableText buffer;
//HACK readonly ILineSplitter splitter;
ISyntaxHighlighting syntaxMode = null;
-
- //HACK TextSourceVersionProvider versionProvider = new TextSourceVersionProvider ();
-
- bool readOnly;
- ReadOnlyCheckDelegate readOnlyCheckDelegate;
+ string mimeType;
public string MimeType {
- get {
- var snapshot = this.TextBuffer.CurrentSnapshot;
- return PlatformCatalog.Instance.MimeToContentTypeRegistryService.GetMimeType(snapshot.ContentType) ?? snapshot.ContentType.TypeName;
- }
- set {
- var newContentType = value != null ? GetContentTypeFromMimeType(null, value) : PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType;
-
- if (this.TextBuffer.CurrentSnapshot.ContentType != newContentType) {
- this.TextBuffer.ChangeContentType(newContentType, null);
- }
- }
- }
-
- private static IContentType GetContentTypeFromMimeType(string filePath, string mimeType)
- {
- if (filePath != null)
- {
- var fileToContentTypeService = CompositionManager.Instance.GetExportedValue<IFileToContentTypeService> ();
- var contentTypeFromPath = fileToContentTypeService.GetContentTypeForFilePath (filePath);
- if (contentTypeFromPath != null &&
- contentTypeFromPath != PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType)
- {
- return contentTypeFromPath;
- }
+ get {
+ if (mimeType == null && TextBuffer != null) {
+ mimeType = MimeTypeCatalog.Instance.GetMimeTypeForContentType (TextBuffer.ContentType);
+ }
+ return mimeType ?? MimeTypeCatalog.TextPlain;
}
-
- IContentType contentType = PlatformCatalog.Instance.MimeToContentTypeRegistryService.GetContentType (mimeType);
- if (contentType == null)
- {
- // fallback 1: see if there is a content tyhpe with the same name
- contentType = PlatformCatalog.Instance.ContentTypeRegistryService.GetContentType(mimeType);
- if (contentType == null)
- {
- // No joy, create a content type that, by default, derives from text. This is strictly an error
- // (there should be mappings between any mime type and any content type).
- contentType = PlatformCatalog.Instance.ContentTypeRegistryService.AddContentType(mimeType, new string[] { "text" });
+ set {
+ if (mimeType == value) {
+ return;
+ }
+
+ mimeType = value;
+ var newContentType = MimeTypeCatalog.Instance.GetContentTypeForMimeType (value) ?? PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType;
+ if (TextBuffer != null && TextBuffer.CurrentSnapshot.ContentType != newContentType) {
+ TextBuffer.ChangeContentType (newContentType, null);
}
+
+ MimeTypeChanged?.Invoke (this, EventArgs.Empty);
}
-
- return contentType;
}
public event EventHandler MimeTypeChanged;
@@ -166,9 +140,9 @@ namespace Mono.TextEditor
void SyntaxMode_HighlightingStateChanged (object sender, MonoDevelop.Ide.Editor.LineEventArgs e)
{
if (e == MonoDevelop.Ide.Editor.LineEventArgs.AllLines) {
- CommitUpdateAll (true);
- } else {
- CommitMultipleLineUpdate (e.Line.LineNumber, e.Line.LineNumber, true);
+ CommitUpdateAll (false);
+ } else {
+ CommitMultipleLineUpdate (e.Line.LineNumber, e.Line.LineNumber, false);
}
}
@@ -220,24 +194,21 @@ namespace Mono.TextEditor
set;
}
- public bool HasLineEndingMismatchOnTextSet {
- get {
- return lineEndingMismatch;
- }
- set {
- lineEndingMismatch = value;
- }
- }
-
void AttachTextBuffer (Microsoft.VisualStudio.Text.ITextDocument textDocument, bool owned)
{
DetachTextBuffer ();
vsTextDocumentOwned = owned;
this.VsTextDocument = textDocument;
+
this.currentSnapshot = this.TextBuffer.CurrentSnapshot;
+
this.TextBuffer.Properties.AddProperty (typeof (ITextDocument), this);
this.TextBuffer.Changed += this.OnTextBufferChanged;
- (this.TextBuffer as Microsoft.VisualStudio.Text.Implementation.BaseBuffer).ChangedImmediate += OnTextBufferChangedImmediate;
+
+ // BaseBuffer is internal so have to use Reflection
+ //(this.TextBuffer as Microsoft.VisualStudio.Text.Implementation.BaseBuffer).ChangedImmediate += OnTextBufferChangedImmediate;
+ var changedImmediateEventInfo = TextBuffer.GetType ().GetEvent ("ChangedImmediate", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
+ changedImmediateEventInfo.AddMethod.Invoke (TextBuffer, new object[] { (EventHandler<Microsoft.VisualStudio.Text.TextContentChangedEventArgs>)OnTextBufferChangedImmediate });
this.TextBuffer.ContentTypeChanged += this.OnTextBufferContentTypeChanged;
this.VsTextDocument.FileActionOccurred += this.OnTextDocumentFileActionOccurred;
}
@@ -245,7 +216,11 @@ namespace Mono.TextEditor
void DetachTextBuffer ()
{
if (VsTextDocument != null) {
- (this.TextBuffer as Microsoft.VisualStudio.Text.Implementation.BaseBuffer).ChangedImmediate -= OnTextBufferChangedImmediate;
+ // BaseBuffer is internal so have to use Reflection
+ //(this.TextBuffer as Microsoft.VisualStudio.Text.Implementation.BaseBuffer).ChangedImmediate -= OnTextBufferChangedImmediate;
+ var changedImmediateEventInfo = TextBuffer.GetType ().GetEvent ("ChangedImmediate", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
+ changedImmediateEventInfo.RemoveMethod.Invoke (TextBuffer, new object[] { (EventHandler<Microsoft.VisualStudio.Text.TextContentChangedEventArgs>)OnTextBufferChangedImmediate });
+
this.TextBuffer.Changed -= this.OnTextBufferChanged;
this.TextBuffer.ContentTypeChanged -= this.OnTextBufferContentTypeChanged;
this.TextBuffer.Properties.RemoveProperty (typeof (ITextDocument));
@@ -257,8 +232,10 @@ namespace Mono.TextEditor
}
}
+ public bool HasLineEndingMismatchOnTextSet { get; set; }
+
protected void Initialize()
- {
+ {
foldSegmentTree.tree.NodeRemoved += HandleFoldSegmentTreetreeNodeRemoved;
this.diffTracker.SetTrackDocument(this);
}
@@ -282,7 +259,8 @@ namespace Mono.TextEditor
}
var textChange = new TextChangeEventArgs(changes);
- TextChanging?.Invoke(this, textChange);
+ TextChanging?.Invoke (this, textChange);
+
// After TextChanging notification has been sent, we can update the cached snapshot
this.currentSnapshot = args.After;
}
@@ -354,32 +332,27 @@ namespace Mono.TextEditor
textBufferFileModel.TextBufferInstanceChanged += TextBufferFileModel_TextBufferInstanceChanged;
}
- public TextDocument (string fileName, string mimeType)
- {
- var contentType = (mimeType == null) ? PlatformCatalog.Instance.TextBufferFactoryService.InertContentType : GetContentTypeFromMimeType(fileName, mimeType);
- Encoding enc;
- var text = TextFileUtility.GetText (fileName, out enc);
- var buffer = PlatformCatalog.Instance.TextBufferFactoryService.CreateTextBuffer (text ?? string.Empty,
- contentType);
-
- var doc = PlatformCatalog.Instance.TextDocumentFactoryService.CreateTextDocument (buffer, fileName);
- doc.Encoding = enc;
-
- AttachTextBuffer (doc, true);
- this.Initialize();
- }
+ public TextDocument (string fileName, string mimeType) : this (
+ TextFileUtility.GetText (fileName, out var enc),
+ fileName,
+ mimeType
+ ) { this.Encoding = enc; }
public TextDocument (string text = null, string fileName = null, string mimeType = null)
- {
- var contentType = (mimeType == null) ? PlatformCatalog.Instance.TextBufferFactoryService.InertContentType : GetContentTypeFromMimeType(fileName, mimeType);
- var buffer = PlatformCatalog.Instance.TextBufferFactoryService.CreateTextBuffer (text ?? string.Empty,
- contentType);
+ {
+ this.mimeType = mimeType;
+ var doc = PlatformCatalog.Instance.TextDocumentFactoryService.CreateTextDocument (
+ PlatformCatalog.Instance.TextBufferFactoryService.CreateTextBuffer (
+ text ?? string.Empty,
+ GetContentTypeFromMimeType (fileName, mimeType)
+ ),
+ fileName ?? string.Empty
+ );
- var doc = PlatformCatalog.Instance.TextDocumentFactoryService.CreateTextDocument(buffer, fileName ?? string.Empty);
doc.Encoding = TextFileUtility.DefaultEncoding;
AttachTextBuffer (doc, true);
- this.Initialize();
+ Initialize();
}
void TextBufferFileModel_TextBufferInstanceChanged (object sender, EventArgs e)
@@ -388,6 +361,11 @@ namespace Mono.TextEditor
AttachTextBuffer (doc, false);
}
+ IContentType GetContentTypeFromMimeType (string fileName, string mimeType)
+ => MimeTypeCatalog.Instance.GetContentTypeForMimeType (mimeType)
+ ?? (fileName != null ? MonoDevelop.Ide.Composition.CompositionManager.GetExportedValue<IFileToContentTypeService> ().GetContentTypeForFilePath (fileName) : null)
+ ?? PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType;
+
public static TextDocument CreateImmutableDocument (string text, bool suppressHighlighting = true)
{
return new TextDocument (text) {
@@ -436,7 +414,7 @@ namespace Mono.TextEditor
{
ReplaceText (offset, count, (string)null);
}
-
+
public void RemoveText (ISegment segment)
{
RemoveText (segment.Offset, segment.Length);
@@ -494,17 +472,17 @@ namespace Mono.TextEditor
{
return GetTextBetween (LocationToOffset (start), LocationToOffset (end));
}
-
+
public string GetTextBetween (int startLine, int startColumn, int endLine, int endColumn)
{
return GetTextBetween (LocationToOffset (startLine, startColumn), LocationToOffset (endLine, endColumn));
}
-
+
public string GetTextAt (int offset, int count)
{
return this.currentSnapshot.GetText(offset, count);
}
-
+
public string GetTextAt (DocumentRegion region)
{
return GetTextAt (region.GetSegment (this));
@@ -529,13 +507,13 @@ namespace Mono.TextEditor
var lineSegment = GetLine (line);
return lineSegment != null ? GetTextAt (lineSegment.Offset, lineSegment.Length) : null;
}
-
+
public string GetLineText (int line, bool includeDelimiter)
{
var lineSegment = GetLine (line);
return GetTextAt (lineSegment.Offset, includeDelimiter ? lineSegment.LengthIncludingDelimiter : lineSegment.Length);
}
-
+
public char GetCharAt (int offset)
{
return this.currentSnapshot[offset];
@@ -627,7 +605,7 @@ namespace Mono.TextEditor
{
return Text.IndexOfAny (anyOf, startIndex, count);
}
-
+
/// <summary>
/// Gets the index of the first occurrence of the specified search text in this text source.
/// </summary>
@@ -640,7 +618,7 @@ namespace Mono.TextEditor
{
return Text.IndexOf (searchText, startIndex, count, comparisonType);
}
-
+
/// <summary>
/// Gets the index of the last occurrence of the specified character in this text source.
/// </summary>
@@ -654,7 +632,7 @@ namespace Mono.TextEditor
{
return Text.LastIndexOf (c, startIndex, count);
}
-
+
/// <summary>
/// Gets the index of the last occurrence of the specified search text in this text source.
/// </summary>
@@ -719,12 +697,12 @@ namespace Mono.TextEditor
DocumentLine documentLine = GetLine(line);
return System.Math.Min(Length, documentLine.Offset + System.Math.Max(0, System.Math.Min(documentLine.Length, column - 1)));
}
-
+
public int LocationToOffset (DocumentLocation location)
{
return LocationToOffset(location.Line, location.Column);
}
-
+
public DocumentLocation OffsetToLocation (int offset)
{
IDocumentLine line = this.GetLineByOffset(offset);
@@ -739,19 +717,19 @@ namespace Mono.TextEditor
{
return GetLineIndent (GetLine (lineNumber));
}
-
+
public string GetLineIndent (DocumentLine segment)
{
if (segment == null)
return "";
return segment.GetIndentation (this);
}
-
+
public DocumentLine GetLine (int lineNumber)
{
if (lineNumber < DocumentLocation.MinLine)
return null;
-
+
return this.Get (lineNumber);
}
@@ -805,22 +783,29 @@ namespace Mono.TextEditor
readonly int afterVersionNumber;
Microsoft.VisualStudio.Text.INormalizedTextChangeCollection changes;
+ /// <summary>
+ /// The type itself is being used as a marker and it's internal, so have to retrieve it via Reflection
+ /// </summary>
+ readonly Type textBufferChangeUndoPrimitiveType;
+
public virtual Microsoft.VisualStudio.Text.INormalizedTextChangeCollection Changes {
get {
return changes;
}
}
-
+
public object Tag {
get;
set;
}
-
+
protected UndoOperation()
{
+ // The type is in the consolidated editor implementation assembly
+ textBufferChangeUndoPrimitiveType = typeof (ITextViewRoleMetadata).Assembly.GetType ("Microsoft.VisualStudio.Text.BufferUndoManager.Implementation.TextBufferChangeUndoPrimitive");
}
- public UndoOperation (Microsoft.VisualStudio.Text.TextContentChangedEventArgs args)
+ public UndoOperation (Microsoft.VisualStudio.Text.TextContentChangedEventArgs args) : this()
{
this.beforeVersionNumber = args.BeforeVersion.VersionNumber;
this.afterVersionNumber = args.AfterVersion.VersionNumber;
@@ -831,7 +816,7 @@ namespace Mono.TextEditor
public virtual void Undo (TextDocument doc, bool fireEvent = true)
{
if (this.Changes.Count > 0) {
- using (var edit = doc.TextBuffer.CreateEdit(Microsoft.VisualStudio.Text.EditOptions.None, this.beforeVersionNumber, typeof(Microsoft.VisualStudio.Text.BufferUndoManager.Implementation.TextBufferChangeUndoPrimitive))) {
+ using (var edit = doc.TextBuffer.CreateEdit(Microsoft.VisualStudio.Text.EditOptions.None, this.beforeVersionNumber, textBufferChangeUndoPrimitiveType)) {
foreach (var change in this.changes)
edit.Replace(change.NewPosition, change.NewLength, change.OldText);
@@ -842,11 +827,11 @@ namespace Mono.TextEditor
if (fireEvent)
OnUndoDone ();
}
-
+
public virtual void Redo (TextDocument doc, bool fireEvent = true)
{
if (this.Changes.Count > 0) {
- using (var edit = doc.TextBuffer.CreateEdit(Microsoft.VisualStudio.Text.EditOptions.None, this.afterVersionNumber, typeof(Microsoft.VisualStudio.Text.BufferUndoManager.Implementation.TextBufferChangeUndoPrimitive))) {
+ using (var edit = doc.TextBuffer.CreateEdit(Microsoft.VisualStudio.Text.EditOptions.None, this.afterVersionNumber, textBufferChangeUndoPrimitiveType)) {
foreach (var change in this.changes)
edit.Replace(change.OldPosition, change.OldLength, change.NewText);
@@ -857,14 +842,14 @@ namespace Mono.TextEditor
if (fireEvent)
OnRedoDone ();
}
-
+
protected virtual void OnUndoDone ()
{
if (UndoDone != null)
UndoDone (this, EventArgs.Empty);
}
public event EventHandler UndoDone;
-
+
protected virtual void OnRedoDone ()
{
if (RedoDone != null)
@@ -872,7 +857,7 @@ namespace Mono.TextEditor
}
public event EventHandler RedoDone;
}
-
+
class AtomicUndoOperation : UndoOperation
{
OperationType operationType;
@@ -883,7 +868,7 @@ namespace Mono.TextEditor
return operationType;
}
}
-
+
public List<UndoOperation> Operations {
get {
return operations;
@@ -900,18 +885,18 @@ namespace Mono.TextEditor
{
this.operationType = operationType;
}
-
+
public void Insert (int index, UndoOperation operation)
{
operations.Insert (index, operation);
}
-
+
public void Add (UndoOperation operation)
{
operations.Add (operation);
}
-
+
public override void Undo (TextDocument doc, bool fireEvent = true)
{
doc.BeginAtomicUndo (operationType);
@@ -926,7 +911,7 @@ namespace Mono.TextEditor
if (fireEvent)
OnUndoDone ();
}
-
+
public override void Redo (TextDocument doc, bool fireEvent = true)
{
doc.BeginAtomicUndo (operationType);
@@ -942,11 +927,11 @@ namespace Mono.TextEditor
OnRedoDone ();
}
}
-
+
class KeyboardStackUndo : AtomicUndoOperation
{
bool isClosed = false;
-
+
public bool IsClosed {
get {
return isClosed;
@@ -962,7 +947,7 @@ namespace Mono.TextEditor
}
}
}
-
+
bool isInUndo = false;
Stack<UndoOperation> undoStack = new Stack<UndoOperation> ();
Stack<UndoOperation> redoStack = new Stack<UndoOperation> ();
@@ -999,7 +984,7 @@ namespace Mono.TextEditor
return this.undoStack.Count > 0 || currentAtomicOperation != null;
}
}
-
+
UndoOperation[] savePoint = null;
public bool IsDirty {
get {
@@ -1017,7 +1002,7 @@ namespace Mono.TextEditor
return false;
}
}
-
+
public enum LineState {
Unchanged,
Dirty,
@@ -1034,13 +1019,13 @@ namespace Mono.TextEditor
diffTracker = value;
}
}
-
+
public LineState GetLineState (DocumentLine line)
{
return diffTracker.GetLineState (line);
}
-
-
+
+
/// <summary>
/// Marks the document not dirty at this point (should be called after save).
/// </summary>
@@ -1052,7 +1037,7 @@ namespace Mono.TextEditor
this.CommitUpdateAll ();
DiffTracker.SetBaseDocument (CreateDocumentSnapshot ());
}
-
+
public void OptimizeTypedUndo ()
{
if (undoStack.Count == 0)
@@ -1087,12 +1072,12 @@ namespace Mono.TextEditor
undoStack.Push (keyUndo);
}
}
-
+
public int GetCurrentUndoDepth ()
{
return undoStack.Count;
}
-
+
public void StackUndoToDepth (int depth)
{
if (undoStack.Count == depth)
@@ -1103,7 +1088,7 @@ namespace Mono.TextEditor
}
undoStack.Push (atomicUndo);
}
-
+
public void MergeUndoOperations (int number)
{
number = System.Math.Min (number, undoStack.Count);
@@ -1113,7 +1098,7 @@ namespace Mono.TextEditor
}
undoStack.Push (atomicUndo);
}
-
+
public void Undo ()
{
if (undoStack.Count <= 0)
@@ -1145,7 +1130,7 @@ namespace Mono.TextEditor
}
public event EventHandler<UndoOperationEventArgs> Undone;
-
+
internal protected virtual void OnBeforeUndoOperation (EventArgs e)
{
var handler = this.BeforeUndoOperation;
@@ -1160,7 +1145,7 @@ namespace Mono.TextEditor
return this.redoStack.Count > 0;
}
}
-
+
public void Redo ()
{
if (redoStack.Count <= 0)
@@ -1172,16 +1157,16 @@ namespace Mono.TextEditor
isInUndo = false;
OnRedone (new UndoOperationEventArgs (operation));
}
-
+
internal protected virtual void OnRedone (UndoOperationEventArgs e)
{
EventHandler<UndoOperationEventArgs> handler = this.Redone;
if (handler != null)
handler (this, e);
}
-
+
public event EventHandler<UndoOperationEventArgs> Redone;
-
+
Stack<OperationType> currentAtomicUndoOperationType = new Stack<OperationType> ();
int atomicUndoLevel;
@@ -1196,11 +1181,11 @@ namespace Mono.TextEditor
return currentAtomicUndoOperationType.Count > 0 ? currentAtomicUndoOperationType.Peek () : OperationType.Undefined;
}
}
-
+
class UndoGroup : IDisposable
{
TextDocument doc;
-
+
public UndoGroup (TextDocument doc, OperationType operationType)
{
if (doc == null)
@@ -1217,7 +1202,7 @@ namespace Mono.TextEditor
}
}
}
-
+
public IDisposable OpenUndoGroup()
{
return OpenUndoGroup(OperationType.Undefined);
@@ -1232,7 +1217,7 @@ namespace Mono.TextEditor
{
currentAtomicUndoOperationType.Push (operationType);
if (currentAtomicOperation == null) {
- Debug.Assert (atomicUndoLevel == 0);
+ Debug.Assert (atomicUndoLevel == 0);
currentAtomicOperation = new AtomicUndoOperation (operationType);
OnBeginUndo ();
}
@@ -1244,8 +1229,8 @@ namespace Mono.TextEditor
if (atomicUndoLevel <= 0)
throw new InvalidOperationException ("There is no atomic undo operation running.");
atomicUndoLevel--;
- Debug.Assert (atomicUndoLevel >= 0);
-
+ Debug.Assert (atomicUndoLevel >= 0);
+
if (atomicUndoLevel == 0 && currentAtomicOperation != null) {
var cuao = currentAtomicOperation;
currentAtomicOperation = null;
@@ -1264,19 +1249,19 @@ namespace Mono.TextEditor
}
currentAtomicUndoOperationType.Pop ();
}
-
+
protected virtual void OnBeginUndo ()
{
- if (BeginUndo != null)
+ if (BeginUndo != null)
BeginUndo (this, EventArgs.Empty);
}
-
+
public void ClearUndoBuffer ()
{
undoStack.Clear ();
redoStack.Clear ();
}
-
+
[Serializable]
public sealed class UndoOperationEventArgs : EventArgs
{
@@ -1286,41 +1271,41 @@ namespace Mono.TextEditor
{
this.Operation = operation;
}
-
+
}
-
+
protected virtual void OnEndUndo (UndoOperationEventArgs e)
{
EventHandler<UndoOperationEventArgs> handler = this.EndUndo;
if (handler != null)
handler (this, e);
}
-
+
public event EventHandler BeginUndo;
public event EventHandler<UndoOperationEventArgs> EndUndo;
#endregion
-
+
#region Folding
-
+
SegmentTree<FoldSegment> foldSegmentTree = new SegmentTree<FoldSegment> ();
-
+
public bool IgnoreFoldings {
get;
set;
}
-
+
public bool HasFoldSegments {
get {
return FoldSegments.Any ();
}
}
-
+
public IEnumerable<FoldSegment> FoldSegments {
get {
return foldSegmentTree.Segments;
}
}
-
+
readonly object syncObject = new object();
CancellationTokenSource foldSegmentSrc;
@@ -1366,13 +1351,13 @@ namespace Mono.TextEditor
}, token);
}
}
-
+
void RemoveFolding (FoldSegment folding)
{
folding.isAttached = false;
foldSegmentTree.Remove (folding);
}
-
+
/// <summary>
/// Updates the fold segments in a background worker thread. Don't call this method outside of a background worker.
/// Use UpdateFoldSegments instead.
@@ -1435,7 +1420,7 @@ namespace Mono.TextEditor
update = foldedSegmentAdded || countChanged || foldedFoldingRemoved;
return newFoldedSegments;
}
-
+
internal void InterruptFoldWorker ()
{
if (foldSegmentSrc == null)
@@ -1443,28 +1428,28 @@ namespace Mono.TextEditor
foldSegmentSrc.Cancel ();
foldSegmentSrc = null;
}
-
+
public void ClearFoldSegments ()
{
InterruptFoldWorker ();
foldSegmentTree = new SegmentTree<FoldSegment> ();
- foldSegmentTree.tree.NodeRemoved += HandleFoldSegmentTreetreeNodeRemoved;
+ foldSegmentTree.tree.NodeRemoved += HandleFoldSegmentTreetreeNodeRemoved;
foldedSegments.Clear ();
InformFoldTreeUpdated ();
}
-
+
public IEnumerable<FoldSegment> GetFoldingsFromOffset (int offset)
{
if (offset < 0 || offset >= Length)
return new FoldSegment[0];
return foldSegmentTree.GetSegmentsAt (offset);
}
-
+
public IEnumerable<FoldSegment> GetFoldingContaining (int lineNumber)
{
return GetFoldingContaining(this.GetLine (lineNumber));
}
-
+
public IEnumerable<FoldSegment> GetFoldingContaining (DocumentLine line)
{
if (line == null)
@@ -1481,7 +1466,7 @@ namespace Mono.TextEditor
{
return GetStartFoldings (this.GetLine (lineNumber));
}
-
+
public IEnumerable<FoldSegment> GetStartFoldings (DocumentLine line)
{
if (line == null)
@@ -1501,7 +1486,7 @@ namespace Mono.TextEditor
{
return GetStartFoldings (this.GetLine (lineNumber));
}
-
+
public IEnumerable<FoldSegment> GetEndFoldings (DocumentLine line)
{
var lineOffset = line.Offset;
@@ -1520,7 +1505,7 @@ namespace Mono.TextEditor
{
return segment.GetEndLine (this).LineNumber - segment.GetStartLine (this).LineNumber;
}
-
+
public void EnsureOffsetIsUnfolded (int offset)
{
foreach (FoldSegment fold in GetFoldingsFromOffset (offset).Where (f => f.IsCollapsed && f.Offset < offset && offset < f.EndOffset)) {
@@ -1546,7 +1531,7 @@ namespace Mono.TextEditor
handler (this, EventArgs.Empty);
}
public event EventHandler FoldTreeUpdated;
-
+
HashSet<FoldSegment> foldedSegments = new HashSet<FoldSegment> ();
public IEnumerable<FoldSegment> FoldedSegments {
@@ -1588,7 +1573,7 @@ namespace Mono.TextEditor
handler (this, e);
}
-
+
List<TextLineMarker> extendingTextMarkers = new List<TextLineMarker> ();
public IEnumerable<DocumentLine> LinesWithExtendingTextMarkers {
get {
@@ -1596,15 +1581,15 @@ namespace Mono.TextEditor
var line = marker.LineSegment;
if (line != null)
yield return line;
- }
+ }
}
}
-
+
public void AddMarker (int lineNumber, TextLineMarker marker)
{
AddMarker (this.GetLine (lineNumber), marker);
}
-
+
public void AddMarker (DocumentLine line, TextLineMarker marker)
{
AddMarker (line, marker, true);
@@ -1668,7 +1653,7 @@ namespace Mono.TextEditor
if (line == null)
return;
foreach (var marker in GetTextSegmentMarkersAt (line).OfType<DocumentLineTextSegmentMarker> ())
- RemoveMarker (marker);
+ RemoveMarker (marker);
}
public void AddMarker (DocumentLine line, TextLineMarker marker, bool commitUpdate, int idx = -1)
@@ -1687,19 +1672,19 @@ namespace Mono.TextEditor
if (commitUpdate)
this.CommitLineUpdate (line);
}
-
+
static int CompareMarkers (TextLineMarker left, TextLineMarker right)
{
if (left.LineSegment == null || right.LineSegment == null)
return 0;
return left.LineSegment.Offset.CompareTo (right.LineSegment.Offset);
}
-
+
public void RemoveMarker (TextLineMarker marker)
{
RemoveMarker (marker, true);
}
-
+
public void RemoveMarker (TextLineMarker marker, bool updateLine)
{
if (marker == null)
@@ -1728,17 +1713,17 @@ namespace Mono.TextEditor
if (updateLine)
this.CommitLineUpdate (line);
}
-
+
public void RemoveMarker (int lineNumber, Type type)
{
RemoveMarker (this.GetLine (lineNumber), type);
}
-
+
public void RemoveMarker (DocumentLine line, Type type)
{
RemoveMarker (line, type, true);
}
-
+
public void RemoveMarker (DocumentLine line, Type type, bool updateLine)
{
if (line == null || type == null)
@@ -1812,7 +1797,7 @@ namespace Mono.TextEditor
textMarkerCacheOffset = offset;
return textMarkerSegmentCache = textSegmentMarkerTree.GetSegmentsAt (offset).ToList ();
}
-
+
public void AddMarker (TextSegmentMarker marker)
{
@@ -1847,46 +1832,36 @@ namespace Mono.TextEditor
{
return new TextSegment (0, Length).Contains (offset);
}
-
+
public bool Contains (ISegment segment)
{
return new TextSegment (0, Length).Contains (segment);
}
-
-
+
+
#region Update logic
List<DocumentUpdateRequest> updateRequests = new List<DocumentUpdateRequest> ();
-
+
public IEnumerable<DocumentUpdateRequest> UpdateRequests {
get {
return updateRequests;
}
- }
- // Use CanEdit (int lineNumber) instead for getting a request
- // if a part of a document can be read. ReadOnly should generally not be used
- // for deciding, if a document is readonly or not.
- public bool IsReadOnly {
- get {
- return readOnly;
- }
- set {
- readOnly = value;
- }
- }
-
- public ReadOnlyCheckDelegate ReadOnlyCheckDelegate {
- get { return readOnlyCheckDelegate; }
- set { readOnlyCheckDelegate = value; }
- }
-
-
+ }
+ // Use CanEdit (int lineNumber) instead for getting a request
+ // if a part of a document can be read. ReadOnly should generally not be used
+ // for deciding, if a document is readonly or not.
+ public bool IsReadOnly { get; set; }
+
+ public ReadOnlyCheckDelegate ReadOnlyCheckDelegate { get; set; }
+
+
public void RequestUpdate (DocumentUpdateRequest request)
{
lock (syncObject) {
updateRequests.Add (request);
}
}
-
+
public void CommitDocumentUpdate ()
{
lock (syncObject) {
@@ -1895,13 +1870,13 @@ namespace Mono.TextEditor
updateRequests.Clear ();
}
}
-
+
public void CommitLineUpdate (int line)
{
RequestUpdate (new LineUpdate (line));
CommitDocumentUpdate ();
}
-
+
public void CommitLineUpdate (DocumentLine line)
{
CommitLineUpdate (line.LineNumber);
@@ -1939,12 +1914,12 @@ namespace Mono.TextEditor
#region Helper functions
public const string openBrackets = "([{<";
public const string closingBrackets = ")]}>";
-
+
public static bool IsBracket (char ch)
{
return (openBrackets + closingBrackets).IndexOf (ch) >= 0;
}
-
+
public static bool IsWordSeparator (char ch)
{
return !(char.IsLetterOrDigit (ch) || ch == '_');
@@ -1955,12 +1930,12 @@ namespace Mono.TextEditor
return (offset == 0 || IsWordSeparator (GetCharAt (offset - 1))) &&
(offset + length == Length || IsWordSeparator (GetCharAt (offset + length)));
}
-
+
public bool IsEmptyLine (DocumentLine line)
{
for (int i = 0; i < line.Length; i++) {
char ch = GetCharAt (line.Offset + i);
- if (!Char.IsWhiteSpace (ch))
+ if (!Char.IsWhiteSpace (ch))
return false;
}
return true;
@@ -1974,7 +1949,7 @@ namespace Mono.TextEditor
IdentifierPart
}
-
+
public static CharacterClass GetCharacterClass (char ch)
@@ -1987,7 +1962,7 @@ namespace Mono.TextEditor
return CharacterClass.Unknown;
}
-
+
public static void RemoveTrailingWhitespaces (TextEditorData data, DocumentLine line)
{
if (line == null)
@@ -2000,7 +1975,7 @@ namespace Mono.TextEditor
break;
}
}
-
+
if (whitespaces > 0) {
var removeOffset = line.Offset + line.Length - whitespaces;
data.Remove (removeOffset, whitespaces);
@@ -2013,7 +1988,7 @@ namespace Mono.TextEditor
return isInUndo;
}
}
-
+
#region Diff
@@ -2032,7 +2007,7 @@ namespace Mono.TextEditor
}
return result;
}
-
+
public IEnumerable<Hunk> Diff (TextDocument changedDocument, bool includeEol = true)
{
var codeDictionary = new Dictionary<string, int> ();
@@ -2042,18 +2017,18 @@ namespace Mono.TextEditor
}
#endregion
-
-#region ContentLoaded
+
+#region ContentLoaded
// The problem: Action to perform on a newly opened text editor, but content didn't get loaded because autosave file exist.
// At this point the document is open, but the content didn't yet have loaded - therefore the action on the conent can't be perfomed.
- // Solution: Perform the action after the user did choose load autosave or not.
+ // Solution: Perform the action after the user did choose load autosave or not.
// This is done by the RunWhenLoaded method. Text editors should call the InformLoadComplete () when the content has successfully been loaded
// at that point the outstanding actions are run.
bool isLoaded;
List<Action> loadedActions = new List<Action> ();
List<Action> realizedActions = new List<Action> ();
-
+
/// <summary>
/// Gets a value indicating whether this instance is loaded.
/// </summary>
@@ -2068,7 +2043,7 @@ namespace Mono.TextEditor
get;
private set;
}
-
+
/// <summary>
/// Informs the document when the content is loaded. All outstanding actions are executed.
/// </summary>
@@ -2090,7 +2065,7 @@ namespace Mono.TextEditor
realizedActions.ForEach (act => act ());
realizedActions = null;
}
-
+
/// <summary>
/// Performs an action when the content is loaded.
/// </summary>
diff --git a/main/src/core/Mono.Texteditor/Makefile.am b/main/src/core/Mono.Texteditor/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/core/Mono.Texteditor/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/core/MonoDevelop.Core/Makefile.am b/main/src/core/MonoDevelop.Core/Makefile.am
deleted file mode 100644
index 2e4bd93ffb..0000000000
--- a/main/src/core/MonoDevelop.Core/Makefile.am
+++ /dev/null
@@ -1,7 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-EXTRA_DIST += \
- BuildVariables.cs
-
-BuildVariables.cs:
- $(XBUILD) $(XBUILD_ARGS) /t:BeforeBuild
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/ExecutionModeNode.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/ExecutionModeNode.cs
index c8bc047a68..a7b4a36a99 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/ExecutionModeNode.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/ExecutionModeNode.cs
@@ -1,31 +1,29 @@
-// ExecutionModeNode.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2008 Novell, Inc (http://www.novell.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 System;
+// ExecutionModeNode.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.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;
using MonoDevelop.Core.Execution;
@@ -33,12 +31,8 @@ namespace MonoDevelop.Core.AddIns
{
class ExecutionModeNode: TypeExtensionNode, IExecutionMode
{
- [NodeAttribute ("_name", Localizable=true)]
- string name = null;
-
- public string Name {
- get { return name; }
- }
+ [NodeAttribute ("_name", Localizable = true)]
+ public string Name { get; private set; }
public IExecutionHandler ExecutionHandler {
get {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
index 1de34d5f24..5eb3880767 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
@@ -1,4 +1,4 @@
-//
+//
// ISegment.cs
//
// Author:
@@ -27,7 +27,7 @@ using System;
using System.Collections.Generic;
namespace MonoDevelop.Core.Text
-{
+{
/// <summary>
/// An (Offset,Length)-pair.
/// </summary>
@@ -49,8 +49,8 @@ namespace MonoDevelop.Core.Text
/// </summary>
/// <remarks>EndOffset = Offset + Length;</remarks>
int EndOffset { get; }
- }
-
+ }
+
/// <summary>
/// An (Offset, Length) pair representing a text span.
/// </summary>
@@ -225,8 +225,8 @@ namespace MonoDevelop.Core.Text
{
return string.Format ("[TextSegment: Offset={0}, Length={1}]", Offset, Length);
}
- }
-
+ }
+
/// <summary>
/// An abstract implementation of the ISegment (Offset, Length) pair representing a text span.
/// </summary>
@@ -332,9 +332,9 @@ namespace MonoDevelop.Core.Text
{
return string.Format ("[AbstractSegment: Offset={0}, Length={1}]", Offset, Length);
}
- }
-
-
+ }
+
+
/// <summary>
/// Extension methods for <see cref="ISegment"/>.
/// </summary>
@@ -396,8 +396,9 @@ namespace MonoDevelop.Core.Text
int overlapStart = Math.Max (segment.Offset, other.Offset);
int overlapEnd = Math.Min (segment.EndOffset, other.EndOffset);
return overlapStart < overlapEnd;
- }
-
+ }
+
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public static ISegment AdjustSegment (this ISegment segment, TextChangeEventArgs args)
{
if (segment == null)
@@ -405,8 +406,9 @@ namespace MonoDevelop.Core.Text
var newStartOffset = args.GetNewOffset (segment.Offset);
var newEndOffset = args.GetNewOffset (segment.EndOffset);
return new TextSegment (newStartOffset, newEndOffset - newStartOffset);
- }
-
+ }
+
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public static IEnumerable<ISegment> AdjustSegments (this IEnumerable<ISegment> segments, TextChangeEventArgs args)
{
if (segments == null)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSource.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSource.cs
index 208481c142..7d8f40df0a 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSource.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSource.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextSource.cs
//
// Author:
@@ -28,11 +28,12 @@ using System.IO;
using System.Text;
namespace MonoDevelop.Core.Text
-{
+{
/// <summary>
/// A read-only view on a (potentially mutable) text source.
/// The IDocument interface derives from this interface.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public interface ITextSource
{
/// <summary>
@@ -130,6 +131,7 @@ namespace MonoDevelop.Core.Text
ITextSource CreateSnapshot (int offset, int length);
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class TextSourceExtension
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSourceVersion.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSourceVersion.cs
index fe38c35a09..d6a0bc3bda 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSourceVersion.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ITextSourceVersion.cs
@@ -1,33 +1,34 @@
-//
-// ITextSourceVersion.cs
-//
-// Author:
-// Mike Krüger <mkrueger@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.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.
-
+//
+// ITextSourceVersion.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.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 System;
using System.Collections.Generic;
namespace MonoDevelop.Core.Text
-{
+{
/// <summary>
/// Represents a version identifier for a text source.
/// </summary>
@@ -37,6 +38,7 @@ namespace MonoDevelop.Core.Text
/// It is a separate class from ITextSource to allow the GC to collect the text source while
/// the version checkpoint is still in use.
/// </remarks>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public interface ITextSourceVersion
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/StringTextSource.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/StringTextSource.cs
index 47375e6b81..72c364f4ea 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/StringTextSource.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/StringTextSource.cs
@@ -1,4 +1,4 @@
-//
+//
// StringTextSource.cs
//
// Author:
@@ -34,6 +34,7 @@ namespace MonoDevelop.Core.Text
/// Note that objects from this class are immutable.
/// </summary>
[Serializable]
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class StringTextSource : ITextSource
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextChangeEventArgs.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextChangeEventArgs.cs
index 7b6ee42839..b802bfa032 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextChangeEventArgs.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextChangeEventArgs.cs
@@ -1,4 +1,4 @@
-//
+//
// TextChangeEventArgs.cs
//
// Author:
@@ -30,6 +30,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Core.Text
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
[DebuggerDisplay("({offset}, {removedText.Length}, {insertedText.Text})")]
public sealed class TextChange
{
@@ -141,6 +142,7 @@ namespace MonoDevelop.Core.Text
/// This class is thread-safe.
/// </summary>
[Serializable]
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class TextChangeEventArgs : EventArgs
{
public IReadOnlyList<TextChange> TextChanges { get; }
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
index c1b3d616f2..07f14eeee5 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextFileUtility.cs
@@ -1,4 +1,4 @@
-//
+//
// TextFileUtility.cs
//
// Author:
@@ -282,8 +282,9 @@ namespace MonoDevelop.Core.Text
}
throw;
}
- }
-
+ }
+
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public static void WriteText (string fileName, ITextSource source)
{
ArgumentCheck (fileName);
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextSourceVersionProvider.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextSourceVersionProvider.cs
index 3e2cae228b..ed0a5b67b3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextSourceVersionProvider.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/TextSourceVersionProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// TextSourceVersionProvider.cs
//
// Taken from NRefactory 5.
@@ -30,10 +30,11 @@ using System.Collections.Generic;
using System.Linq;
namespace MonoDevelop.Core.Text
-{
+{
/// <summary>
/// Provides ITextSourceVersion instances.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class TextSourceVersionProvider
{
Version currentVersion;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
index 187756f0e5..615d11101e 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
@@ -1,12 +1,9 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <Import Project="..\..\..\packages\Microsoft.Build.Locator.1.1.2\build\Microsoft.Build.Locator.props" Condition="Exists('..\..\..\packages\Microsoft.Build.Locator.1.1.2\build\Microsoft.Build.Locator.props')" />
<Import Project="..\..\..\MonoDevelop.props" />
<Import Project="$(ReferencesGtk)" />
<PropertyGroup>
<ReferencesVSEditorCopyToOutput>true</ReferencesVSEditorCopyToOutput>
- <ReferencesRoslynCopyToOutput>true</ReferencesRoslynCopyToOutput>
</PropertyGroup>
- <Import Project="$(ReferencesRoslyn)" />
<Import Project="$(ReferencesVSEditor)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -54,29 +51,10 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin32|AnyCPU' " />
<ItemGroup>
- <Reference Include="Humanizer.Core">
- <HintPath>..\..\..\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.Build.Locator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9dff12846e04bfbd, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\Microsoft.Build.Locator.1.1.2\lib\net46\Microsoft.Build.Locator.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.AttributedModel, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\System.Composition.AttributedModel.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.Hosting, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\System.Composition.Hosting.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.Runtime, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\System.Composition.Runtime.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.TypedParts, Version=1.0.31.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\System.Composition.TypedParts.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath>
- </Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http" />
- <Reference Include="monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
@@ -99,117 +77,115 @@
<Private>False</Private>
</Reference>
<Reference Include="monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- </Reference>
<Reference Include="System" />
- <Reference Include="System.AppContext">
- <HintPath>..\..\..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
- </Reference>
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
- </Reference>
- <Reference Include="System.Console">
- <HintPath>..\..\..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
- </Reference>
- <Reference Include="System.Diagnostics.FileVersionInfo">
- <HintPath>..\..\..\packages\System.Diagnostics.FileVersionInfo.4.3.0\lib\net46\System.Diagnostics.FileVersionInfo.dll</HintPath>
- </Reference>
- <Reference Include="System.Diagnostics.StackTrace">
- <HintPath>..\..\..\packages\System.Diagnostics.StackTrace.4.3.0\lib\net46\System.Diagnostics.StackTrace.dll</HintPath>
- </Reference>
- <Reference Include="System.IO.Compression">
- <HintPath>..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
- </Reference>
<Reference Include="System.IO.FileSystem" />
<Reference Include="System.IO.FileSystem.Primitives" />
<Reference Include="System.Runtime.Remoting" />
- <!-- NOTE: NuGet installs the PCL version of System.Reflection.Metadata by default but it is windows-specific. Use netstandard version instead. -->
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard1.1\System.Reflection.Metadata.dll</HintPath>
- </Reference>
- <Reference Include="System.Security.Cryptography.Algorithms">
- <HintPath>..\..\..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
- </Reference>
- <Reference Include="System.Security.Cryptography.Encoding">
- <HintPath>..\..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
- </Reference>
- <Reference Include="System.Security.Cryptography.Primitives" />
- <Reference Include="System.Security.Cryptography.X509Certificates">
- <HintPath>..\..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
- </Reference>
- <Reference Include="System.Text.Encoding.CodePages">
- <HintPath>..\..\..\packages\System.Text.Encoding.CodePages.4.3.0\lib\net46\System.Text.Encoding.CodePages.dll</HintPath>
- </Reference>
- <Reference Include="System.Threading.Tasks.Extensions">
- <HintPath>..\..\..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll</HintPath>
- </Reference>
- <Reference Include="System.Threading.Thread">
- <HintPath>..\..\..\packages\System.Threading.Thread.4.3.0\lib\net46\System.Threading.Thread.dll</HintPath>
- </Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.ReaderWriter">
- <HintPath>..\..\..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.XmlDocument">
- <HintPath>..\..\..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.XPath">
- <HintPath>..\..\..\packages\System.Xml.XPath.4.3.0\lib\net46\System.Xml.XPath.dll</HintPath>
- </Reference>
- <Reference Include="System.Xml.XPath.XDocument">
- <HintPath>..\..\..\packages\System.Xml.XPath.XDocument.4.3.0\lib\net46\System.Xml.XPath.XDocument.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.CodingConventions">
- <HintPath>..\..\..\packages\Microsoft.VisualStudio.CodingConventions.1.1.20180503.2\lib\netstandard1.3\Microsoft.VisualStudio.CodingConventions.dll</HintPath>
- </Reference>
- <Reference Include="System.Buffers">
- <HintPath>..\..\..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
- </Reference>
- <Reference Include="System.Numerics.Vectors">
- <HintPath>..\..\..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
- </Reference>
- <Reference Include="System.Numerics" />
- <Reference Include="System.Runtime.CompilerServices.Unsafe">
- <HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
- </Reference>
- <Reference Include="System.Memory">
- <HintPath>..\..\..\packages\System.Memory.4.5.1\lib\netstandard2.0\System.Memory.dll</HintPath>
- </Reference>
- <Reference Include="System.Net.Http">
- <HintPath>..\..\..\packages\System.Net.Http.4.3.3\lib\net46\System.Net.Http.dll</HintPath>
- </Reference>
- <Reference Include="mscorlib" />
- <Reference Include="Mono.Cecil">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.dll</HintPath>
- </Reference>
- <Reference Include="Mono.Cecil.Mdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
- </Reference>
- <Reference Include="Mono.Cecil.Pdb">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
- </Reference>
- <Reference Include="Mono.Cecil.Rocks">
- <HintPath>..\..\..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
- </Reference>
- <Reference Include="ICSharpCode.Decompiler">
- <HintPath>..\..\..\packages\ICSharpCode.Decompiler.3.2.0.3856\lib\net46\ICSharpCode.Decompiler.dll</HintPath>
- </Reference>
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="SQLitePCLRaw.core">
- <HintPath>..\..\..\packages\SQLitePCLRaw.core.1.1.12\lib\net45\SQLitePCLRaw.core.dll</HintPath>
- </Reference>
- <Reference Include="SQLitePCLRaw.provider.e_sqlite3">
- <HintPath>..\..\..\packages\SQLitePCLRaw.provider.e_sqlite3.net45.1.1.12\lib\net45\SQLitePCLRaw.provider.e_sqlite3.dll</HintPath>
- </Reference>
- <Reference Include="SQLitePCLRaw.batteries_e_sqlite3">
- <HintPath>..\..\..\packages\SQLitePCLRaw.bundle_e_sqlite3.1.1.12\lib\net45\SQLitePCLRaw.batteries_e_sqlite3.dll</HintPath>
- </Reference>
- <Reference Include="SQLitePCLRaw.batteries_v2">
- <HintPath>..\..\..\packages\SQLitePCLRaw.bundle_e_sqlite3.1.1.12\lib\net45\SQLitePCLRaw.batteries_v2.dll</HintPath>
- </Reference>
+ <!-- disable this for now, it's absurdly noisy
+ <PackageReference Include="ClrHeapAllocationAnalyzer" Version="1.0.0.9" />
+ -->
+ <PackageReference Include="Microsoft.Build.Locator" Version="1.1.2" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures" Version="$(NuGetVersionRoslyn)" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.CodeAnalysis.ExternalAccess.MonoDevelop" Version="$(NuGetVersionRoslyn)" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.CodingConventions" Version="1.1.20180503.2" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.Composition" Version="$(NuGetVersionVSComposition)" ExcludeAssets="all" />
+ <!-- Need the net45 version, see https://github.com/mono/mono/issues/12461 -->
+ <Reference Include="$(NuGetPackageRoot)microsoft.visualstudio.composition/$(NuGetVersionVSComposition)/lib/net45/Microsoft.VisualStudio.Composition.dll">
+ <Private>true</Private>
+ </Reference>
+ <PackageReference Include="Mono.Cecil" Version="$(NuGetVersionCecil)" PrivateAssets="runtime" />
+ <PackageReference Include="MonoDevelopDev.Analyzers" Version="$(NuGetVersionMonoDevelopAnalyzers)" />
+ <PackageReference Include="Newtonsoft.Json" Version="$(NuGetVersionNewtonsoftJson)" PrivateAssets="runtime" />
+ <PackageReference Include="SharpZipLib" Version="1.1.0" PrivateAssets="runtime" />
+ <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="1.1.12" PrivateAssets="runtime,build" />
+ <PackageReference Include="StreamJsonRpc" Version="1.5.43" PrivateAssets="runtime" />
+ <PackageReference Include="System.ValueTuple" Version="4.5.0" PrivateAssets="runtime" />
+ <!-- remove this as it conflicts with the one in mscorlib. mono bug? -->
+ <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" ExcludeAssets="all" />
+ <!-- update this to a version that doesn't crash -->
+ <PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.0.96-beta" ExcludeAssets="all" />
+ </ItemGroup>
+ <ItemGroup>
+ <IncludeCopyLocal Include="Humanizer.dll" />
+ <IncludeCopyLocal Include="ICSharpCode.Decompiler.dll" />
+ <IncludeCopyLocal Include="ICSharpCode.SharpZipLib.dll" />
+ <IncludeCopyLocal Include="Microsoft.Build.Locator.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.CSharp.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.CSharp.Features.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.EditorFeatures.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.EditorFeatures.Text.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.EditorFeatures.Wpf.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.Elfie.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.ExternalAccess.MonoDevelop.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.Features.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.VisualBasic.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.VisualBasic.Features.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" />
+ <IncludeCopyLocal Include="Microsoft.CodeAnalysis.Workspaces.dll" />
+ <IncludeCopyLocal Include="Microsoft.DiaSymReader.dll" />
+ <IncludeCopyLocal Include="Microsoft.Microsoft.CodeAnalysis.Workspaces.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.CodingConventions.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Composition.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Composition.NetFxAttributes.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.CoreUtility.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.ImageCatalog.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Imaging.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Imaging.Interop.14.0.DesignTime.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Language.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Language.Intellisense.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Language.NavigateTo.Interfaces.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Language.StandardClassification.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.OLE.Interop.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Platform.VSEditor.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.10.0.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.11.0.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.12.0.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.14.0.DesignTime.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.8.0.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Shell.Interop.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.Data.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.Internal.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.Logic.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.UI.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.UI.Text.Cocoa.View.Implementation.dll" Condition="$(Configuration.Contains('Mac'))" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Text.UI.Wpf.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.TextManager.Interop.8.0.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.TextManager.Interop.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Threading.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Utilities.dll" />
+ <IncludeCopyLocal Include="Microsoft.VisualStudio.Validation.dll" />
+ <IncludeCopyLocal Include="Mono.Addins.dll" />
+ <IncludeCopyLocal Include="Mono.Addins.Setup.dll" />
+ <IncludeCopyLocal Include="Mono.Cecil.dll" />
+ <IncludeCopyLocal Include="Mono.Cecil.Mdb.dll" />
+ <IncludeCopyLocal Include="Mono.Cecil.Pdb.dll" />
+ <IncludeCopyLocal Include="Mono.Cecil.Rocks.dll" />
+ <IncludeCopyLocal Include="Newtonsoft.Json.dll" />
+ <IncludeCopyLocal Include="SQLitePCLRaw.batteries_e_sqlite3.dll" />
+ <IncludeCopyLocal Include="SQLitePCLRaw.batteries_v2.dll" />
+ <IncludeCopyLocal Include="SQLitePCLRaw.core.dll" />
+ <IncludeCopyLocal Include="SQLitePCLRaw.provider.e_sqlite3.dll" />
+ <IncludeCopyLocal Include="StreamJsonRpc.dll" />
+ <IncludeCopyLocal Include="System.Buffers.dll" />
+ <IncludeCopyLocal Include="System.Collections.Immutable.dll" />
+ <IncludeCopyLocal Include="System.Composition.AttributedModel.dll" />
+ <IncludeCopyLocal Include="System.Composition.Convention.dll" />
+ <IncludeCopyLocal Include="System.Composition.Hosting.dll" />
+ <IncludeCopyLocal Include="System.Composition.Runtime.dll" />
+ <IncludeCopyLocal Include="System.Composition.TypedParts.dll" />
+ <IncludeCopyLocal Include="System.Memory.dll" />
+ <IncludeCopyLocal Include="System.Numerics.Vectors.dll" />
+ <IncludeCopyLocal Include="System.Reflection.Metadata.dll" />
+ <IncludeCopyLocal Include="System.Runtime.CompilerServices.Unsafe.dll" />
+ <IncludeCopyLocal Include="System.Text.Encoding.CodePages.dll" />
+ <IncludeCopyLocal Include="System.Threading.Tasks.Dataflow.dll" />
+ <IncludeCopyLocal Include="System.Threading.Tasks.Extensions.dll" />
+ <IncludeCopyLocal Include="System.ValueTuple.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="MonoDevelop.Core\StringParserService.cs" />
@@ -751,7 +727,6 @@
</ItemGroup>
<ItemGroup>
<None Include="BuildVariables.cs.in" />
- <None Include="packages.config" />
<None Include="MSBuild\CodeSharing.Common.props">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@@ -786,10 +761,6 @@
<InternalsVisibleTo Include="MonoDevelop.Ide.Tests" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="MonoDevelop.Utilities\" />
- <Folder Include="MonoDevelop.Core.FeatureConfiguration\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="BeforeBuild" Inputs="BuildVariables.cs.in; $(MSBuildProjectDirectory)\..\..\..\..\version.config" Outputs="BuildVariables.cs" Condition="Exists('$(MSBuildProjectDirectory)\..\..\..\..\version.config')">
<MakeDir Directories="$(FullBuildInfo)" />
@@ -803,8 +774,4 @@
<Exec Command="&quot;$(Git)&quot; rev-parse HEAD &gt; $(VcRevision)" WorkingDirectory="$(MSBuildProjectDirectory)" IgnoreExitCode="True" />
<RemoveDir Directories="$(FullBuildInfo)" />
</Target>
- <Import Project="..\..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.209\build\Microsoft.VisualStudio.Threading.Analyzers.targets" Condition="Exists('..\..\..\packages\Microsoft.VisualStudio.Threading.Analyzers.15.8.209\build\Microsoft.VisualStudio.Threading.Analyzers.targets')" />
- <Import Project="..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
- <Import Project="..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
- <Import Project="..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('..\..\..\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.12\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
</Project>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs
index a5a23b6f99..09c4f428b6 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/MSBuildEvaluationContext.cs
@@ -955,6 +955,7 @@ namespace MonoDevelop.Projects.MSBuild
Tuple.Create (typeof(System.TimeSpan), (string[]) null),
Tuple.Create (typeof(System.Text.RegularExpressions.Regex), (string[]) null),
Tuple.Create (typeof(Microsoft.Build.Utilities.ToolLocationHelper), (string[]) null),
+ Tuple.Create (typeof(System.Globalization.CultureInfo), (string[]) null),
Tuple.Create (typeof(System.Environment), new string [] {
"CommandLine", "ExpandEnvironmentVariables", "GetEnvironmentVariable", "GetEnvironmentVariables", "GetFolderPath", "GetLogicalDrives"
}),
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SdkResolution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SdkResolution.cs
index e4808bd77c..28484ef612 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SdkResolution.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.MSBuild/SdkResolution.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft. All rights reserved.
+// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
index 2cf1311924..764d5d67a3 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/DotNetProjectConfiguration.cs
@@ -176,6 +176,8 @@ namespace MonoDevelop.Projects
public FilePath CompiledOutputName {
get {
+ if (OutputAssembly == null)
+ return FilePath.Empty;
FilePath fullPath = OutputDirectory.Combine (OutputAssembly);
if (OutputAssembly.EndsWith (".dll") || OutputAssembly.EndsWith (".exe"))
return fullPath;
diff --git a/main/src/core/MonoDevelop.Core/packages.config b/main/src/core/MonoDevelop.Core/packages.config
deleted file mode 100644
index 7c1fa9d24f..0000000000
--- a/main/src/core/MonoDevelop.Core/packages.config
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="ClrHeapAllocationAnalyzer" version="1.0.0.9" targetFramework="net471" />
- <package id="ErrorProne.NET.Structs" version="0.1.2" targetFramework="net471" developmentDependency="true" />
- <package id="Humanizer.Core" version="2.2.0" targetFramework="net461" />
- <package id="ICSharpCode.Decompiler" version="3.2.0.3856" targetFramework="net471" />
- <package id="ManagedEsent" version="1.9.4" targetFramework="net461" />
- <package id="Microsoft.Build.Locator" version="1.1.2" targetFramework="net471" />
- <package id="Microsoft.CodeAnalysis" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.Analyzers" version="2.6.1" targetFramework="net471" developmentDependency="true" />
- <package id="Microsoft.CodeAnalysis.Common" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.CSharp.Features" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.EditorFeatures" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.EditorFeatures.Text" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.Elfie" version="1.0.0-rc9" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.Features" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.VisualBasic" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.VisualBasic.Features" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="2.10.0-beta2-63410-10" targetFramework="net461" />
- <package id="Microsoft.Composition" version="1.0.31" targetFramework="net461" />
- <package id="Microsoft.NETCore.Platforms" version="1.0.1" targetFramework="net461" />
- <package id="Microsoft.NETCore.Portable.Compatibility" version="1.0.1" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.CodingConventions" version="1.1.20180503.2" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.Composition" version="15.6.36" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.CoreUtility" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Language" version="15.8.519" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.Language.Intellisense" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Language.StandardClassification" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Text.Data" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Text.Implementation" version="15.2.3-pre" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.Text.Internal" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Text.Logic" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Text.UI" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Text.UI.Wpf" version="15.8.519" targetFramework="net45" />
- <package id="Microsoft.VisualStudio.Threading" version="15.8.209" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.Threading.Analyzers" version="15.8.209" targetFramework="net461" />
- <package id="Microsoft.VisualStudio.Validation" version="15.3.32" targetFramework="net461" />
- <package id="Microsoft.Win32.Primitives" version="4.0.1" targetFramework="net461" />
- <package id="Mono.Cecil" version="0.10.0" targetFramework="net471" />
- <package id="MonoDevelopDev.Analyzers" version="0.1.0.1" targetFramework="net471" developmentDependency="true" />
- <package id="NETStandard.Library" version="1.6.0" targetFramework="net461" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
- <package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
- <package id="SQLitePCLRaw.bundle_e_sqlite3" version="1.1.12" targetFramework="net471" />
- <package id="SQLitePCLRaw.core" version="1.1.12" targetFramework="net471" />
- <package id="SQLitePCLRaw.lib.e_sqlite3.linux" version="1.1.12" targetFramework="net471" />
- <package id="SQLitePCLRaw.lib.e_sqlite3.osx" version="1.1.12" targetFramework="net471" />
- <package id="SQLitePCLRaw.lib.e_sqlite3.v110_xp" version="1.1.12" targetFramework="net471" />
- <package id="SQLitePCLRaw.provider.e_sqlite3.net45" version="1.1.12" targetFramework="net471" />
- <package id="System.AppContext" version="4.3.0" targetFramework="net461" />
- <package id="System.Buffers" version="4.4.0" targetFramework="net461" />
- <package id="System.Collections" version="4.3.0" targetFramework="net461" />
- <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
- <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net461" />
- <package id="System.Composition" version="1.0.31" targetFramework="net461" />
- <package id="System.Composition.AttributedModel" version="1.0.31" targetFramework="net461" />
- <package id="System.Composition.Convention" version="1.0.31" targetFramework="net461" />
- <package id="System.Composition.Hosting" version="1.0.31" targetFramework="net461" />
- <package id="System.Composition.Runtime" version="1.0.31" targetFramework="net461" />
- <package id="System.Composition.TypedParts" version="1.0.31" targetFramework="net461" />
- <package id="System.Console" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.Contracts" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.DiagnosticSource" version="4.0.0" targetFramework="net461" />
- <package id="System.Diagnostics.FileVersionInfo" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.StackTrace" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net461" />
- <package id="System.Diagnostics.Tracing" version="4.1.0" targetFramework="net461" />
- <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net461" />
- <package id="System.Globalization" version="4.3.0" targetFramework="net461" />
- <package id="System.Globalization.Calendars" version="4.0.1" targetFramework="net461" />
- <package id="System.IO" version="4.3.0" targetFramework="net461" />
- <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
- <package id="System.IO.Compression.ZipFile" version="4.0.1" targetFramework="net461" />
- <package id="System.IO.FileSystem" version="4.3.0" targetFramework="net461" />
- <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net461" />
- <package id="System.Linq" version="4.3.0" targetFramework="net461" />
- <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net461" />
- <package id="System.Linq.Parallel" version="4.3.0" targetFramework="net461" />
- <package id="System.Memory" version="4.5.1" targetFramework="net461" />
- <package id="System.Net.Http" version="4.3.3" targetFramework="net461" />
- <package id="System.Net.Primitives" version="4.0.11" targetFramework="net461" />
- <package id="System.Net.Sockets" version="4.1.0" targetFramework="net461" />
- <package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net461" />
- <package id="System.ObjectModel" version="4.3.0" targetFramework="net461" />
- <package id="System.Reflection" version="4.3.0" targetFramework="net461" />
- <package id="System.Reflection.Extensions" version="4.0.1" targetFramework="net461" />
- <package id="System.Reflection.Metadata" version="1.6.0" targetFramework="net461" />
- <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
- <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
- <package id="System.Runtime" version="4.3.0" targetFramework="net461" />
- <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net461" />
- <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />
- <package id="System.Runtime.Handles" version="4.0.1" targetFramework="net461" />
- <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net461" />
- <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net461" />
- <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net461" />
- <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net461" />
- <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net461" />
- <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net461" />
- <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net461" />
- <package id="System.Text.Encoding" version="4.3.0" targetFramework="net461" />
- <package id="System.Text.Encoding.CodePages" version="4.3.0" targetFramework="net461" />
- <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net461" />
- <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Tasks.Parallel" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Thread" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Timer" version="4.0.1" targetFramework="net461" />
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
- <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net461" />
- <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net461" />
- <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="net461" />
- <package id="System.Xml.XPath" version="4.3.0" targetFramework="net461" />
- <package id="System.Xml.XPath.XDocument" version="4.3.0" targetFramework="net461" />
-</packages> \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml
index aeec88b1a6..2335c3c0ce 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MainMenu.addin.xml
@@ -101,6 +101,7 @@
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.MonodevelopPreferences" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.DefaultPolicies" />
</Condition>
+ <SeparatorItem id = "Separator6" />
</ItemSet>
<ItemSet id = "View" _label = "_View">
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
index 70d7823550..d3041ee823 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
@@ -12,22 +12,22 @@
<Import assembly="Microsoft.VisualStudio.Threading.dll" />
<Import assembly="Microsoft.VisualStudio.Validation.dll" />
</Runtime>
-
+
<!-- Extension ponts -->
-
+
<ConditionType id="combineopen" type="MonoDevelop.Ide.Codons.CombineOpenCondition" />
<ConditionType id="activeproject" type="MonoDevelop.Ide.Codons.ProjectActiveCondition" />
<ConditionType id="activelanguage" type="MonoDevelop.Ide.Codons.LanguageActiveCondition" />
-
+
<ExtensionNodeSet id="MonoDevelop.Ide.OptionsDialogSection">
<ExtensionNode name="Section" type="MonoDevelop.Ide.Extensions.OptionsDialogSection" />
</ExtensionNodeSet>
-
+
<ExtensionPoint path = "/MonoDevelop/Core/PlatformService" name = "Platform Service">
<Description>Implementations of platform-dependent code wrapped in a platform-agnostic API. Specified classes must inherit from MonoDevelop.Ide.Desktop.PlatformService.</Description>
<ExtensionNode name="Class" />
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Core/WebBrowsers" name = "Web Browsers">
<Description>Used optionally to provides a web browser widget. Must implement MonoDevelop.Ide.WebBrowser.IWebBrowserLoader</Description>
<ExtensionNode name="Class" />
@@ -37,11 +37,11 @@
<Description>A class implementing IGettingStartedProvider.</Description>
<ExtensionNode name="Class"/>
</ExtensionPoint>
-
+
<ExtensionNodeSet id="MonoDevelop.Components.Commands.KeyBindingScheme">
<ExtensionNode name="Scheme" type="MonoDevelop.Components.Commands.ExtensionNodes.SchemeExtensionNode" />
</ExtensionNodeSet>
-
+
<ExtensionPoint path = "/MonoDevelop/Components/DialogHandlers" name = "Dialog Handlers">
<Description>Allows providing platform-specific implementations for common dialogs</Description>
<ExtensionNode name="Class" />
@@ -72,14 +72,14 @@
<Description>A subclass of MonoDevelop.Components.Commands.CommandHandler</Description>
</ExtensionNode>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/InitCompleteHandlers" name = "Post inialization handlers">
<Description>Commands to be automatically executed when the IDE finishes initalization.</Description>
<ExtensionNode name="Class">
<Description>A subclass of MonoDevelop.Components.Commands.CommandHandler</Description>
</ExtensionNode>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/KeyBindingSchemes" name = "Key binding schemes">
<Description>Key binding schemes.</Description>
<ExtensionNodeSet id="MonoDevelop.Components.Commands.KeyBindingScheme"/>
@@ -89,24 +89,24 @@
<Description>Task list views to be shown in the task list pad.</Description>
<ExtensionNode name="TaskListView" type="MonoDevelop.Ide.Codons.TaskListViewCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/WorkbenchContexts" name = "Workbench contexts">
<Description>Workbench contexts.</Description>
<ExtensionNode name="WorkbenchContext" type="MonoDevelop.Ide.Codons.WorkbenchContextCodon">
<ExtensionNode name ="ContextPad" type="MonoDevelop.Ide.Codons.ContextPadCodon" />
</ExtensionNode>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/ProjectFileFilters" name = "Combine file filters">
<Description>File filters to be shown in the Project Open dialog.</Description>
<ExtensionNode name="FileFilter" type="MonoDevelop.Ide.Codons.FileFilterCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/FileFilters" name = "File filters">
<Description>File filters to be shown in the File Open dialog.</Description>
<ExtensionNode name="FileFilter" type="MonoDevelop.Ide.Codons.FileFilterCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/TextEditorExtensions" name = "Text editor extensions" defaultInsertAfter = "MidStep">
<Description>Extensions to the text editor. Classes must be a subclass of TextEditorExtension.</Description>
<ExtensionNode name="Class" type="MonoDevelop.Ide.Extensions.TextEditorExtensionNode" objectType="MonoDevelop.Ide.Editor.Extension.TextEditorExtension" />
@@ -117,77 +117,77 @@
<ExtensionNode name="Complete" type="MonoDevelop.Ide.CodeCompletion.CompletionCharacterCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/ContextMenu/DocumentTab" name = "View Context Menu">
<Description>The context menu for all open files.</Description>
<ExtensionNodeSet id="MonoDevelop.Components.Commands.ItemSet"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/ExecutionCommandEditors" name = "View Context Menu">
<Description>Widgets which allow editing the configuration of execution commands.</Description>
<ExtensionNode name="Customizer" type="MonoDevelop.Ide.Execution.ExecutionCommandCustomizer" objectType="MonoDevelop.Ide.Execution.IExecutionCommandCustomizer"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/RunConfigurationEditors" name = "Run Configuration Editors">
<Description>Widgets which allow editing run configurations.</Description>
<ExtensionNode name="Class" type="MonoDevelop.Ide.Extensions.RunConfigurationEditorExtensionNode" objectType="MonoDevelop.Ide.Execution.RunConfigurationEditor"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/CodeTemplates" name = "Code Templates">
<Description>Custom code templates.</Description>
<ExtensionNode name="CodeTemplate" type="MonoDevelop.Ide.CodeTemplates.CodeTemplateCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/TextEditorResolver" name = "Text Editor Resolver">
<Description>Text editor resolvers are responsible for getting resolve results inside text editor locations.</Description>
<ExtensionNode name="Resolver" type="MonoDevelop.Ide.Gui.Content.TextEditorResolverProviderCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/WorkbenchLayouts" name = "Workbench Layouts">
<Description>This extension point allows registering layouts and pads to be shown in each layout</Description>
<ExtensionNode name="Layout" type="MonoDevelop.Ide.Extensions.LayoutExtensionNode"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/CustomTools" name = "Custom code generation tools">
<Description>Custom code generation tools. Classes must be a subclass of SingleProjectFileCustomTool or ISingleFileCustomTool.</Description>
<ExtensionNode name="Tool" type="MonoDevelop.Ide.Extensions.CustomToolExtensionNode"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/Fonts" name = "IDE Fonts">
<Description>Addins can register own fonts to be configured.</Description>
<ExtensionNode name="Font" type="MonoDevelop.Ide.Fonts.FontDescriptionCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/CodeFormatters" name = "Code formatters">
<ExtensionNode name="Formatter" type="MonoDevelop.Ide.CodeFormatting.CodeFormatterExtensionNode" />
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/ReferenceFinder" name = "Reference finders">
<Description>Reference finder.</Description>
<ExtensionNode name="ReferenceFinder" type="MonoDevelop.Ide.FindInFiles.ReferenceFinderCodon"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/Ide/Updater/UpdateHandlers" name = "Update handlers">
<ExtensionNode name="Type" />
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/TypeSystem/Parser" name = "TypeSystemParser">
<ExtensionNode name="Parser" type="MonoDevelop.Ide.TypeSystem.TypeSystemParserNode"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/TypeSystem/OutputTracking" name = "TypeSystemOutputTracker">
<ExtensionNode name="Track" type="MonoDevelop.Ide.TypeSystem.TypeSystemOutputTrackingNode"/>
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/TypeSystem/FoldingParser">
<ExtensionNode name="Parser" type="MonoDevelop.Ide.Extensions.MimeTypeExtensionNode"/>
- </ExtensionPoint>
+ </ExtensionPoint>
<ExtensionPoint path = "/MonoDevelop/TypeSystem/AmbienceTooltipProviders" name = "Language ambiences">
<Description>Language ambiences. Specified classes must implement IAmbience.</Description>
<ExtensionNode name="Provider" type="MonoDevelop.Ide.Extensions.MimeTypeExtensionNode" />
</ExtensionPoint>
-
+
<ExtensionPoint path = "/MonoDevelop/TypeSystem/CodeGenerators">
<ExtensionNode name="Generator" type="MonoDevelop.Ide.Extensions.MimeTypeExtensionNode"/>
</ExtensionPoint>
@@ -234,7 +234,7 @@
<Description>Setting what languages are supported for user selection.</Description>
<ExtensionNode name = "Class" objectType = "MonoDevelop.Ide.LocaleSetProvider" />
</ExtensionPoint>
-
+
<ExtensionPoint path="/MonoDevelop/Ide/TypeService/MefHostServices">
<ExtensionNode name = "Assembly" type = "MonoDevelop.Core.AddIns.AssemblyExtensionNode" />
</ExtensionPoint>
@@ -252,13 +252,13 @@
</ExtensionPoint>
<!-- Extensions -->
-
+
<Extension path = "/MonoDevelop/Core/Applications">
<Application id = "gsetup"
description = "Graphical extension setup utility"
class = "MonoDevelop.Ide.Gui.Dialogs.SetupApp"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Core/SystemInformation">
<Class class = "MonoDevelop.Ide.IdeVersionInfo" />
<Class class = "MonoDevelop.Ide.RuntimeVersionInfo" />
@@ -276,7 +276,7 @@
<Class class = "MonoDevelop.Ide.Gui.Dialogs.TipOfTheDayStartup"/>
<Class class = "MonoDevelop.Ide.LogReportingStartup"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/KeyBindingSchemes">
<Scheme id="Emacs" _name = "GNU/Emacs" resource="KeyBindingSchemeEmacs.xml"/>
<Scheme id="VS05" _name = "Visual Studio" resource="KeyBindingSchemeVisualStudio.xml"/>
@@ -288,16 +288,16 @@
<Scheme id="VSCodeMAC" _name = "Visual Studio Code" resource="KeyBindingSchemeVSCode-mac.xml" forMac="true"/>
<Scheme id="RiderMAC" _name = "ReSharper / Rider" resource="KeyBindingSchemeRider-mac.xml" forMac="true"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/TaskList/View">
<TaskListView _label = "Comments" class = "MonoDevelop.Ide.Tasks.CommentTasksView" />
<TaskListView _label = "User Tasks" class = "MonoDevelop.Ide.Tasks.UserTasksView" />
</Extension>
-
+
<Extension path="/MonoDevelop/Ide/WorkbenchLayouts">
<Layout id="Solution" _name="Solution" />
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/FileFilters">
<FileFilter id = "Assemblies"
_label = "Assemblies"
@@ -309,7 +309,7 @@
_label = ".NET Resource Files"
extensions = "*.resources,*.resx"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/ProjectFileFilters">
<FileFilter id = "SlnCombine"
_label = "Solution Files"
@@ -321,7 +321,7 @@
_label = "MD Workbench"
extensions = "*.mdw"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/TextEditorExtensions">
<Class id="InitialStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
<Class id="MidStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
@@ -340,7 +340,7 @@
<Class class = "MonoDevelop.Ide.Editor.Extension.LineSeparatorTextEditorExtension" />
<Class id="FinalStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/ContextMenu/DocumentTab">
<CommandItem id = "MonoDevelop.Ide.Commands.FileCommands.CloseFile" />
<CommandItem id = "MonoDevelop.Ide.Commands.FileTabCommands.CloseAll" />
@@ -357,21 +357,21 @@
<CommandItem id = "MonoDevelop.Ide.Commands.ViewCommands.NextNotebook" />
<CommandItem id = "MonoDevelop.Ide.Commands.ViewCommands.PreviousNotebook" />
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/ExecutionCommandEditors">
<Customizer id="MonoDevelop.Ide.Execution.CustomArgsCustomizer" _name="Arguments" />
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/RunConfigurationEditors">
<Class class="MonoDevelop.Ide.Projects.OptionPanels.AssemblyRunConfigurationEditor" runConfigurationType="MonoDevelop.Projects.AssemblyRunConfiguration" />
</Extension>
-
+
<Extension path="/MonoDevelop/Ide/Fonts">
<Font name="Editor" _displayName="Text Editor" default="_DEFAULT_MONOSPACE" defaultMac="Menlo 12" /><!-- TODO: VV: "_DEFAULT_MONOSPACE" => "Consolas 10" -->
<Font name="Pad" _displayName="General Pad Text" default="_DEFAULT_SANS" defaultMac="Lucida Grande 11" defaultMacYosemite="Helvetica Neue 11" /><!-- TODO: VV: "_DEFAULT_SANS" => "Segoe UI 9" -->
<Font name="OutputPad" _displayName="Output Pad Contents" default="_DEFAULT_MONOSPACE" defaultMac="Menlo 11" /><!-- TODO: VV: "_DEFAULT_MONOSPACE" => "Consolas 9" -->
</Extension>
-
+
<Extension path = "/MonoDevelop/Core/UserDataMigration">
<!-- 2.4 -->
<Migration sourceVersion="2.4" kind="UserData" path="KeyBindings.xml" targetPath="KeyBindings/Custom.kb.xml" />
@@ -399,11 +399,11 @@
<Tool name="ResXFileCodeGenerator" type="MonoDevelop.Ide.CustomTools.ResXFileCodeGenerator" />
<Tool name="PublicResXFileCodeGenerator" type="MonoDevelop.Ide.CustomTools.PublicResXFileCodeGenerator" />
</Extension>
-
+
<Extension path = "/MonoDevelop/Core/FileSystemExtensions">
<Class id="Ide" class = "MonoDevelop.Ide.Projects.IdeFileSystemExtensionExtension" insertafter = "FinalStep"/>
</Extension>
-
+
<Extension path = "/MonoDevelop/Ide/CompletionCharacters">
<Complete id="Other" language="Other" commitOnSpace="True" commitChars="{}[]().,:;+-*/%&amp;|^!~=&lt;&gt;?@#'&quot;\"/>
</Extension>
@@ -414,22 +414,20 @@
<Extension path="/MonoDevelop/Ide/Composition">
<Assembly file="Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll"/>
+ <Assembly file="Microsoft.CodeAnalysis.CSharp.Features.dll" />
+ <Assembly file="Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
<Assembly file="Microsoft.CodeAnalysis.EditorFeatures.dll"/>
<Assembly file="Microsoft.CodeAnalysis.EditorFeatures.Text.dll"/>
<Assembly file="Microsoft.CodeAnalysis.Features.dll" />
- <Assembly file="Microsoft.CodeAnalysis.Workspaces.dll" />
- <Assembly file="Microsoft.CodeAnalysis.Workspaces.Desktop.dll" />
- <Assembly file="Microsoft.CodeAnalysis.CSharp.Features.dll" />
- <Assembly file="Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
+ <Assembly file="Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.dll"/>
<Assembly file="Microsoft.CodeAnalysis.VisualBasic.Features.dll" />
<Assembly file="Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" />
- <Assembly file="MonoDevelop.Ide.dll"/>
- <Assembly file="Microsoft.CodeAnalysis.VisualBasic.EditorFeatures.dll"/>
- <Assembly file="Microsoft.VisualStudio.Text.Implementation.dll"/>
+ <Assembly file="Microsoft.CodeAnalysis.Workspaces.dll" />
+ <Assembly file="Microsoft.VisualStudio.CodingConventions.dll" />
+ <Assembly file="Microsoft.VisualStudio.Language.StandardClassification.dll"/>
<Assembly file="Microsoft.VisualStudio.Text.Logic.dll"/>
<Assembly file="Microsoft.VisualStudio.Text.UI.dll"/>
- <Assembly file="Microsoft.VisualStudio.Language.StandardClassification.dll"/>
- <Assembly file="Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll" />
+ <Assembly file="MonoDevelop.Ide.dll"/>
</Extension>
</ExtensionModel>
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/StockIcons.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/StockIcons.addin.xml
index e69fd5c58c..af7a2e6bc8 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/StockIcons.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/StockIcons.addin.xml
@@ -76,17 +76,17 @@
<StockIcon stockid="md-bookmark-toggle" resource="bookmark-toggle-16.png" size="Menu" />
<StockIcon stockid="md-breadcrumb-next" resource="breadcrumb-next-16.png" size="Menu" />
<StockIcon stockid="md-breadcrumb-prev" resource="breadcrumb-prev-16.png" size="Menu" />
- <StockIcon stockid="md-breakpoint" resource="breakpoint-16.png" size="Menu" />
+ <StockIcon stockid="md-breakpoint" resource="breakpoint-16.png" size="Menu" imageid="324" />
<StockIcon stockid="md-breakpoint-disable-all" resource="breakpoint-disable-all-16.png" size="Menu" />
- <StockIcon stockid="md-breakpoint-disabled" resource="breakpoint-disabled-16.png" size="Menu" />
- <StockIcon stockid="md-breakpoint-invalid" resource="breakpoint-invalid-16.png" size="Menu" />
+ <StockIcon stockid="md-breakpoint-disabled" resource="breakpoint-disabled-16.png" size="Menu" imageid="323" />
+ <StockIcon stockid="md-breakpoint-invalid" resource="breakpoint-invalid-16.png" size="Menu" imageid="327" />
<StockIcon stockid="md-breakpoint-new" resource="breakpoint-new-16.png" size="Menu" />
<StockIcon stockid="md-breakpoint-on-off" resource="breakpoint-on-off-16.png" size="Menu" />
<StockIcon stockid="md-bug" resource="bug-16.png" size="Menu" />
<StockIcon stockid="md-catchpoint" resource="catchpoint-16.png" size="Menu" />
<StockIcon stockid="md-catchpoint-new" resource="catchpoint-new-16.png" size="Menu" />
<StockIcon stockid="md-catchpoint-disabled" resource="catchpoint-disabled-16.png" size="Menu" />
- <StockIcon stockid="md-class" resource="element-class-16.png" size="Menu" />
+ <StockIcon stockid="md-class" resource="element-class-16.png" size="Menu" imageid="463;466;471;472;473;474" />
<StockIcon stockid="md-classes-pad" resource="pad-classes-16.png" size="Menu" />
<StockIcon stockid="md-class-file" resource="file-class-16.png" size="Menu" />
<StockIcon stockid="md-class-file" resource="file-class-32.png" size="Dnd" />
@@ -98,7 +98,7 @@
<StockIcon stockid="md-command" resource="command-16.png" size="Menu" />
<StockIcon stockid="md-comment" resource="comment-16.png" size="Menu" />
<StockIcon stockid="md-console" resource="pad-application-output-16.png" size="Menu" />
- <StockIcon stockid="md-delegate" resource="element-delegate-16.png" size="Menu" />
+ <StockIcon stockid="md-delegate" resource="element-delegate-16.png" size="Menu" imageid="909;910;911;912;913;914" />
<StockIcon stockid="md-delete" resource="remove-16.png" size="Menu" />
<StockIcon stockid="md-delete-simple" resource="remove-simple-16.png" size="Menu" />
<StockIcon stockid="md-disclose-arrow-down" resource="disclose-arrow-down-16.png" size="Menu" />
@@ -106,18 +106,18 @@
<StockIcon stockid="md-done" resource="done-16.png" size="Menu" />
<StockIcon stockid="md-empty" resource="empty-16.png" size="Menu" />
<StockIcon stockid="md-empty-file-icon" resource="file-generic-16.png" size="Menu" />
- <StockIcon stockid="md-enum" resource="element-enum-16.png" size="Menu" />
+ <StockIcon stockid="md-enum" resource="element-enum-16.png" size="Menu" imageid="1120;1121;1129;1130;1131;1132" />
<StockIcon stockid="md-enum-file" resource="file-enum-16.png" size="Menu" />
<StockIcon stockid="md-enum-file" resource="file-enum-32.png" size="Dnd" />
<StockIcon stockid="md-errors-list" resource="pad-error-list-16.png" size="Menu" />
<StockIcon stockid="md-errors-list-has-errors" resource="pad-error-list-errors-16.png" size="Menu" />
<StockIcon stockid="md-errors-list-has-warnings" resource="pad-error-list-warnings-16.png" size="Menu" />
- <StockIcon stockid="md-event" resource="element-event-16.png" size="Menu" />
- <StockIcon stockid="md-exception" resource="element-exception-16.png" size="Menu" />
+ <StockIcon stockid="md-event" resource="element-event-16.png" size="Menu" imageid="1142;1145;1150;1151;1152;1153" />
+ <StockIcon stockid="md-exception" resource="element-exception-16.png" size="Menu" imageid="1161;1162;1163;1164;1165" />
<StockIcon stockid="md-execute-all" resource="execute-all-16.png" size="Menu" />
- <StockIcon stockid="md-extensionmethod" resource="element-extensionmethod-16.png" size="Menu" />
+ <StockIcon stockid="md-extensionmethod" resource="element-extensionmethod-16.png" size="Menu" imageid="1204" />
<StockIcon stockid="md-feedback" resource="feedback-16.png" size="Menu" />
- <StockIcon stockid="md-field" resource="element-field-16.png" size="Menu" />
+ <StockIcon stockid="md-field" resource="element-field-16.png" size="Menu" imageid="1217;1218;1220;1221;1222;1223" />
<StockIcon stockid="md-file-css" resource="file-css-16.png" size="Menu" />
<StockIcon stockid="md-file-css" resource="file-css-32.png" size="Dnd" />
<StockIcon stockid="md-file-less" resource="file-less-16.png" size="Menu" />
@@ -154,24 +154,24 @@
<StockIcon stockid="md-help" resource="help-16.png" size="Menu" />
<StockIcon stockid="md-html-file-icon" resource="file-web-16.png" size="Menu" />
<StockIcon stockid="md-html-file-icon" resource="file-web-32.png" size="Dnd" />
- <StockIcon stockid="md-interface" resource="element-interface-16.png" size="Menu" />
+ <StockIcon stockid="md-interface" resource="element-interface-16.png" size="Menu" imageid="1603;1605;1606;1607;1608;1609" />
<StockIcon stockid="md-interface-file" resource="file-interface-16.png" size="Menu" />
<StockIcon stockid="md-interface-file" resource="file-interface-32.png" size="Dnd" />
- <StockIcon stockid="md-keyword" resource="element-keyword-16.png" size="Menu" />
+ <StockIcon stockid="md-keyword" resource="element-keyword-16.png" size="Menu" imageid="1589" />
<StockIcon stockid="md-link-overlay" resource="link-overlay-16.png" size="Menu" />
- <StockIcon stockid="md-literal" resource="element-constant-16.png" size="Menu" />
+ <StockIcon stockid="md-literal" resource="element-constant-16.png" size="Menu" imageid="616;617;618;619;620;621;1122;1123;1124;1125;1126;1127;1128" />
<StockIcon stockid="md-live" resource="live-16.png" size="Menu" />
<StockIcon stockid="md-magnify" resource="pad-search-16.png" size="Menu" />
<StockIcon stockid="md-message-log" resource="pad-application-output-16.png" size="Menu" />
- <StockIcon stockid="md-method" resource="element-method-16.png" size="Menu" />
+ <StockIcon stockid="md-method" resource="element-method-16.png" size="Menu" imageid="1874;1876;1878;1879;1880;1881" />
<StockIcon stockid="md-misc-files" resource="file-generic-16.png" size="Menu" />
- <StockIcon stockid="md-module" resource="element-module-16.png" size="Menu" />
+ <StockIcon stockid="md-module" resource="element-module-16.png" size="Menu" imageid="1913;1916;1917;1918;1919;1920" />
<StockIcon stockid="md-monodevelop" resource="monodevelop-16.png" size="Menu" />
<StockIcon stockid="md-monodevelop" resource="monodevelop-22.png" />
<StockIcon stockid="md-monodevelop" resource="monodevelop-22.png" size="Button" />
<StockIcon stockid="md-monodevelop" resource="monodevelop-32.png" size="Dnd" />
<StockIcon stockid="md-monodevelop" resource="monodevelop-48.png" size="Dialog" />
- <StockIcon stockid="md-name-space" resource="element-namespace-16.png" size="Menu" />
+ <StockIcon stockid="md-name-space" resource="element-namespace-16.png" size="Menu" imageid="1951;1952;1953;1054;1955;1956" />
<StockIcon stockid="md-navigate-back" resource="breadcrumb-prev-16.png" size="Menu" />
<StockIcon stockid="md-navigate-forward" resource="breadcrumb-next-16.png" size="Menu" />
<StockIcon stockid="md-newmethod" resource="element-method-new-16.png" size="Menu" />
@@ -233,7 +233,7 @@
<StockIcon stockid="md-reference-project" resource="reference-project-16.png" size="Menu" />
<StockIcon stockid="md-reference-invalid" resource="reference-invalid-16.png" size="Menu" />
<StockIcon stockid="md-reference-warning" resource="reference-invalid-16.png" size="Menu" />
- <StockIcon stockid="md-property" resource="element-property-16.png" size="Menu" />
+ <StockIcon stockid="md-property" resource="element-property-16.png" size="Menu" imageid="2429;2431;2434;2435;2436;2437" />
<StockIcon stockid="md-reference" resource="reference-16.png" size="Menu" />
<StockIcon stockid="md-reference-package" resource="reference-16.png" size="Menu" />
<StockIcon stockid="md-region" resource="region-16.png" size="Menu" />
@@ -249,16 +249,16 @@
<StockIcon stockid="md-solution-pad" resource="pad-solution-16.png" size="Menu" />
<StockIcon stockid="md-sort-alphabetically" resource="sort-alphabetically-16.png" size="Menu" />
<StockIcon stockid="md-stop" resource="stop-16.png" size="Menu" />
- <StockIcon stockid="md-struct" resource="element-struct-16.png" size="Menu" />
+ <StockIcon stockid="md-struct" resource="element-struct-16.png" size="Menu" imageid="2992;2993;2994;2995;2996;2997;3331;3332;3333;3334;3335;3336;3337" />
<StockIcon stockid="md-struct-file" resource="file-struct-16.png" size="Menu" />
<StockIcon stockid="md-struct-file" resource="file-struct-32.png" size="Dnd" />
<StockIcon stockid="md-task-list" resource="pad-task-list-16.png" size="Menu" />
- <StockIcon stockid="md-template" resource="element-template-16.png" size="Menu" />
- <StockIcon stockid="md-template-surroundwith" resource="element-template-surroundwith-16.png" size="Menu" />
+ <StockIcon stockid="md-template" resource="element-template-16.png" size="Menu" imageid="2852" />
+ <StockIcon stockid="md-template-surroundwith" resource="element-template-surroundwith-16.png" size="Menu" imageid="2853" />
<StockIcon stockid="md-text-file-icon" resource="file-text-16.png" size="Menu" />
<StockIcon stockid="md-text-file-icon" resource="file-text-32.png" size="Dnd" />
- <StockIcon stockid="md-type" resource="element-type-16.png" size="Menu" />
- <StockIcon stockid="md-variable" resource="element-variable-16.png" size="Menu" />
+ <StockIcon stockid="md-type" resource="element-type-16.png" size="Menu" imageid="3233;3241;3242;3243;3244;3245" />
+ <StockIcon stockid="md-variable" resource="element-variable-16.png" size="Menu" imageid="1409;1747;1847;2242" />
<StockIcon stockid="md-warning-overlay" resource="reference-invalid-16.png" size="Menu" />
<StockIcon stockid="md-workspace" resource="workspace-16.png" size="Menu" />
<StockIcon stockid="md-xml-file-icon" resource="file-xml-16.png" size="Menu" />
@@ -295,9 +295,9 @@
<StockIcon stockid="md-typography" resource="typography-16.png" size="Menu" />
<StockIcon stockid="md-scroll" resource="scroll-16.png" size="Menu" />
<StockIcon stockid="md-widget" resource="widget-16.png" size="Menu" />
- <StockIcon stockid="md-lightbulb" resource="lightbulb-16.png" size="Menu" />
- <StockIcon stockid="md-lightbulb-error" resource="lightbulb-error-16.png" size="Menu" />
- <StockIcon stockid="md-lightbulb-screwdriver" resource="lightbulb-screwdriver-16.png" size="Menu" />
+ <StockIcon stockid="md-lightbulb" resource="lightbulb-16.png" size="Menu" imageid="1590;{f09c8ce2-d515-4226-a430-dec104c81f05}#2" />
+ <StockIcon stockid="md-lightbulb-error" resource="lightbulb-error-16.png" size="Menu" imageid="3751;{f09c8ce2-d515-4226-a430-dec104c81f05}#3" />
+ <StockIcon stockid="md-lightbulb-screwdriver" resource="lightbulb-screwdriver-16.png" size="Menu" imageid="3752;{f09c8ce2-d515-4226-a430-dec104c81f05}#1" />
<!-- Project icons -->
<StockIcon stockid="md-workspace" resource="workspace-32.png" size="Dnd" />
@@ -342,7 +342,7 @@
<StockIcon stockid="gtk-dialog-question" resource="question-32.png" size="Dnd" />
<StockIcon stockid="gtk-dialog-question" resource="question-48.png" size="Dialog" />
- <StockIcon stockid="md-error" resource="error-16.png" />
+ <StockIcon stockid="md-error" resource="error-16.png" imageid="2854" />
<StockIcon stockid="md-error" resource="error-16.png" size="Menu" />
<StockIcon stockid="md-error" resource="error-24.png" size="Button" />
<StockIcon stockid="md-error" resource="error-24.png" size="LargeToolbar" />
diff --git a/main/src/core/MonoDevelop.Ide/Makefile.am b/main/src/core/MonoDevelop.Ide/Makefile.am
deleted file mode 100644
index fe8940e113..0000000000
--- a/main/src/core/MonoDevelop.Ide/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-SUBDIRS = \
- MonoDevelop.Ide.Editor.Highlighting
-
-EXTRA_DIST += \
- gtkrc \
- gtkrc.mac \
- gtkrc.mac-dark \
- gtkrc.win32 \
- gtkrc.win32-dark
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCategoryCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCategoryCodon.cs
index cf973ae9f0..88bef15a9c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCategoryCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCategoryCodon.cs
@@ -28,8 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
-using System;
using Mono.Addins;
namespace MonoDevelop.Components.Commands.ExtensionNodes
@@ -38,12 +36,6 @@ namespace MonoDevelop.Components.Commands.ExtensionNodes
internal class CommandCategoryCodon : ExtensionNode
{
[NodeAttribute ("_name", true, "Name", Localizable=true)]
- string name;
-
- public string Name {
- get {
- return name;
- }
- }
+ public string Name { get; private set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs
index 9ceaa9c678..de92f02b76 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs
@@ -1,47 +1,44 @@
-//
-// CommandCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-
-
+//
+// CommandCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using MonoDevelop.Core;
-using MonoDevelop.Components.Commands;
-using Mono.Addins;
-using System.ComponentModel;
using System.Linq;
+using Mono.Addins;
+using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands.ExtensionNodes
{
[ExtensionNode (Description="A user interface command. The 'id' of the command must match the full name of an existing enumeration. An arbitrary string can also be used as an id for the command by just using '@' as prefix for the string.")]
internal class CommandCodon : TypeExtensionNode
- {
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute ("_label", true, "Label", Localizable=true)]
string label;
@@ -73,8 +70,10 @@ namespace MonoDevelop.Components.Commands.ExtensionNodes
string widget = null;
[NodeAttribute("defaultHandler", "Class that handles this command. This property is optional.")]
- string defaultHandler;
-
+ string defaultHandler;
+
+ #pragma warning restore 649
+
public override object CreateInstance ()
{
ActionType ct = ActionType.Normal;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandItemCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandItemCodon.cs
index 0c2768f18d..6b797d3ff8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandItemCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandItemCodon.cs
@@ -1,51 +1,49 @@
-//
-// CommandItemCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Components.Commands;
+//
+// CommandItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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.Components.Commands.ExtensionNodes
{
[ExtensionNode (Description="A command menu or toolbar item. The id of the element must match the id of a registered command.")]
internal class CommandItemCodon : InstanceExtensionNode
- {
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute ("_label", "Label", Localizable=true)]
string label;
[NodeAttribute ("disabledVisible", "Visible when disabled")]
- bool disabledVisible = true;
-
+ bool disabledVisible = true;
+
+ #pragma warning restore 649
+
public override object CreateInstance ()
{
object id = CommandCodon.ParseCommandId (this);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/ItemSetCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/ItemSetCodon.cs
index cb0fd54c6b..c9e6ff48a9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/ItemSetCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/ItemSetCodon.cs
@@ -1,63 +1,58 @@
-//
-// ItemSetCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-
-
+//
+// ItemSetCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Components.Commands;
-using MonoDevelop.Core;
using Mono.Addins;
+using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands.ExtensionNodes
{
[ExtensionNode (Description="A submenu")]
- internal class ItemSetCodon : InstanceExtensionNode
- {
+ class ItemSetCodon : InstanceExtensionNode
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute ("_label", "Label of the submenu", Localizable=true)]
string label;
- public string Label {
- get {
- return label ?? Id;
- }
-
- private set {
- label = value;
- }
- }
[NodeAttribute("icon", "Icon of the submenu. The provided value must be a registered stock icon. A resource icon can also be specified using 'res:' as prefix for the name, for example: 'res:customIcon.png'")]
string icon;
[NodeAttribute("autohide", "Whether the submenu should be hidden when it contains no items.")]
- bool autohide;
+ bool autohide;
+
+ #pragma warning restore 649
+
+ public string Label {
+ get => label ?? Id;
+ private set => label = value;
+ }
public override object CreateInstance ()
{
@@ -65,11 +60,12 @@ namespace MonoDevelop.Components.Commands.ExtensionNodes
label = StringParserService.Parse (label);
if (icon != null) icon = CommandCodon.GetStockId (Addin, icon);
- CommandEntrySet cset = new CommandEntrySet (label, icon);
- cset.CommandId = Id;
- cset.AutoHide = autohide;
+ var cset = new CommandEntrySet (label, icon) {
+ CommandId = Id,
+ AutoHide = autohide
+ };
foreach (InstanceExtensionNode e in ChildNodes) {
- CommandEntry ce = e.CreateInstance () as CommandEntry;
+ var ce = e.CreateInstance () as CommandEntry;
if (ce != null)
cset.Add (ce);
else
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/LinkItemCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/LinkItemCodon.cs
index 9f6e479a98..c11c9fbc21 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/LinkItemCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/LinkItemCodon.cs
@@ -1,55 +1,49 @@
-//
-// LinkItemCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Components.Commands;
-using MonoDevelop.Core;
+//
+// LinkItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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.Components.Commands.ExtensionNodes
{
[ExtensionNode (Description="A menu or toolbar item that opens an URL when activated")]
- internal class LinkItemCodon : InstanceExtensionNode
- {
+ class LinkItemCodon : InstanceExtensionNode
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute ("_label", "Label of the item.", Localizable=true)]
string label;
[NodeAttribute ("link", "URL to open.")]
- string link;
-
-// [XmlMemberAttribute("description")]
-// string description;
-
+ string link;
+
+ #pragma warning restore 649
+
public override object CreateInstance ()
{
// FIXME: Use internal resource
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SchemeExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SchemeExtensionNode.cs
index 4d55f72f48..05b07fc62f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SchemeExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SchemeExtensionNode.cs
@@ -1,80 +1,66 @@
-// SchemeExtensionNode.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-// Copyright (c) 2007 Novell, Inc (http://www.novell.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.
-//
-//
-
+// SchemeExtensionNode.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (c) 2007 Novell, Inc (http://www.novell.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 System;
using System.IO;
-using Mono.Addins;
using System.Xml;
+using Mono.Addins;
using MonoDevelop.Core;
namespace MonoDevelop.Components.Commands.ExtensionNodes
{
- internal class SchemeExtensionNode: ExtensionNode, KeyBindingScheme
- {
- [NodeAttribute ("_name", "Name of the key bindings scheme", Localizable=true)]
+ class SchemeExtensionNode: ExtensionNode, KeyBindingScheme
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
+ [NodeAttribute ("_name", "Name of the key bindings scheme", Localizable = true)]
string name;
+ #pragma warning restore 649
+
[NodeAttribute ("file", "Name of the key bindings file")]
- string file;
-
+ public string File { get; private set; }
+
[NodeAttribute ("forMac", "Whether the keybinding file is for Macs.")]
- bool isForMac;
+ public bool IsForMac { get; private set; }
[NodeAttribute ("resource", "Name of the resource containing the key bindings file.")]
- string resource;
-
+ public string Resource { get; private set; }
+
KeyBindingSet cachedSet;
- public string Name {
- get { return name ?? Id; }
- }
-
- public string File {
- get {
- return file;
- }
- }
-
- public string Resource {
- get {
- return resource;
- }
- }
-
- public bool IsForMac {
- get { return isForMac; }
- }
+ public string Name => name ?? Id;
public Stream GetKeyBindingsSchemeStream ()
{
- if (!string.IsNullOrEmpty (file))
- return System.IO.File.OpenRead (Addin.GetFilePath (file));
- if (!string.IsNullOrEmpty (resource))
- return Addin.GetResource (resource, true);
+ if (!string.IsNullOrEmpty (File))
+ return System.IO.File.OpenRead (Addin.GetFilePath (File));
+ if (!string.IsNullOrEmpty (Resource))
+ return Addin.GetResource (Resource, true);
throw new InvalidOperationException ("File or resource name not specified");
}
@@ -96,7 +82,7 @@ namespace MonoDevelop.Components.Commands.ExtensionNodes
}
} catch (Exception e) {
LoggingService.LogError ("Error reading keybindings definition '{0}' in addin '{1}'.\n {2}",
- file ?? resource, Addin.Id, e.ToString ());
+ File ?? Resource, Addin.Id, e.ToString ());
} finally {
if (reader != null)
reader.Close ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SeparatorItemCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SeparatorItemCodon.cs
index 28154e9f25..1c78721915 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SeparatorItemCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/SeparatorItemCodon.cs
@@ -1,48 +1,46 @@
-//
-// SeparatorItemCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Components.Commands;
+//
+// SeparatorItemCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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.Components.Commands.ExtensionNodes
{
[ExtensionNode (Description="A separator menu or toolbar item")]
- internal class SeparatorItemCodon : InstanceExtensionNode
- {
- [NodeAttribute ("_label", "Label of the item.", Localizable = true)]
- string label;
+ class SeparatorItemCodon : InstanceExtensionNode
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+ [NodeAttribute ("_label", "Label of the item.", Localizable = true)]
+ string label;
+
+ #pragma warning restore 649
+
public override object CreateInstance ()
{
return new CommandEntry (Command.Separator, label);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandInfo.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandInfo.cs
index 98642130e7..43c7c9e28e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandInfo.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandInfo.cs
@@ -143,7 +143,13 @@ namespace MonoDevelop.Components.Commands
}
}
-
+
+ /// <summary>
+ /// Disables the button in case of Shell locked
+ /// </summary>
+ /// <value><c>true</c> if the button disables on GUI lock; otherwise, <c>false</c>. default value: <c>true</c></value>
+ public bool DisableOnShellLock { get; set; } = true;
+
public object DataItem {
get; internal set;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
index bb0c33fefc..488fbfa2a8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs
@@ -448,6 +448,33 @@ namespace MonoDevelop.Components.Commands
internal bool ProcessKeyEvent (Gdk.EventKey ev)
{
+ // Handle the GDK key via MD commanding
+ if (ProcessKeyEventCore (ev))
+ return true;
+
+#if MAC
+ // Otherwise if we have a native first responder that is not the GdkQuartzView
+ // that contains the entire GTK shell, dispatch the key directly to the native
+ // NSResponder and tell GTK to get out of our way.
+
+ var currentEvent = AppKit.NSApplication.SharedApplication?.CurrentEvent;
+ var window = currentEvent?.Window;
+ var firstResponder = window?.FirstResponder;
+
+ if (currentEvent != null &&
+ currentEvent.Type == AppKit.NSEventType.KeyDown &&
+ firstResponder != null &&
+ firstResponder != window.ContentView) {
+ firstResponder.KeyDown (currentEvent);
+ return true;
+ }
+#endif
+
+ return false;
+ }
+
+ bool ProcessKeyEventCore (Gdk.EventKey ev)
+ {
if (!IsEnabled)
return true;
@@ -1467,13 +1494,12 @@ namespace MonoDevelop.Components.Commands
object cmdTarget = GetFirstCommandTarget (targetRoute);
CommandInfo info = new CommandInfo (cmd);
- while (cmdTarget != null)
- {
- HandlerTypeInfo typeInfo = GetTypeHandlerInfo (cmdTarget);
-
- bool bypass = false;
-
- CommandUpdaterInfo cui = typeInfo.GetCommandUpdater (commandId);
+ while (cmdTarget != null) {
+ ICustomCommandTarget typeInfo = GetTypeHandlerInfo (cmdTarget);
+
+ bool bypass = false;
+
+ ICommandUpdater cui = typeInfo.GetCommandUpdater (commandId);
if (cui != null) {
if (sourceUpdateInfo != null && cmdTarget == sourceUpdateInfo.SourceTarget && sourceUpdateInfo.IsUpdatingAsynchronously) {
// If the source update info was provided and it was part of an asynchronous command update, reuse it to avoid
@@ -1502,7 +1528,7 @@ namespace MonoDevelop.Components.Commands
}
if (!bypass) {
- CommandHandlerInfo chi = typeInfo.GetCommandHandler (commandId);
+ ICommandHandler chi = typeInfo.GetCommandHandler (commandId);
if (chi != null) {
object localTarget = cmdTarget;
if (cmd.CommandArray) {
@@ -1672,11 +1698,9 @@ namespace MonoDevelop.Components.Commands
object cmdTarget = GetFirstCommandTarget (targetRoute);
- while (cmdTarget != null)
- {
- HandlerTypeInfo typeInfo = GetTypeHandlerInfo (cmdTarget);
- CommandUpdaterInfo cui = typeInfo.GetCommandUpdater (commandId);
-
+ while (cmdTarget != null) {
+ ICustomCommandTarget typeInfo = GetTypeHandlerInfo (cmdTarget);
+ ICommandUpdater cui = typeInfo.GetCommandUpdater (commandId);
bool bypass = false;
bool handlerFound = false;
@@ -1685,7 +1709,7 @@ namespace MonoDevelop.Components.Commands
info.ArrayInfo = new CommandArrayInfo (info);
cui.Run (cmdTarget, info.ArrayInfo);
if (!info.ArrayInfo.Bypass) {
- if (guiLock > 0)
+ if (info.DisableOnShellLock && guiLock > 0)
info.Enabled = false;
handlerFound = true;
}
@@ -1694,7 +1718,7 @@ namespace MonoDevelop.Components.Commands
info.Bypass = false;
cui.Run (cmdTarget, info);
if (!info.Bypass) {
- if (guiLock > 0)
+ if (info.DisableOnShellLock && guiLock > 0)
info.Enabled = false;
handlerFound = true;
}
@@ -1722,7 +1746,7 @@ namespace MonoDevelop.Components.Commands
continue;
}
else if (!bypass && typeInfo.GetCommandHandler (commandId) != null) {
- info.Enabled = guiLock == 0;
+ info.Enabled = !info.DisableOnShellLock || guiLock == 0;
info.Visible = true;
return info;
@@ -1746,7 +1770,7 @@ namespace MonoDevelop.Components.Commands
CurrentCommand = null;
}
- if (guiLock > 0)
+ if (info.DisableOnShellLock && guiLock > 0)
info.Enabled = false;
return info;
}
@@ -1912,11 +1936,14 @@ namespace MonoDevelop.Components.Commands
CommandDeselected (this, EventArgs.Empty);
}
- HandlerTypeInfo GetTypeHandlerInfo (object cmdTarget)
+ ICustomCommandTarget GetTypeHandlerInfo (object cmdTarget)
{
- HandlerTypeInfo typeInfo = (HandlerTypeInfo) handlerInfo [cmdTarget.GetType ()];
- if (typeInfo != null) return typeInfo;
-
+ if (cmdTarget is ICustomCommandTarget customtarget) {
+ return customtarget;
+ }
+
+ HandlerTypeInfo typeInfo = (HandlerTypeInfo)handlerInfo[cmdTarget.GetType ()];
+ if (typeInfo != null) return typeInfo;
Type type = cmdTarget.GetType ();
typeInfo = new HandlerTypeInfo ();
@@ -2203,6 +2230,13 @@ namespace MonoDevelop.Components.Commands
}
#endif
+ #if WINDOWS
+ var wpfWidget = GetFocusedWpfWidget();
+ if (wpfWidget != null) {
+ return wpfWidget;
+ }
+ #endif
+
widget = GetFocusedChild (widget);
}
if (widget != lastActiveWidget) {
@@ -2213,6 +2247,32 @@ namespace MonoDevelop.Components.Commands
return widget;
}
+#if WINDOWS
+
+ // Can't simply use Keyboard.FocusedElement because the focused element is the MenuItem
+ // when filling out the File menu.
+ // Also can't use FocusManager.GetFocusedElement() because it's not clear what to pass as
+ // the focus scope, as there isn't a single WPF "window", but rather isolated WPF "islands"
+ // and which one is the focused one?
+ // We remember the last focused element before the menu acquired focus and use that.
+ public static System.Windows.FrameworkElement LastFocusedWpfElement { get; set; }
+
+ Windows.GtkWPFWidget GetFocusedWpfWidget ()
+ {
+ var focusedElement = System.Windows.Input.Keyboard.FocusedElement as System.Windows.FrameworkElement;
+ if (focusedElement == null) {
+ return null;
+ }
+
+ if (focusedElement is System.Windows.Controls.MenuItem && LastFocusedWpfElement != null) {
+ return LastFocusedWpfElement.Tag as Windows.GtkWPFWidget;
+ }
+
+ var widget = focusedElement.Tag as Windows.GtkWPFWidget;
+ return widget;
+ }
+#endif
+
Gtk.Widget GetFocusedChild (Gtk.Widget widget)
{
while (widget is Gtk.Container) {
@@ -2541,12 +2601,12 @@ namespace MonoDevelop.Components.Commands
public Control NewActiveWidget { get; internal set; }
}
- internal class HandlerTypeInfo
+ internal class HandlerTypeInfo : ICustomCommandTarget
{
public CommandHandlerInfo[] CommandHandlers;
public CommandUpdaterInfo[] CommandUpdaters;
- public CommandHandlerInfo GetCommandHandler (object commandId)
+ public ICommandHandler GetCommandHandler (object commandId)
{
if (CommandHandlers == null) return null;
foreach (CommandHandlerInfo cui in CommandHandlers)
@@ -2555,7 +2615,7 @@ namespace MonoDevelop.Components.Commands
return null;
}
- public CommandUpdaterInfo GetCommandUpdater (object commandId)
+ public ICommandUpdater GetCommandUpdater (object commandId)
{
if (CommandUpdaters == null) return null;
foreach (CommandUpdaterInfo cui in CommandUpdaters)
@@ -2591,7 +2651,7 @@ namespace MonoDevelop.Components.Commands
}
}
- internal class CommandHandlerInfo: CommandMethodInfo
+ internal class CommandHandlerInfo: CommandMethodInfo, ICommandHandler
{
ICommandTargetHandler customHandlerChain;
ICommandArrayTargetHandler customArrayHandlerChain;
@@ -2630,7 +2690,7 @@ namespace MonoDevelop.Components.Commands
}
}
- internal class CommandUpdaterInfo: CommandMethodInfo
+ internal class CommandUpdaterInfo: CommandMethodInfo, ICommandUpdater
{
ICommandUpdateHandler customHandlerChain;
ICommandArrayUpdateHandler customArrayHandlerChain;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/ICustomCommandTarget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/ICustomCommandTarget.cs
new file mode 100644
index 0000000000..552d44ff9c
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/ICustomCommandTarget.cs
@@ -0,0 +1,49 @@
+//
+// Copyright (C) Microsoft Corp. All rights reserved.
+//
+// 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.
+//
+
+namespace MonoDevelop.Components.Commands
+{
+ /// <summary>
+ /// Command targets can implement this interface to provide custom command handling.
+ /// They will be be queried for handlers via these methods instead of being inspected
+ /// for command handler attributes.
+ /// </summary>
+ public interface ICustomCommandTarget
+ {
+ ICommandHandler GetCommandHandler (object commandId);
+ ICommandUpdater GetCommandUpdater (object commandId);
+ }
+
+ public interface ICommandHandler
+ {
+ void Run (object cmdTarget, Command cmd);
+ void Run (object cmdTarget, Command cmd, object dataItem);
+ }
+
+ public interface ICommandUpdater
+ {
+ void Run (object cmdTarget, CommandInfo info);
+ void Run (object cmdTarget, CommandArrayInfo info);
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs
index 64b1158b83..0f126d89ab 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/AutoHideBox.cs
@@ -54,8 +54,6 @@ namespace MonoDevelop.Components.Docking
DockFrame frame;
bool animating;
int targetSize;
- int targetPos;
- ScrollableContainer scrollable;
Gtk.PositionType position;
bool disposed;
bool insideGrip;
@@ -213,7 +211,7 @@ namespace MonoDevelop.Components.Docking
break;
case PositionType.Right:
Width += 1 + (targetSize - Width) / 3;
- X = targetPos - Width;
+ X = - Width;
if (Width < targetSize)
return true;
break;
@@ -224,13 +222,12 @@ namespace MonoDevelop.Components.Docking
break;
case PositionType.Bottom:
Height += 1 + (targetSize - Height) / 3;
- Y = targetPos - Height;
+ Y = - Height;
if (Height < targetSize)
return true;
break;
}
-
- scrollable.ScrollMode = false;
+
if (horiz)
Width = targetSize;
else
@@ -257,7 +254,7 @@ namespace MonoDevelop.Components.Docking
int ns = Width - 1 - Width / 3;
if (ns > 0) {
Width = ns;
- X = targetPos - ns;
+ X = - ns;
return true;
}
break;
@@ -274,7 +271,7 @@ namespace MonoDevelop.Components.Docking
int ns = Height - 1 - Height / 3;
if (ns > 0) {
Height = ns;
- Y = targetPos - ns;
+ Y = - ns;
return true;
}
break;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
index 89de00dbc1..8a3227fe0c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Docking/TabStrip.cs
@@ -174,11 +174,11 @@ namespace MonoDevelop.Components.Docking
return null;
}
}
-
- new public Gtk.Widget CurrentPage {
+
+ public Widget CurrentPage {
get {
if (currentTab != -1) {
- DockItemTitleTab t = (DockItemTitleTab) box.Children [currentTab];
+ var t = (DockItemTitleTab) box.Children [currentTab];
return t.Page;
} else
return null;
@@ -187,7 +187,7 @@ namespace MonoDevelop.Components.Docking
if (value != null) {
Gtk.Widget[] tabs = box.Children;
for (int n = 0; n < tabs.Length; n++) {
- DockItemTitleTab tab = (DockItemTitleTab) tabs [n];
+ var tab = (DockItemTitleTab) tabs [n];
if (tab.Page == value) {
CurrentTab = n;
return;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
index f5bfff2c3e..f3eb73109a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
@@ -1,42 +1,43 @@
-//
-// MainToolbarController.cs
-//
-// Author:
-// Marius Ungureanu <marius.ungureanu@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.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.
+//
+// MainToolbarController.cs
+//
+// Author:
+// Marius Ungureanu <marius.ungureanu@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.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 System;
using System.Collections.Generic;
using System.Linq;
-using MonoDevelop.Ide;
+using Gtk;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
+using Mono.Addins;
using MonoDevelop.Components.Commands;
using MonoDevelop.Components.Commands.ExtensionNodes;
using MonoDevelop.Core;
-using Gtk;
-using Mono.Addins;
-using MonoDevelop.Projects;
using MonoDevelop.Core.Execution;
-using System.Text;
-using MonoDevelop.Ide.TypeSystem;
-
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Commands;
+using MonoDevelop.Projects;
+
namespace MonoDevelop.Components.MainToolbar
{
class MainToolbarController : ICommandBar
@@ -245,6 +246,7 @@ namespace MonoDevelop.Components.MainToolbar
var cmds = IdeApp.CommandService.CreateCommandEntrySet (TargetsMenuPath);
if (cmds.Count > 0) {
bool needsSeparator = runtimes > 0;
+ var an = DockNotebook.DockNotebook.ActiveNotebook;
foreach (CommandEntry ce in cmds) {
if (ce.CommandId == Command.Separator) {
needsSeparator = true;
@@ -252,7 +254,7 @@ namespace MonoDevelop.Components.MainToolbar
}
var cmd = ce.GetCommand (IdeApp.CommandService) as ActionCommand;
if (cmd != null) {
- var ci = IdeApp.CommandService.GetCommandInfo (cmd.Id, new CommandTargetRoute (lastCommandTarget));
+ var ci = IdeApp.CommandService.GetCommandInfo (cmd.Id, new CommandTargetRoute (lastCommandTarget));
if (ci.Visible) {
if (needsSeparator) {
list.Add (new RuntimeModel (this, displayText: null));
@@ -262,7 +264,8 @@ namespace MonoDevelop.Components.MainToolbar
runtimes++;
}
}
- }
+ }
+ DockNotebook.DockNotebook.ActiveNotebook = an;
}
ToolbarView.PlatformSensitivity = runtimes > 1;
@@ -717,11 +720,14 @@ namespace MonoDevelop.Components.MainToolbar
if (pattern.Pattern == null && pattern.LineNumber > 0) {
DestroyPopup ();
var doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null && doc.Editor != null) {
+ if (doc?.GetContent<ITextView> () is ITextView view) {
doc.Select ();
- doc.Editor.CaretLocation = new MonoDevelop.Ide.Editor.DocumentLocation (pattern.LineNumber, pattern.Column > 0 ? pattern.Column : 1);
- doc.Editor.CenterToCaret ();
- doc.Editor.StartCaretPulseAnimation ();
+ var snapshot = view.TextBuffer.CurrentSnapshot;
+ var line = snapshot.GetLineFromLineNumber (pattern.LineNumber - 1);
+ if (line != null) {
+ view.Caret.MoveTo (new SnapshotPoint (snapshot, line.Start + Math.Min (pattern.Column - 1, line.Length)));
+ IdeApp.CommandService.DispatchCommand (ViewCommands.CenterAndFocusCurrentDocument);
+ }
}
return;
}
@@ -747,9 +753,9 @@ namespace MonoDevelop.Components.MainToolbar
{
IdeApp.Workbench.Present ();
var text = lastSearchText;
- var actDoc = IdeApp.Workbench.ActiveDocument;
- if (actDoc != null && actDoc.Editor != null && actDoc.Editor.IsSomethingSelected) {
- string selected = actDoc.Editor.SelectedText;
+ var doc = IdeApp.Workbench.ActiveDocument;
+ if (doc?.GetContent<ITextView> () is ITextView view && !view.Selection.IsEmpty) {
+ string selected = view.Selection.SelectedSpans[0].GetText ();
int whitespaceIndex = selected.TakeWhile (c => !char.IsWhiteSpace (c)).Count ();
text = selected.Substring (0, whitespaceIndex);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.ShimNavigateToSearchService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.ShimNavigateToSearchService.cs
index b6a29308d1..09ce39d366 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.ShimNavigateToSearchService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.ShimNavigateToSearchService.cs
@@ -49,7 +49,9 @@ namespace MonoDevelop.Components.MainToolbar
public Task<ImmutableArray<INavigateToSearchResult>> SearchDocumentAsync (Document document, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken)
=> _navigateToSearchService.SearchDocumentAsync (document, searchPattern, cancellationToken);
- public Task<ImmutableArray<INavigateToSearchResult>> SearchProjectAsync (Project project, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken)
- => _navigateToSearchService.SearchProjectAsync (project, searchPattern, cancellationToken);
+ public Task<ImmutableArray<INavigateToSearchResult>> SearchProjectAsync (Project project, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, CancellationToken cancellationToken)
+ {
+ return _navigateToSearchService.SearchProjectAsync (project, searchPattern, cancellationToken);
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
index 7130446930..f24117edaa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
@@ -1,4 +1,4 @@
-//
+//
// RoslynSearchCategory.cs
//
// Author:
@@ -159,8 +159,11 @@ namespace MonoDevelop.Components.MainToolbar
return Task.Run (async delegate {
try {
- var kinds = GetTagKinds (searchPattern.Tag);
- // Maybe use language services instead of AbstractNavigateToSearchService
+ var kinds = GetTagKinds (searchPattern.Tag);
+
+ // TODO: Fill this right.
+ var priorityDocuments = ImmutableArray.Create<Document> ();
+ // Maybe use language services instead of AbstractNavigateToSearchService
var aggregatedResults = await Task.WhenAll (IdeApp.TypeSystemService.AllWorkspaces
.Select (ws => ws.CurrentSolution)
.SelectMany (sol => sol.Projects)
@@ -169,7 +172,7 @@ namespace MonoDevelop.Components.MainToolbar
var searchService = TryGetNavigateToSearchService (proj);
if (searchService == null)
return ImmutableArray<INavigateToSearchResult>.Empty;
- return await searchService.SearchProjectAsync (proj, searchPattern.Pattern, kinds ?? searchService.KindsProvided, token).ConfigureAwait (false);
+ return await searchService.SearchProjectAsync (proj, priorityDocuments, searchPattern.Pattern, kinds ?? searchService.KindsProvided, token).ConfigureAwait (false);
}
})
).ConfigureAwait (false);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
index c29810cb61..28f02af4b2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Control.cs
@@ -188,7 +188,7 @@ namespace MonoDevelop.Components
return null;
}
- public void GrabFocus ()
+ public virtual void GrabFocus ()
{
if (nativeWidget is Gtk.Widget)
((Gtk.Widget)nativeWidget).GrabFocus ();
@@ -196,7 +196,7 @@ namespace MonoDevelop.Components
}
- public bool HasFocus {
+ public virtual bool HasFocus {
get
{
// TODO
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/HslColor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/HslColor.cs
index 9d5fcdf600..5ede74043c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/HslColor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/HslColor.cs
@@ -188,6 +188,13 @@ namespace MonoDevelop.Components
return rv << 16 | gv << 8 | bv;
}
+ public (byte R, byte G, byte B, byte A) ToRgba ()
+ {
+ double r, g, b;
+ ToRgb (out r, out g, out b);
+ return ((byte)(r * 255), (byte)(g * 255), (byte) (b * 255), (byte)(Alpha * 255));
+ }
+
public static HslColor FromPixel (uint pixel)
{
var r = ((pixel >> 16) & 0xFF) / 255.0;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
index 0e60209254..174438bca8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/MDMenuItem.cs
@@ -205,7 +205,7 @@ namespace MonoDevelop.Components.Mac
void SetItemValues (NSMenuItem item, CommandInfo info, bool disabledVisible, string overrideLabel = null)
{
- item.SetTitleWithMnemonic (GetCleanCommandText (info, overrideLabel));
+ item.Title = GetCleanCommandText (info, overrideLabel);
bool enabled = info.Enabled && (!IsGloballyDisabled || commandSource == CommandSource.ContextMenu);
bool visible = info.Visible && (disabledVisible || info.Enabled);
@@ -350,11 +350,11 @@ namespace MonoDevelop.Components.Mac
i += 3;
}
} else if (ch == '_') {
+ // macOS hasn't supported mnemonics since 10.6, so strip them entirely,
+ // but still preserve '__' as a literal escaped '_'
if (i + 1 < txt.Length && txt[i + 1] == '_') {
sb.Append ('_');
i++;
- } else {
- sb.Append ('&');
}
} else if (!ci.UseMarkup) {
sb.Append (ch);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/Util.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/Util.cs
index 6edfe3894e..f5938e8c92 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/Util.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Mac/Util.cs
@@ -123,9 +123,15 @@ namespace MonoDevelop.Components.Mac
static Selector applyFontTraits = new Selector ("applyFontTraits:range:");
public static NSAttributedString ToAttributedString (this FormattedText ft)
+ => ToAttributedString (ft, null);
+
+ public static NSAttributedString ToAttributedString (
+ this FormattedText ft,
+ Action<NSMutableAttributedString, NSRange> beforeAttribution)
{
NSMutableAttributedString ns = new NSMutableAttributedString (ft.Text);
ns.BeginEditing ();
+ beforeAttribution?.Invoke (ns, new NSRange (0, ns.Length));
foreach (var att in ft.Attributes) {
var r = new NSRange (att.StartIndex, att.Count);
if (att is BackgroundTextAttribute) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Windows/GtkWPFWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Windows/GtkWPFWidget.cs
index f48c95b7d1..0c3ce5268a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Windows/GtkWPFWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/Windows/GtkWPFWidget.cs
@@ -46,7 +46,7 @@ namespace MonoDevelop.Components.Windows
{
wpfWidgetHost = new System.Windows.Forms.Integration.ElementHost
{
- BackColor = System.Drawing.Color.Transparent,
+ BackColor = System.Drawing.Color.SeaGreen,
Child = wpfControl,
};
@@ -71,18 +71,18 @@ namespace MonoDevelop.Components.Windows
RepositionWpfWindow (scale, scale);
}
- protected void RepositionWpfWindow (int hscale, int vscale)
+ protected void RepositionWpfWindow (double hscale, double vscale)
{
int x, y;
if (TranslateCoordinates (Toplevel, 0, 0, out x, out y)) {
- wpfWidgetHost.Left = x;
- wpfWidgetHost.Top = y;
+ wpfWidgetHost.Left = (int)(x * hscale);
+ wpfWidgetHost.Top = (int)(y * vscale);
} else {
wpfWidgetHost.Left = Allocation.Left;
wpfWidgetHost.Top = Allocation.Top;
}
- wpfWidgetHost.Width = (Allocation.Width + 1) * hscale;
- wpfWidgetHost.Height = (Allocation.Height + 1) * vscale;
+ wpfWidgetHost.Width = (int)((Allocation.Width + 1) * hscale);
+ wpfWidgetHost.Height = (int)((Allocation.Height + 1) * vscale);
}
protected override void OnRealized ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CodeCompletionContextEventArgs.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CodeCompletionContextEventArgs.cs
index 5d455b0bb3..2061f16119 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CodeCompletionContextEventArgs.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CodeCompletionContextEventArgs.cs
@@ -33,7 +33,8 @@ namespace MonoDevelop.Ide.CodeCompletion
get;
set;
}
-
+
+ [Obsolete]
public CodeCompletionContext CodeCompletionContext {
get;
set;
@@ -44,10 +45,9 @@ namespace MonoDevelop.Ide.CodeCompletion
set;
}
- internal CodeCompletionContextEventArgs (ICompletionWidget widget, CodeCompletionContext codeCompletionContext, string completedWord)
+ internal CodeCompletionContextEventArgs (ICompletionWidget widget, string completedWord)
{
this.Widget = widget;
- this.CodeCompletionContext = codeCompletionContext;
this.CompletedWord = completedWord;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionCharacterCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionCharacterCodon.cs
index 3d08bbf39a..bf9dd84320 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionCharacterCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionCharacterCodon.cs
@@ -23,28 +23,32 @@
// 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 System;
+
using Mono.Addins;
namespace MonoDevelop.Ide.CodeCompletion
{
[ExtensionNode (Description="Defines the behaviour of the code completion commit chars.")]
- public class CompletionCharacterCodon : ExtensionNode
- {
- [NodeAttribute("language", "The language.")]
+ class CompletionCharacterCodon : ExtensionNode
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
+ [NodeAttribute ("language", "The language.")]
string language;
[NodeAttribute("commitOnSpace", "Commit completion on space.")]
bool commitOnSpace;
[NodeAttribute("commitChars", "The chars used for commit.")]
- string commitChars;
-
+ string commitChars;
+
+ #pragma warning restore 649
+
public CompletionCharacters CreateCompletionChar ()
{
return new CompletionCharacters (language, commitOnSpace, commitChars);
}
}
-
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionController.cs
index 236107c3b6..5a5761aa77 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionController.cs
@@ -35,13 +35,14 @@ using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
namespace MonoDevelop.Ide.CodeCompletion
-{
+{
/// <summary>
/// This is the controller of the code completion window.
/// The controller takes code completion data and keystrokes as input, and shows the
/// results in the code completion view.
/// </summary>
- class CompletionController: IDisposable, IListDataProvider, ICompletionViewEventSink
+ [Obsolete]
+ class CompletionController : IDisposable, IListDataProvider, ICompletionViewEventSink
{
ICompletionView view;
ICompletionDataList dataList;
@@ -69,11 +70,6 @@ namespace MonoDevelop.Ide.CodeCompletion
CompletionListWindow listWindow;
/// <summary>
- /// Completion context provided by the completion widget. Has information about the location of the caret.
- /// </summary>
- CodeCompletionContext context;
-
- /// <summary>
/// The widget for which the completion window is shown
/// </summary>
ICompletionWidget completionWidget;
@@ -1139,7 +1135,7 @@ namespace MonoDevelop.Ide.CodeCompletion
item.InsertCompletionText (listWindow, ref ka, descriptor);
}
cache.CommitCompletionData (item);
- OnWordCompleted (new CodeCompletionContextEventArgs (completionWidget, context, item.DisplayText));
+ OnWordCompleted (new CodeCompletionContextEventArgs (completionWidget, item.DisplayText));
} finally {
IsInCompletion = false;
HideWindow ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
index 112c1040cb..5d21baf8a7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
@@ -38,6 +38,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionData : IComparable
{
protected CompletionData () { }
@@ -274,6 +275,7 @@ namespace MonoDevelop.Ide.CodeCompletion
/// several calls on the matching methods will be able to reuse
/// calculated data.
/// </summary>
+ [Obsolete]
internal class CompletionDataMatcher
{
public int MatcherId { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionDataList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionDataList.cs
index a1d8ba495d..151cc1eadb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionDataList.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionDataList.cs
@@ -36,6 +36,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public interface ICompletionDataList : IList<CompletionData>
{
int TriggerWordStart { get; }
@@ -68,17 +69,20 @@ namespace MonoDevelop.Ide.CodeCompletion
}
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public interface ICompletionKeyHandler
{
bool PreProcessKey (CompletionListWindow listWindow, KeyDescriptor descriptor, out KeyActions keyAction);
bool PostProcessKey (CompletionListWindow listWindow, KeyDescriptor descriptor, out KeyActions keyAction);
}
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public enum CompletionSelectionMode {
InsideTextEditor,
OwnTextField
}
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionDataList : List<CompletionData>, ICompletionDataList
{
public int TriggerWordStart { get; set; } = -1;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
index a954a6d4b2..3c76b3fcfb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
@@ -1,4 +1,4 @@
-// CompletionListWindow.cs
+// CompletionListWindow.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -40,6 +40,7 @@ using Xwt;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionListWindow
{
ICompletionView window;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindowGtk.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindowGtk.cs
index eb9ff8f2a3..f51ea29774 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindowGtk.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindowGtk.cs
@@ -1,4 +1,4 @@
-// CompletionListWindow.cs
+// CompletionListWindow.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -39,6 +39,7 @@ using Xwt.Drawing;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete]
class CompletionListWindowGtk : PopoverWindow, ICompletionView
{
const int declarationWindowMargin = 3;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs
index 3d7f404487..4921a42f94 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs
@@ -32,6 +32,7 @@ using MonoDevelop.Ide.Editor;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionWindowManager
{
static CompletionListWindow wnd;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionKeyHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionKeyHandler.cs
index 3aa7504dd7..660383863b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionKeyHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionKeyHandler.cs
@@ -1,4 +1,4 @@
-//
+//
// ICompletionKeyHandler.cs
//
// Author:
@@ -28,6 +28,7 @@ using Microsoft.CodeAnalysis.Text;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public interface ICompletionDataKeyHandler
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionView.cs
index 451af9aa90..83f74d1f93 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionView.cs
@@ -1,4 +1,4 @@
-//
+//
// CodeCompletionSession.cs
//
// Author:
@@ -33,6 +33,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
interface ICompletionView
{
void Initialize (IListDataProvider provider, ICompletionViewEventSink eventSink);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionViewEventSink.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionViewEventSink.cs
index ba53ef6699..0be2d8e4af 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionViewEventSink.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ICompletionViewEventSink.cs
@@ -1,4 +1,4 @@
-//
+//
// CodeCompletionSession.cs
//
// Author:
@@ -33,6 +33,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
interface ICompletionViewEventSink
{
void OnDoubleClick ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/IListDataProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/IListDataProvider.cs
index 90b13abec9..e3e9e04786 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/IListDataProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/IListDataProvider.cs
@@ -1,4 +1,4 @@
-// ListWindow.cs
+// ListWindow.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -39,6 +39,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
interface IListDataProvider
{
int ItemCount { get; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
index eb60efdfbf..65fc49630b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWidget.cs
@@ -44,6 +44,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CategorizedCompletionItems
{
public CompletionCategory CompletionCategory {
@@ -60,6 +61,7 @@ namespace MonoDevelop.Ide.CodeCompletion
internal IListDataProvider DataProvider { get; set; }
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionListFilterInput
{
public ICompletionDataList DataList { get; }
@@ -76,6 +78,7 @@ namespace MonoDevelop.Ide.CodeCompletion
}
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionListFilterResult
{
public readonly List<CategorizedCompletionItems> CategorizedItems;
@@ -93,6 +96,7 @@ namespace MonoDevelop.Ide.CodeCompletion
}
}
+ [Obsolete]
class ListWidget : Gtk.DrawingArea
{
const int minSize = 400;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MruCache.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MruCache.cs
index 64b53a2551..db0b6b5828 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MruCache.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MruCache.cs
@@ -1,4 +1,4 @@
-//
+//
// MruCache.cs
//
// Author:
@@ -31,6 +31,7 @@ namespace MonoDevelop.Ide.CodeCompletion
/// <summary>
/// A cache that keeps a list of the most recently used completion items
/// </summary>
+ [Obsolete("This should not have been public")]
public class MruCache
{
const int MaxItems = 42;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MutableCompletionDataList.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MutableCompletionDataList.cs
index 1503733e73..e9fe7ec5d4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MutableCompletionDataList.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/MutableCompletionDataList.cs
@@ -31,6 +31,7 @@ using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public interface IMutableCompletionDataList : ICompletionDataList, IDisposable
{
bool IsChanging { get; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs
index 3de56d214e..c2e8d9f249 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingData.cs
@@ -37,6 +37,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public abstract class ParameterHintingData
{
public abstract int ParameterCount {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingResult.cs
index 4ae9e09fc8..cb3864b88e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterHintingResult.cs
@@ -1,4 +1,4 @@
-//
+//
// ParameterHintingResult.cs
//
// Author:
@@ -29,6 +29,7 @@ using Microsoft.CodeAnalysis.Text;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class ParameterHintingResult : IReadOnlyList<ParameterHintingData>
{
public static readonly ParameterHintingResult Empty = new ParameterHintingResult (new List<ParameterHintingData> ());
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindow.cs
index e43ace4010..28e08143c2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindow.cs
@@ -40,6 +40,7 @@ using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete]
class ParameterInformationWindow : XwtThemedPopup
{
CompletionTextEditorExtension ext;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
index 65888f2db6..40bacf91de 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ParameterInformationWindowManager.cs
@@ -38,6 +38,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class ParameterInformationWindowManager
{
static MethodData currentMethodGroup;
@@ -292,6 +293,7 @@ namespace MonoDevelop.Ide.CodeCompletion
}
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
class MethodData
{
public ParameterHintingResult MethodProvider;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/RoslynCompletionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/RoslynCompletionData.cs
index 310e017785..5aa3a95a46 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/RoslynCompletionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/RoslynCompletionData.cs
@@ -1,4 +1,4 @@
-//
+//
// RoslynCompletionData.cs
//
// Author:
@@ -51,6 +51,7 @@ using Microsoft.CodeAnalysis.Editor;
namespace MonoDevelop.Ide.CodeCompletion
{
+ [Obsolete ("Use the Roslyn completion APIs")]
public abstract class RoslynCompletionData : CompletionData
{
protected readonly Microsoft.CodeAnalysis.Document doc;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/SignatureHelpParameterHintingData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/SignatureHelpParameterHintingData.cs
index 0c2f8f399a..4a9cc06aca 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/SignatureHelpParameterHintingData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/SignatureHelpParameterHintingData.cs
@@ -1,4 +1,4 @@
-//
+//
// SignatureHelpParameterHintingData.cs
//
// Author:
@@ -44,6 +44,7 @@ namespace MonoDevelop.Ide.CodeCompletion
/// <summary>
/// SignatureHelpItem is internal, therefore this class has only internal visibility.
/// </summary>
+ [Obsolete]
class SignatureHelpParameterHintingData : Ide.CodeCompletion.ParameterHintingData
{
public SignatureHelpParameterHintingData (SignatureHelpItem item)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
index 74bad6d290..06983c4398 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/TooltipInformationWindow.cs
@@ -44,6 +44,7 @@ namespace MonoDevelop.Ide.CodeCompletion
readonly List<TooltipInformation> overloads = new List<TooltipInformation> ();
int current_overload;
+ [Obsolete]
public int CurrentOverload {
get {
return current_overload;
@@ -54,6 +55,7 @@ namespace MonoDevelop.Ide.CodeCompletion
}
}
+ [Obsolete]
public int Overloads {
get {
return overloads.Count;
@@ -61,12 +63,15 @@ namespace MonoDevelop.Ide.CodeCompletion
}
readonly FixedWidthWrapLabel headLabel;
+
+ [Obsolete]
public bool Multiple{
get {
return overloads.Count > 1;
}
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public void AddOverload (TooltipInformation tooltipInformation)
{
if (tooltipInformation == null || tooltipInformation.IsEmpty)
@@ -81,6 +86,7 @@ namespace MonoDevelop.Ide.CodeCompletion
ShowOverload ();
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public async Task AddOverload (CompletionData data, CancellationToken cancelToken)
{
try {
@@ -109,6 +115,7 @@ namespace MonoDevelop.Ide.CodeCompletion
public int LabelMaxWidth { get { return labelMaxWidth; } set { labelMaxWidth = Math.Max (100, value); } }
+ [Obsolete]
void ShowOverload ()
{
Opacity = 0;
@@ -175,6 +182,7 @@ namespace MonoDevelop.Ide.CodeCompletion
// return "<span foreground=\"#a7a79c\" size=\"larger\">" + headerName + "</span>";
}
+ [Obsolete]
public void OverloadLeft ()
{
if (current_overload == 0) {
@@ -186,6 +194,7 @@ namespace MonoDevelop.Ide.CodeCompletion
ShowOverload ();
}
+ [Obsolete]
public void OverloadRight ()
{
if (current_overload == overloads.Count - 1) {
@@ -268,8 +277,10 @@ namespace MonoDevelop.Ide.CodeCompletion
headLabel.FontDescription = IdeServices.FontService.GetFontDescription ("Editor").CopyModified (Styles.FontScale11);
Theme.Font = IdeServices.FontService.SansFont.CopyModified (Styles.FontScale11).ToXwtFont ();
Theme.ShadowColor = Styles.PopoverWindow.ShadowColor;
- if (this.Visible)
- ShowOverload ();
+ #pragma warning disable CS0612 // Type or member is obsolete
+ if (this.Visible)
+ ShowOverload ();
+ #pragma warning restore CS0612
}
public TooltipInformationWindow ()
@@ -310,15 +321,20 @@ namespace MonoDevelop.Ide.CodeCompletion
IdeApp.Preferences.ColorScheme.Changed += HandleThemeChanged;
}
+
protected override bool OnPagerLeftClicked ()
- {
- OverloadLeft ();
+ {
+#pragma warning disable CS0612 // Type or member is obsolete
+ OverloadLeft ();
+#pragma warning restore CS0612 // Type or member is obsolete
return base.OnPagerLeftClicked ();
}
protected override bool OnPagerRightClicked ()
- {
- OverloadRight ();
+ {
+#pragma warning disable CS0612 // Type or member is obsolete
+ OverloadRight ();
+#pragma warning restore CS0612 // Type or member is obsolete
return base.OnPagerRightClicked ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs
index 1d82523240..29dbc09930 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs
@@ -36,6 +36,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Ide.CodeFormatting
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class AbstractCodeFormatter
{
protected abstract ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, ITextSource input, int startOffset, int length);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
index 8f700b77fc..01b1f5b0a0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
@@ -1,4 +1,4 @@
-//
+//
// Formatter.cs
//
// Author:
@@ -36,6 +36,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Ide.CodeFormatting
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class CodeFormatter
{
readonly AbstractCodeFormatter formatter;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
index 53e1b1e5c1..36b49ed0f8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
@@ -1,45 +1,40 @@
-//
-// CodeFormatterNode.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-//
-// Copyright (c) 2011 Novell, Inc.
-//
-// 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 System;
+//
+// CodeFormatterNode.cs
+//
+// Copyright (c) 2011 Novell, Inc.
+//
+// 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 System;
using Mono.Addins;
namespace MonoDevelop.Ide.CodeFormatting
{
+ [Obsolete]
class CodeFormatterExtensionNode : TypeExtensionNode
{
[NodeAttribute ("mimeType", true, "The mimetype that this formatter can handle.")]
- string mimeType;
-
- public string MimeType {
- get { return mimeType; }
- }
+ public string MimeType { get; private set; }
public AbstractCodeFormatter GetFormatter ()
{
- return (AbstractCodeFormatter) this.GetInstance ();
+ return (AbstractCodeFormatter) GetInstance ();
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
index 4684592772..1cae697887 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
@@ -33,7 +33,8 @@ using MonoDevelop.Ide.Editor;
using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.CodeFormatting
-{
+{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public sealed class CodeFormatterService
{
static List<CodeFormatterExtensionNode> nodes = new List<CodeFormatterExtensionNode> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
index f1e439b449..fd3ce44f73 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs
@@ -36,8 +36,9 @@ namespace MonoDevelop.Ide.CodeFormatting
{
public enum CodeFormattingCommands {
FormatBuffer
- }
-
+ }
+
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class FormatBufferHandler : CommandHandler
{
internal static CodeFormatter GetFormatter (out Document doc)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
index c8c7b1dbb0..42c3096008 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
@@ -36,6 +36,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.CodeFormatting
{
+ [Obsolete]
class DefaultCodeFormatter : AbstractCodeFormatter
{
static int GetNextTabstop (int currentColumn, int tabSize)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
index 6e579b74d2..02c2341b08 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs
@@ -517,14 +517,30 @@ namespace MonoDevelop.Ide.CodeTemplates
if (prettyPrinter != null && prettyPrinter.SupportsOnTheFlyFormatting) {
int endOffset = template.InsertPosition + template.Code.Length;
var oldVersion = data.Version;
- prettyPrinter.OnTheFlyFormat (editor, context, TextSegment.FromBounds (template.InsertPosition, editor.CaretOffset));
- if (editor.CaretOffset < endOffset)
- prettyPrinter.OnTheFlyFormat (editor, context, TextSegment.FromBounds (editor.CaretOffset, endOffset));
-
+
+ try {
+ prettyPrinter.OnTheFlyFormat (editor, context, TextSegment.FromBounds (template.InsertPosition, editor.CaretOffset));
+ endOffset = oldVersion.MoveOffsetTo (data.Version, endOffset);
+ if (editor.CaretOffset < endOffset)
+ prettyPrinter.OnTheFlyFormat (editor, context, TextSegment.FromBounds (editor.CaretOffset, endOffset));
+ } catch (Exception e) {
+ LoggingService.LogInternalError (e);
+ }
foreach (var textLink in template.TextLinks) {
for (int i = 0; i < textLink.Links.Count; i++) {
var segment = textLink.Links [i];
- var translatedOffset = oldVersion.MoveOffsetTo (data.Version, template.InsertPosition + segment.Offset) - template.InsertPosition;
+ var translatedOffset = segment.Offset;
+ foreach (var args in oldVersion.GetChangesTo (data.Version)) {
+ foreach (var change in args.TextChanges) {
+ if (change.Offset > template.InsertPosition + segment.Offset)
+ break;
+ if (change.Offset + change.RemovalLength < template.InsertPosition + segment.Offset) {
+ translatedOffset += change.InsertionLength - change.RemovalLength;
+ } else {
+ translatedOffset += GetDeltaInsideChange (change.InsertedText, change.RemovedText, template.InsertPosition + segment.Offset - change.Offset);
+ }
+ }
+ }
textLink.Links [i] = new TextSegment (translatedOffset, segment.Length);
}
}
@@ -532,6 +548,29 @@ namespace MonoDevelop.Ide.CodeTemplates
return template;
}
+ static int GetDeltaInsideChange (ITextSource insertedText, ITextSource removedText, int offset)
+ {
+ int i = 0;
+ int j = 0;
+ while (i < offset) {
+ if (insertedText [i] == removedText [j]) {
+ i++;
+ j++;
+ continue;
+ }
+ if (char.IsWhiteSpace (removedText [j])) {
+ j++;
+ continue;
+ }
+ if (char.IsWhiteSpace (insertedText [i])) {
+ i++;
+ continue;
+ }
+ break;
+ }
+ return i - j;
+ }
+
public TemplateResult InsertTemplateContents (Document document)
{
if (document == null)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
index f5314adce9..63d4f1395a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
@@ -33,11 +33,13 @@ using MonoDevelop.Ide.Editor;
namespace MonoDevelop.Ide.CodeTemplates
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public interface ICodeTemplateHandler
{
void InsertTemplate (CodeTemplate template, TextEditor editor, DocumentContext context);
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
class CodeTemplateCompletionData : CompletionData
{
readonly TextEditorExtension doc;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CategoryNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CategoryNode.cs
index e0a7dcf105..7646f5a322 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CategoryNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/CategoryNode.cs
@@ -25,7 +25,6 @@
//
//
-using System;
using Mono.Addins;
namespace MonoDevelop.Ide.Codons
@@ -33,10 +32,6 @@ namespace MonoDevelop.Ide.Codons
public class CategoryNode: ExtensionNode
{
[NodeAttribute("_name", "Category name", Localizable=true, Required=true)]
- string name;
-
- public string Name {
- get { return name; }
- }
+ public string Name { get; private set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs
index ae5d1573c2..54f519bda2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateConditionTypeCodon.cs
@@ -1,36 +1,28 @@
-//
-// FileTemplateConditionTypeCodon.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.Diagnostics;
-using System.ComponentModel;
-
+//
+// FileTemplateConditionTypeCodon.cs
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.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.Ide.Codons
@@ -38,11 +30,7 @@ namespace MonoDevelop.Ide.Codons
[ExtensionNode (Description="A condition that limits when a file template is shown. The specified class must be a subclass of MonoDevelop.Ide.Templates.FileTemplateCondition")]
internal class FileTemplateConditionTypeCodon : TypeExtensionNode
{
- [NodeAttribute("name", true, "Name to use to reference this condition type in a file template.")]
- string name;
-
- public string ElementName {
- get { return name; }
- }
+ [NodeAttribute ("name", true, "Name to use to reference this condition type in a file template.")]
+ public string ElementName { get; private set; }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs
index c5c34a2e5b..7e31415a4d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/FileTemplateTypeCodon.cs
@@ -26,12 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-
-using System;
-using System.Collections;
-using System.Diagnostics;
-using System.ComponentModel;
-
using Mono.Addins;
namespace MonoDevelop.Ide.Codons
@@ -39,11 +33,7 @@ namespace MonoDevelop.Ide.Codons
[ExtensionNode (Description="A file template type. The specified class must be a subclass of MonoDevelop.Ide.Templates.FileDescriptionTemplate")]
internal class FileTemplateTypeCodon : TypeExtensionNode
{
- [NodeAttribute("name", true, "Name to use to reference this template type in a file template.")]
- string name;
-
- public string ElementName {
- get { return name; }
- }
+ [NodeAttribute ("name", true, "Name to use to reference this template type in a file template.")]
+ public string ElementName { get; private set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ImageCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ImageCodon.cs
index 9b95a2bc60..3722f3dead 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ImageCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ImageCodon.cs
@@ -1,4 +1,4 @@
-//
+//
// ImageCodon.cs
//
// Author:
@@ -32,11 +32,7 @@ namespace MonoDevelop.Ide.Codons
internal class ImageCodon : ExtensionNode
{
[NodeAttribute ("resource", "Name of the resource where the image is stored.")]
- string resource;
-
- public string Resource {
- get { return resource; }
- }
+ public string Resource { get; private set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ItemTemplateExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ItemTemplateExtensionNode.cs
index 7c27b795bd..ace4ca75b7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ItemTemplateExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ItemTemplateExtensionNode.cs
@@ -32,6 +32,9 @@ namespace MonoDevelop.Ide.Codons
[ExtensionNode (Description = "A file template")]
class ItemTemplateExtensionNode : ExtensionNode
{
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute ("path", "A .nupkg file or a folder.")]
string path;
@@ -51,37 +54,17 @@ namespace MonoDevelop.Ide.Codons
[NodeAttribute ("templateId", "Overrides the template id from the extension node id. Allows the same template to be used with different parameters.")]
string templateId;
- public string TemplateId {
- get {
- return templateId ?? Id;
- }
- }
+ #pragma warning restore 649
[NodeAttribute ("_overrideName", "Override name used in template.json file.", Localizable = true)]
- string overrideName;
-
- public string OverrideName {
- get {
- return overrideName;
- }
- }
+ public string OverrideName { get; private set; }
[NodeAttribute ("defaultParameters", "Default parameters for template.")]
- string defaultParameters;
-
- public string DefaultParameters {
- get {
- return defaultParameters;
- }
- }
+ public string DefaultParameters { get; private set; }
[NodeAttribute ("supportedParameters", "Parameters supported by the template.")]
- string supportedParameters;
+ public string SupportedParameters { get; private set; }
- public string SupportedParameters {
- get {
- return supportedParameters;
- }
- }
+ public string TemplateId => templateId ?? Id;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
index 66a3d52aef..27a2ee4598 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
@@ -1,58 +1,53 @@
-//
-// PadCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-
-
+//
+// PadCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Core;
-using Mono.Addins;
-using MonoDevelop.Ide.Gui;
-using MonoDevelop.Components.Docking;
using System.Collections.Generic;
-using System.Xml;
using System.IO;
+using System.Xml;
+using Mono.Addins;
+using MonoDevelop.Components.Docking;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Ide.Codons
{
[ExtensionNode ("Pad", "Registers a pad to be shown in the workbench.")]
public class PadCodon : ExtensionNode
{
- PadContent content;
- string id;
+ [NodeAttribute ("_label", "Display name of the pad.", Localizable = true)]
+ public string Label { get; private set; }
- [NodeAttribute("_label", "Display name of the pad.", Localizable=true)]
- string label = null;
-
- [NodeAttribute("class", "Class name.")]
- string className = null;
+ [NodeAttribute ("class", "Class name.")]
+ public string ClassName { get; private set; }
+
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
[NodeAttribute("icon", "Icon of the pad. It can be a stock icon or a resource icon (use 'res:' as prefix in the last case).")]
string icon = null;
@@ -74,54 +69,37 @@ namespace MonoDevelop.Ide.Codons
DockItemStatus defaultStatus = DockItemStatus.Dockable;
[NodeAttribute ("defaultLayout", "Name of the layouts (comma separated list) on which this pad should be visible by default")]
- string[] defaultLayouts;
-
+ string[] defaultLayouts;
+
+ #pragma warning restore 649
+
bool initializeCalled;
-
- public PadContent PadContent {
- get {
- return content;
- }
- }
-
+ string id;
+
+ public PadContent PadContent { get; private set; }
+
public PadContent InitializePadContent (IPadWindow window)
{
- if (content == null) {
- content = CreatePad ();
+ if (PadContent == null) {
+ PadContent = CreatePad ();
}
if (!initializeCalled) {
- content.Init (window);
+ PadContent.Init (window);
ApplyPreferences ();
initializeCalled = true;
}
- return content;
+ return PadContent;
}
public string PadId {
- get { return id != null ? id : base.Id; }
- set { id = value; }
- }
-
- public string Label {
- get { return label; }
- }
-
- public IconId Icon {
- get { return !string.IsNullOrEmpty (icon) ? icon : "md-generic-pad"; }
- }
-
- public string Group {
- get { return !string.IsNullOrEmpty (group) ? group : "YOther"; }
- }
-
- public string ClassName {
- get { return className; }
- }
-
- public IList<string> DefaultLayouts {
- get { return this.defaultLayouts; }
- }
-
+ get => id ?? Id;
+ set => id = value;
+ }
+
+ public IconId Icon => !string.IsNullOrEmpty (icon) ? icon : "md-generic-pad";
+ public string Group => !string.IsNullOrEmpty (group) ? group : "YOther";
+ public IList<string> DefaultLayouts => defaultLayouts;
+
/// <summary>
/// Returns the default placement of the pad: left, right, top, bottom.
/// Relative positions can be used, for example: "ProjectPad/left"
@@ -130,20 +108,12 @@ namespace MonoDevelop.Ide.Codons
/// pad can be placed in the first position, the next one will be
/// tried. For example "ProjectPad/left; bottom".
/// </summary>
- public string DefaultPlacement {
- get { return defaultPlacement; }
- }
-
- public DockItemStatus DefaultStatus {
- get { return defaultStatus; }
- }
-
- public bool Initialized {
- get {
- return content != null;
- }
- }
-
+ public string DefaultPlacement => defaultPlacement;
+
+ public DockItemStatus DefaultStatus => defaultStatus;
+
+ public bool Initialized => PadContent != null;
+
public PadCodon ()
{
}
@@ -156,8 +126,8 @@ namespace MonoDevelop.Ide.Codons
public PadCodon (PadContent content, string id, string label, string defaultPlacement, DockItemStatus defaultStatus, string icon)
{
this.id = id;
- this.content = content;
- this.label = label;
+ this.PadContent = content;
+ this.Label = label;
this.defaultPlacement = defaultPlacement;
this.icon = icon;
this.defaultStatus = defaultStatus;
@@ -166,7 +136,7 @@ namespace MonoDevelop.Ide.Codons
protected virtual PadContent CreatePad ()
{
Counters.PadsLoaded++;
- return (PadContent) Addin.CreateInstance (className, true);
+ return (PadContent) Addin.CreateInstance (ClassName, true);
}
PadUserPrefs preferences = null;
@@ -179,7 +149,7 @@ namespace MonoDevelop.Ide.Codons
void ApplyPreferences ()
{
- var memento = content as IMementoCapable;
+ var memento = PadContent as IMementoCapable;
if (memento == null || preferences == null)
return;
try {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs
index 7d10f7c920..3de7a92e91 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadOptionCodon.cs
@@ -1,39 +1,31 @@
-//
-// PadOptionCodon.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Ide.Gui.Pads;
-using MonoDevelop.Core;
+//
+// PadOptionCodon.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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;
using MonoDevelop.Ide.Gui.Components;
@@ -41,23 +33,22 @@ namespace MonoDevelop.Ide.Codons
{
[ExtensionNode (Description="A display option of a solution pad.")]
internal class PadOptionCodon : ExtensionNode
- {
- [NodeAttribute("_label", true, "Display name of the option", Localizable=true)]
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
+ [NodeAttribute ("_label", true, "Display name of the option", Localizable=true)]
string label = null;
[NodeAttribute("defaultValue", "Default value of the option")]
- bool defaultValue;
-
- TreePadOption option;
-
- public TreePadOption Option {
- get { return option; }
- }
-
+ bool defaultValue;
+
+ public TreePadOption Option { get; private set; }
+
protected override void Read (NodeElement elem)
{
base.Read (elem);
- option = new TreePadOption (Id, label, defaultValue);
+ Option = new TreePadOption (Id, label, defaultValue);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs
index 80405d26c6..82760a1897 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/ProjectTemplateCodon.cs
@@ -31,20 +31,24 @@
using System;
using System.IO;
using System.Xml;
-
using Mono.Addins;
namespace MonoDevelop.Ide.Codons
{
[ExtensionNode (Description="A project template.")]
internal class ProjectTemplateCodon : ExtensionNode
- {
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute("resource", "Name of the resource where the template is stored.")]
string resource;
[NodeAttribute("file", "Name of the file where the template is stored.")]
- string file;
-
+ string file;
+
+ #pragma warning restore 649
+
public XmlDocument GetTemplate ()
{
Stream stream;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs
index 9d7e8801d7..1172ed5ca5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TaskListViewCodon.cs
@@ -1,71 +1,52 @@
-//
-// TaskListViewCodon.cs
-//
-// Author:
-// David Makovský <yakeen@sannyas-on.net>
-//
-// Copyright (C) 2006 David Makovský
-//
-// 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 System;
-using System.Collections;
-using System.ComponentModel;
-using MonoDevelop.Core;
+//
+// TaskListViewCodon.cs
+//
+// Author:
+// David Makovský <yakeen@sannyas-on.net>
+//
+// Copyright (C) 2006 David Makovský
+//
+// 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;
-using MonoDevelop.Ide.Gui;
using MonoDevelop.Ide.Tasks;
namespace MonoDevelop.Ide.Codons
{
- [ExtensionNode (Description="Registers a task list view to be shown in the task list pad.")]
+ [ExtensionNode (Description = "Registers a task list view to be shown in the task list pad.")]
internal class TaskListViewCodon : ExtensionNode
{
- ITaskListView view;
-
- [NodeAttribute("_label", "Display name of the view.", Localizable=true)]
- string label = null;
-
- [NodeAttribute("class", "Class of the view.")]
- string className;
-
- public ITaskListView View {
- get {
- if (view == null)
- view = CreateView ();
- return view;
- }
- }
-
- public string Class {
- get { return className; }
- }
-
- public string Label {
- get { return label; }
- }
-
+ [NodeAttribute ("_label", "Display name of the view.", Localizable = true)]
+ public string Label { get; private set; }
+
+ [NodeAttribute ("class", "Class of the view.")]
+ public string Class { get; private set; }
+
+ ITaskListView view;
+
+ public ITaskListView View => view ?? (view = CreateView ());
+
protected virtual ITaskListView CreateView ()
{
- return (ITaskListView) Addin.CreateInstance (className, true);
+ return (ITaskListView)Addin.CreateInstance (Class, true);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateCategoryCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateCategoryCodon.cs
index f3c2c9e0bb..71714951cd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateCategoryCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateCategoryCodon.cs
@@ -1,4 +1,4 @@
-//
+//
// TemplateCategoryCodon.cs
//
// Author:
@@ -24,17 +24,18 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
+using System.Linq;
using Mono.Addins;
using MonoDevelop.Ide.Templates;
-using MonoDevelop.Core;
-using System;
-using System.Linq;
namespace MonoDevelop.Ide.Codons
{
[ExtensionNode (Description="A template category.")]
- internal class TemplateCategoryCodon : ExtensionNode
+ class TemplateCategoryCodon : ExtensionNode
{
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
// OBSOLETE: This member is ignored when generating translations.
[NodeAttribute ("name", "Name of the category.", Localizable=true)]
string name;
@@ -51,6 +52,8 @@ namespace MonoDevelop.Ide.Codons
[NodeAttribute ("mappedCategories", "Legacy categories that will be used for mapping templates.")]
string mappedCategories;
+ #pragma warning restore 649
+
public TemplateCategory ToTemplateCategory ()
{
var category = new TemplateCategory (Id, _name ?? name, icon);
@@ -63,7 +66,7 @@ namespace MonoDevelop.Ide.Codons
public TemplateCategory ToTopLevelTemplateCategory ()
{
- TemplateCategory category = ToTemplateCategory ();
+ var category = ToTemplateCategory ();
category.IsTopLevel = true;
return category;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateExtensionNode.cs
index a00066f3a9..fc18240a8c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/TemplateExtensionNode.cs
@@ -23,143 +23,77 @@
// 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 System;
using Mono.Addins;
namespace MonoDevelop.Ide.Codons
{
[ExtensionNode (Description = "Template informations.")]
- internal class TemplateExtensionNode : ExtensionNode
- {
- [NodeAttribute ("category", "Category used to place template into correct category inside new project dialog.")]
- string category;
-
- public string Category {
- get {
- return category;
- }
- }
+ class TemplateExtensionNode : ExtensionNode
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
[NodeAttribute ("path", "Either .nupkg file or folder.")]
string path;
- public string ScanPath {
- get {
- // If the path starts with '${' then the path contains a placeholder
- // that the StringParserService will replace. The path is returned
- // without calling Addin.GetFilePath to prevent the addin directory
- // being prefixed to the path.
- if (path != null && path.StartsWith ("${", StringComparison.Ordinal)) {
- return path;
- }
- return Addin.GetFilePath (path);
- }
- }
-
-
[NodeAttribute ("icon", "Icon to display in new project dialog.")]
string icon;
- public string Icon {
- get {
- return ImageService.GetStockId (Addin, icon, Gtk.IconSize.Dnd);
- }
- }
+ [NodeAttribute ("templateId", "Overrides the template id from the extension node id. Allows the same template to be used with different parameters.")]
+ string templateId;
+ #pragma warning restore 649
- [NodeAttribute ("imageId", "ImageId of image showed in new project dialog description of project.")]
- string imageId;
+ [NodeAttribute ("category", "Category used to place template into correct category inside new project dialog.")]
+ public string Category { get; private set; }
- public string ImageId {
- get {
- return imageId;
- }
- }
+ [NodeAttribute ("imageId", "ImageId of image showed in new project dialog description of project.")]
+ public string ImageId { get; private set; }
[NodeAttribute ("_overrideName", "If template.json is outside AddIn creator control use this to change name.", Localizable = true)]
- string overrideName;
- public string OverrideName {
- get {
- return overrideName;
- }
- }
-
-
+ public string OverrideName { get; private set; }
+
[NodeAttribute ("_overrideDescription", "If template.json is outside AddIn creator control use this to change description.", Localizable = true)]
- string overrideDescription;
- public string OverrideDescription {
- get {
- return overrideDescription;
- }
- }
+ public string OverrideDescription { get; private set; }
[NodeAttribute ("overrideLanguage", "If template.json is outside AddIn creator control use this to change language", Localizable = false)]
- string overrideLanguage;
- public string OverrideLanguage {
- get => overrideLanguage;
- }
+ public string OverrideLanguage { get; private set; }
[NodeAttribute ("defaultParameters", "Default parameters for project template.")]
- string defaultParameters;
-
- public string DefaultParameters {
- get {
- return defaultParameters;
- }
- }
+ public string DefaultParameters { get; private set; }
[NodeAttribute ("supportedParameters", "Parameters supported by the project template.")]
- string supportedParameters;
-
- public string SupportedParameters {
- get {
- return supportedParameters;
- }
- }
-
- [NodeAttribute ("templateId", "Overrides the template id from the extension node id. Allows the same template to be used with different parameters.")]
- string templateId;
-
- public string TemplateId {
- get {
- return templateId ?? Id;
- }
- }
+ public string SupportedParameters { get; private set; }
[NodeAttribute ("groupId", "Overrides the group id defined in the template. Allows the same template to be grouped differently.")]
- string groupId;
-
- public string GroupId {
- get {
- return groupId;
- }
- }
+ public string GroupId { get; private set; }
[NodeAttribute ("wizard", "Wizard identifier for this template.")]
- string wizard;
-
- public string Wizard {
- get {
- return wizard;
- }
- }
+ public string Wizard { get; private set; }
[NodeAttribute ("condition", "Allows a template to be conditionally selected.")]
- string condition;
-
- public string Condition {
- get {
- return condition;
- }
- }
+ public string Condition { get; private set; }
[NodeAttribute ("formatExclude", "Project files that should not be formatted. For example: readme.txt|*.xml")]
- string fileFormatExclude;
+ public string FileFormatExclude { get; private set; }
+
- public string FileFormatExclude {
+ public string ScanPath {
get {
- return fileFormatExclude;
+ // If the path starts with '${' then the path contains a placeholder
+ // that the StringParserService will replace. The path is returned
+ // without calling Addin.GetFilePath to prevent the addin directory
+ // being prefixed to the path.
+ if (path != null && path.StartsWith ("${", StringComparison.Ordinal)) {
+ return path;
+ }
+ return Addin.GetFilePath (path);
}
}
+
+ public string Icon => ImageService.GetStockId (Addin, icon, Gtk.IconSize.Dnd);
+ public string TemplateId => templateId ?? Id;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs
index 681c3c749f..06569171bd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/CustomStringTagProvider.cs
@@ -1,41 +1,41 @@
-// CustomStringTagProvider.cs
-//
-// Author:
-// Viktoria Dudka (viktoriad@remobjects.com)
-//
-// Copyright (c) 2009 RemObjects Software
-//
-// 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.
-//
-//
-
-
+// CustomStringTagProvider.cs
+//
+// Author:
+// Viktoria Dudka (viktoriad@remobjects.com)
+//
+// Copyright (c) 2009 RemObjects Software
+//
+// 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 System;
-using MonoDevelop.Core;
-using MonoDevelop.Ide.Gui;
-using System.IO;
using System.Collections.Generic;
+using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.Core;
using MonoDevelop.Core.StringParsing;
-
+using MonoDevelop.Ide.Gui;
+
namespace MonoDevelop.Ide.Commands
-{
- // The path name should not be required here. This is a workaround to a Mono.Addins bug (fixed in the last version)
+{
+ // The path name should not be required here. This is a workaround to a Mono.Addins bug (fixed in the last version)
[Mono.Addins.Extension ("/MonoDevelop.Core/TypeExtensions/MonoDevelop.Core.StringParsing.IStringTagProvider")]
class DefaultStringTagProvider : StringTagProvider<Workbench>
{
@@ -85,30 +85,43 @@ namespace MonoDevelop.Ide.Commands
return !wb.ActiveDocument.IsFile ? String.Empty : wb.ActiveDocument.FileName.Extension;
return null;
- case "CURLINE":
- if (wb.ActiveDocument != null && wb.ActiveDocument.Editor != null)
- return wb.ActiveDocument.Editor.CaretLocation.Line;
+ case "CURLINE": {
+ if (wb.ActiveDocument?.GetContent<ITextView> () is ITextView view) {
+ var pos = view.Caret.Position.BufferPosition;
+ return pos.Snapshot.GetLineNumberFromPosition (pos.Position) + 1;
+ }
return null;
+ }
- case "CURCOLUMN":
- if (wb.ActiveDocument != null && wb.ActiveDocument.Editor != null)
- return wb.ActiveDocument.Editor.CaretLocation.Column;
- return null;
+ case "CURCOLUMN": {
+ if (wb.ActiveDocument?.GetContent<ITextView> () is ITextView view) {
+ var pos = view.Caret.Position.BufferPosition;
+ var line = pos.Snapshot.GetLineFromPosition (pos.Position);
+ return pos.Position - line.Start.Position + 1;
+ }
+ return null;
+ }
- case "CUROFFSET":
- if (wb.ActiveDocument != null && wb.ActiveDocument.Editor != null)
- return wb.ActiveDocument.Editor.CaretOffset;
- return null;
+ case "CUROFFSET": {
+ if (wb.ActiveDocument?.GetContent<ITextView> () is ITextView view) {
+ return view.Caret.Position.BufferPosition.Position;
+ }
+ return null;
+ }
- case "CURTEXT":
- if (wb.ActiveDocument != null && wb.ActiveDocument.Editor != null)
- return wb.ActiveDocument.Editor.SelectedText;
+ case "CURTEXT": {
+ if (wb.ActiveDocument?.GetContent<ITextView> () is ITextView view) {
+ return view.Selection.IsEmpty? "" : view.Selection.SelectedSpans[0].GetText ();
+ }
return null;
+ }
- case "EDITORTEXT":
- if (wb.ActiveDocument != null && wb.ActiveDocument.Editor != null)
- return wb.ActiveDocument.Editor.Text;
+ case "EDITORTEXT": {
+ if (wb.ActiveDocument?.GetContent<ITextView> () is ITextView view) {
+ return view.TextBuffer.CurrentSnapshot.GetText ();
+ }
return null;
+ }
case "STARTUPPATH":
return AppDomain.CurrentDomain.BaseDirectory;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
index a3ad7cc5d6..cc7c2f51c9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/EditCommands.cs
@@ -33,7 +33,8 @@ using Mono.Addins;
using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui;
using MonoDevelop.Projects;
-
+using Microsoft.VisualStudio.Text.Editor;
+
namespace MonoDevelop.Ide.Commands
{
public enum EditCommands
@@ -357,13 +358,13 @@ namespace MonoDevelop.Ide.Commands
{
Document doc = IdeApp.Workbench.ActiveDocument;
string header = MonoDevelop.Ide.StandardHeader.StandardHeaderService.GetHeader (doc.Owner as SolutionFolderItem, doc.Name, false);
- doc.Editor.InsertText (0, header + "\n");
+ doc.GetContent<ITextView> ().TextBuffer.Insert (0, header + "\n");
}
protected override void Update (CommandInfo info)
{
Document doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null && doc.Editor != null) {
+ if (doc?.GetContent<ITextView> () is ITextView) {
info.Enabled = doc.CommentTags != null;
} else
info.Enabled = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs
index 4cdba68607..9a215e95b8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/HelpCommands.cs
@@ -65,6 +65,12 @@ namespace MonoDevelop.Ide.Commands
// MonoDevelop.Ide.Commands.HelpCommands.OpenLogDirectory
public class OpenLogDirectoryHandler : CommandHandler
{
+ protected override void Update (CommandInfo info)
+ {
+ info.DisableOnShellLock = false;
+ info.Enabled = true;
+ }
+
protected override void Run ()
{
try {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs
index d54a310855..6574f834e0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/ToolsCommands.cs
@@ -104,7 +104,7 @@ namespace MonoDevelop.Ide.Commands
protected override void Run ()
{
- IdeApp.Workbench.ShowGlobalPreferencesDialog (IdeApp.Workbench.RootWindow, "ExternalTools");
+ IdeApp.Workbench.ShowGlobalPreferencesDialog (DesktopService.GetFocusedTopLevelWindow (), "ExternalTools");
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.cs
index 299fbac057..2ad48307f6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/CompositionManager.cs
@@ -1,4 +1,4 @@
-// CompositionManager.cs
+// CompositionManager.cs
//
// Author:
// Kirill Osenkov <https://github.com/KirillOsenkov>
@@ -99,7 +99,6 @@ namespace MonoDevelop.Ide.Composition
public IExportProviderFactory ExportProviderFactory { get; private set; }
public ExportProvider ExportProvider { get; private set; }
public HostServices HostServices { get; private set; }
- public System.ComponentModel.Composition.Hosting.ExportProvider ExportProviderV1 { get; private set; }
internal CompositionManager ()
{
@@ -144,8 +143,7 @@ namespace MonoDevelop.Ide.Composition
ExportProviderFactory = RuntimeComposition.CreateExportProviderFactory ();
ExportProvider = ExportProviderFactory.CreateExportProvider ();
- HostServices = MefV1HostServices.Create (ExportProvider.AsExportProvider ());
- ExportProviderV1 = NetFxAdapters.AsExportProvider (ExportProvider);
+ HostServices = Microsoft.VisualStudio.LanguageServices.VisualStudioMefHostServices.Create (ExportProvider);
timings ["CreateServices"] = stepTimer.ElapsedMilliseconds;
metadata.Duration = fullTimer.ElapsedMilliseconds;
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 668974ec7a..e5df97fb31 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorExperimentationServiceInternal.cs
@@ -1,11 +1,15 @@
using System.ComponentModel.Composition;
+
using Microsoft.VisualStudio.Text.Utilities;
+using MonoDevelop.Ide.Editor;
+
namespace MonoDevelop.Ide.Composition
{
[Export (typeof (IExperimentationServiceInternal))]
internal class EditorExperimentationServiceInternal : IExperimentationServiceInternal
{
- public bool IsCachedFlightEnabled (string flightName) => false;
+ public bool IsCachedFlightEnabled (string flightName)
+ => flightName == "CompletionAPI" && DefaultSourceEditorOptions.Instance.EnableNewEditor;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorWaitIndicator.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorWaitIndicator.cs
index 355fbe2ccb..2074c0f3da 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorWaitIndicator.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/EditorWaitIndicator.cs
@@ -1,10 +1,6 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel.Composition;
-using System.Linq;
-using System.Text;
using System.Threading;
-using System.Threading.Tasks;
using Microsoft.VisualStudio.Language.Intellisense.Utilities;
namespace MonoDevelop.Ide.Composition
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ExtensionSelector.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ExtensionSelector.cs
new file mode 100644
index 0000000000..7d7915de40
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ExtensionSelector.cs
@@ -0,0 +1,71 @@
+//
+// 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.Utilities
+{
+ using System;
+ using System.Collections.Generic;
+ using Microsoft.VisualStudio.Utilities;
+
+ /// <summary>
+ /// Helper class to perform ContentType best-match against a set of extensions. This could
+ /// become a public service.
+ /// </summary>
+ public static class ExtensionSelector
+ {
+ /// <summary>
+ /// Given a list of extensions that provide content types, filter the list and return that
+ /// subset which matches the given content type
+ /// </summary>
+ public static List<Lazy<TProvider, TMetadataView>> SelectMatchingExtensions<TProvider, TMetadataView>
+ (IEnumerable<Lazy<TProvider, TMetadataView>> providerHandles,
+ IContentType dataContentType)
+ where TMetadataView : IContentTypeMetadata // content type is required
+ {
+ var result = new List<Lazy<TProvider, TMetadataView>>();
+ foreach (var providerHandle in providerHandles)
+ {
+ if (ContentTypeMatch(dataContentType, providerHandle.Metadata.ContentTypes))
+ {
+ result.Add(providerHandle);
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Test whether an extension matches a content type.
+ /// </summary>
+ /// <param name="dataContentType">Content type (typically of a text buffer) against which to match an extension.</param>
+ /// <param name="extensionContentTypes">Content types from extension metadata.</param>
+ public static bool ContentTypeMatch(IContentType dataContentType, IEnumerable<string> extensionContentTypes)
+ {
+ foreach (string contentType in extensionContentTypes)
+ {
+ if (dataContentType.IsOfType(contentType))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /// <summary>
+ /// Test whether an extension matches one of a set of content types.
+ /// </summary>
+ /// <param name="dataContentTypes">Content types (typically of text buffers in a buffer graph) against which to match an extension.</param>
+ /// <param name="extensionContentTypes">Content types from extension metadata.</param>
+ public static bool ContentTypeMatch(IEnumerable<IContentType> dataContentTypes, IEnumerable<string> extensionContentTypes)
+ {
+ foreach (IContentType bufferContentType in dataContentTypes)
+ {
+ if (ContentTypeMatch(bufferContentType, extensionContentTypes))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/InlineRenameService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/InlineRenameService.cs
deleted file mode 100644
index a13d665518..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/InlineRenameService.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Editor;
-using Microsoft.CodeAnalysis.Text;
-
-namespace MonoDevelop.Ide.Composition
-{
- [Export(typeof(IInlineRenameService))]
- internal class InlineRenameService : IInlineRenameService
- {
- public IInlineRenameSession ActiveSession => null;
-
- public InlineRenameSessionInfo StartInlineSession (Document document, TextSpan triggerSpan, CancellationToken cancellationToken = default (CancellationToken))
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ObscuringTipManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ObscuringTipManager.cs
new file mode 100644
index 0000000000..988612b8c4
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/ObscuringTipManager.cs
@@ -0,0 +1,20 @@
+using System;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Text.Editor;
+
+namespace MonoDevelop.Ide.Composition
+{
+ //[Export (typeof (IObscuringTipManager))]
+ class ObscuringTipManager : IObscuringTipManager
+ {
+ public void PushTip (ITextView view, IObscuringTip tip)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void RemoveTip (ITextView view, IObscuringTip tip)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PeekResultFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PeekResultFactory.cs
new file mode 100644
index 0000000000..bfe654f434
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PeekResultFactory.cs
@@ -0,0 +1,52 @@
+using System;
+using System.ComponentModel.Composition;
+using Microsoft.VisualStudio.Imaging.Interop;
+using Microsoft.VisualStudio.Language.Intellisense;
+using Microsoft.VisualStudio.Text;
+
+namespace MonoDevelop.Ide.Composition
+{
+ [Export (typeof (IPeekResultFactory))]
+ internal class PeekResultFactory : IPeekResultFactory
+ {
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo displayInfo, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idLine, int idIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo displayInfo, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idLine, int idIndex, bool isReadOnly)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo2 displayInfo, ImageMoniker image, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idStartLine, int idStartIndex, int idEndLine, int idEndIndex)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo2 displayInfo, ImageMoniker image, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idStartLine, int idStartIndex, int idEndLine, int idEndIndex, bool isReadOnly)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo2 displayInfo, ImageMoniker image, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idStartLine, int idStartIndex, int idEndLine, int idEndIndex, bool isReadOnly, Guid editorDestination)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo2 displayInfo, ImageMoniker image, string filePath, int startLine, int startIndex, int endLine, int endIndex, int idStartLine, int idStartIndex, int idEndLine, int idEndIndex, bool isReadOnly, Guid editorDestination, Action<IPeekResult, object, object> postNavigationCallback)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IDocumentPeekResult Create (IPeekResultDisplayInfo displayInfo, string filePath, Span eoiSpan, int idPosition, bool isReadOnly)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public IExternallyBrowsablePeekResult Create (IPeekResultDisplayInfo displayInfo, Action browseAction)
+ {
+ throw new NotImplementedException ();
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformCatalog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformCatalog.cs
index d26e9d4644..7489fc11b1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformCatalog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformCatalog.cs
@@ -16,9 +16,10 @@ using Microsoft.VisualStudio.Utilities;
using MonoDevelop.Ide.Composition;
namespace Microsoft.VisualStudio.Platform
-{
- [Export]
- public class PlatformCatalog
+{
+ [Export]
+ // TODO: editor obsolete
+ internal class PlatformCatalog
{
static PlatformCatalog instance;
public static PlatformCatalog Instance {
@@ -40,12 +41,6 @@ namespace Microsoft.VisualStudio.Platform
internal ITextDocumentFactoryService TextDocumentFactoryService { get; private set; }
[Import]
- internal ITextEditorFactoryService TextEditorFactoryService { get; private set; }
-
- [Import]
- internal IMimeToContentTypeRegistryService MimeToContentTypeRegistryService { get; private set; }
-
- [Import]
internal IContentTypeRegistryService ContentTypeRegistryService { get; private set; }
[Import]
@@ -58,82 +53,9 @@ namespace Microsoft.VisualStudio.Platform
internal IViewClassifierAggregatorService ViewClassifierAggregatorService { get; private set; }
}
- public interface IMimeToContentTypeRegistryService
- {
- string GetMimeType(IContentType type);
- IContentType GetContentType(string type);
-
- void LinkTypes(string mimeType, IContentType contentType);
- }
-
- [Export(typeof(IMimeToContentTypeRegistryService))]
- public class MimeToContentTypeRegistryService : IMimeToContentTypeRegistryService, IPartImportsSatisfiedNotification
- {
- [Import]
- IContentTypeRegistryService ContentTypeRegistryService { get; set; }
-
- [Export]
- [Name ("csharp")]
- [BaseDefinition ("code")]
- public ContentTypeDefinition codeContentType;
-
- public string GetMimeType(IContentType type)
- {
- string mimeType;
- if (this.maps.Item2.TryGetValue(type, out mimeType))
- {
- return mimeType;
- }
-
- return (ContentTypeRegistryService as IContentTypeRegistryService2).GetMimeType (type);
- }
-
- public IContentType GetContentType(string type)
- {
- IContentType contentType;
- if (this.maps.Item1.TryGetValue(type, out contentType))
- {
- return contentType;
- }
-
- return (ContentTypeRegistryService as IContentTypeRegistryService2).GetContentTypeForMimeType (type);
- }
-
- public void LinkTypes(string mimeType, IContentType contentType)
- {
- var oldMap = Volatile.Read(ref this.maps);
- while (true)
- {
- if (oldMap.Item1.ContainsKey(mimeType) || oldMap.Item2.ContainsKey(contentType))
- break;
-
- var newMap = Tuple.Create(oldMap.Item1.Add(mimeType, contentType), oldMap.Item2.Add(contentType, mimeType));
- var result = Interlocked.CompareExchange(ref this.maps, newMap, oldMap);
- if (result == oldMap)
- {
- break;
- }
-
- oldMap = result;
- }
- }
-
- void LinkTypes (string mimeType, string contentType)
- {
- LinkTypes (mimeType, ContentTypeRegistryService.GetContentType (contentType));
- }
-
- void IPartImportsSatisfiedNotification.OnImportsSatisfied ()
- {
- LinkTypes ("text/plain", "text");
- LinkTypes ("text/x-csharp", "csharp");
- }
-
- Tuple<ImmutableDictionary<string, IContentType>, ImmutableDictionary<IContentType, string>> maps = Tuple.Create(ImmutableDictionary<string, IContentType>.Empty, ImmutableDictionary<IContentType, string>.Empty);
- }
-
// Fold back into Text.Def.TextData.TextSnapshotToTextReader
- public sealed class NewTextSnapshotToTextReader : TextReader
+ // TODO: editor obsolete
+ internal sealed class NewTextSnapshotToTextReader : TextReader
{
#region TextReader methods
/// <summary>
@@ -315,69 +237,4 @@ namespace Microsoft.VisualStudio.Platform
int _end;
}
-
-#if false
- [Export(typeof(ITaggerProvider))]
- [ContentType("text")]
- [TagType(typeof(IClassificationTag))]
- public class TestClassifierProvider : ITaggerProvider
- {
- [Import]
- internal IClassificationTypeRegistryService ClassificationTypeRegistryService { get; private set; }
-
- [Export]
- [Name("keyword")]
- public ClassificationTypeDefinition textClassificationType;
-
- public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
- {
- return buffer.Properties.GetOrCreateSingletonProperty(typeof(TestClassifier), () => new TestClassifier(this)) as ITagger<T>;
- }
- }
-
- public class TestClassifier : ITagger<IClassificationTag>
- {
- private ClassificationTag _keyword { get; }
-
- public TestClassifier(TestClassifierProvider provider)
- {
- _keyword = new ClassificationTag(provider.ClassificationTypeRegistryService.GetClassificationType("keyword"));
- }
-
- public IEnumerable<ITagSpan<IClassificationTag>> GetTags(NormalizedSnapshotSpanCollection spans)
- {
- foreach (var span in spans)
- {
- int start = -1;
- for (int i = span.Start; (i < span.End); ++i)
- {
- var c = span.Snapshot[i];
- if ((c == 'a') || (c == 'A'))
- {
- if (start == -1)
- {
- start = i;
- }
- }
- else if (start != -1)
- {
- yield return new TagSpan<ClassificationTag>(
- new SnapshotSpan(span.Snapshot, start, i - start),
- _keyword);
- start = -1;
- }
- }
-
- if (start != -1)
- {
- yield return new TagSpan<ClassificationTag>(
- new SnapshotSpan(span.Snapshot, start, span.End - start),
- _keyword);
- }
- }
- }
-
- public event EventHandler<SnapshotSpanEventArgs> TagsChanged;
- }
-#endif
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformExtensions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformExtensions.cs
index e9676cd7d7..689c98b532 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformExtensions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PlatformExtensions.cs
@@ -9,7 +9,8 @@ using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.VisualStudio.Platform
{
- public static class PlatformExtensions
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
+ public static class PlatformExtensions
{
public static ITextBuffer GetPlatformTextBuffer(this MonoDevelop.Ide.Editor.TextEditor textEditor)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PreviewFactoryService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PreviewFactoryService.cs
index 42a7cdf4dd..86e7b1154a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PreviewFactoryService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/PreviewFactoryService.cs
@@ -10,7 +10,9 @@ using Microsoft.CodeAnalysis.Editor;
namespace MonoDevelop.Ide.Composition
{
+#if MAC
[Export(typeof(IPreviewFactoryService))]
+#endif
class PreviewFactoryService : IPreviewFactoryService
{
public Task<object> CreateAddedDocumentPreviewViewAsync (Document document, CancellationToken cancellationToken)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/StreamingFindUsagesPresenter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/StreamingFindUsagesPresenter.cs
deleted file mode 100644
index bc0c1a1dfc..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/StreamingFindUsagesPresenter.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.Composition;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Editor;
-using Microsoft.CodeAnalysis.Editor.Host;
-using Microsoft.CodeAnalysis.FindUsages;
-using Microsoft.CodeAnalysis.Text;
-
-namespace MonoDevelop.Ide.Composition
-{
- [Export (typeof (IStreamingFindUsagesPresenter))]
- internal class StreamingFindUsagesPresenter : IStreamingFindUsagesPresenter
- {
- public void ClearAll ()
- {
- throw new NotImplementedException ();
- }
-
- public FindUsagesContext StartSearch (string title, bool supportsReferences)
- {
- throw new NotImplementedException ();
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/SuggestedActionCategoryRegistryService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/SuggestedActionCategoryRegistryService.cs
index 2ae768f713..e9879e5c32 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/SuggestedActionCategoryRegistryService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/SuggestedActionCategoryRegistryService.cs
@@ -9,7 +9,7 @@ using Microsoft.VisualStudio.Language.Intellisense;
namespace MonoDevelop.Ide.Composition
{
- [Export(typeof(ISuggestedActionCategoryRegistryService))]
+ //[Export(typeof(ISuggestedActionCategoryRegistryService))]
class SuggestedActionCategoryRegistryService : ISuggestedActionCategoryRegistryService
{
public IEnumerable<ISuggestedActionCategory> Categories => throw new NotImplementedException ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/UIExtensionSelector.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/UIExtensionSelector.cs
new file mode 100644
index 0000000000..865c2c334f
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/UIExtensionSelector.cs
@@ -0,0 +1,83 @@
+//
+// 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.Utilities
+{
+ using System;
+ using System.Collections.Generic;
+ using Microsoft.VisualStudio.Text.Editor;
+ using Microsoft.VisualStudio.Utilities;
+
+ /// <summary>
+ /// Helper class to perform ContentType and TextViewRole match against a set of extensions.
+ /// </summary>
+ public static class UIExtensionSelector
+ {
+ /// <summary>
+ /// Given a list of extensions that provide text view roles, filter the list and return that
+ /// subset which matches at least one of the roles in the provided set of roles.
+ /// </summary>
+ public static List<Lazy<TProvider, TMetadataView>> SelectMatchingExtensions<TProvider, TMetadataView>
+ (IEnumerable<Lazy<TProvider, TMetadataView>> providerHandles,
+ ITextViewRoleSet viewRoles)
+ where TMetadataView : ITextViewRoleMetadata // text view role is required
+ {
+ var result = new List<Lazy<TProvider, TMetadataView>>();
+ foreach (var providerHandle in providerHandles)
+ {
+ IEnumerable<string> providerRoles = providerHandle.Metadata.TextViewRoles;
+ if (viewRoles.ContainsAny(providerRoles))
+ {
+ result.Add(providerHandle);
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Given a list of extensions that provide text view roles and content types, filter the list and return that
+ /// subset which matches the content types and at least one of the roles in the provided set of roles.
+ /// </summary>
+ public static List<Lazy<TProvider, TMetadataView>> SelectMatchingExtensions<TProvider, TMetadataView>
+ (IEnumerable<Lazy<TProvider, TMetadataView>> providerHandles,
+ IContentType documentContentType,
+ IContentType excludedContentType,
+ ITextViewRoleSet viewRoles)
+ where TMetadataView : IContentTypeAndTextViewRoleMetadata // both content type and text view role are required
+ {
+ var result = new List<Lazy<TProvider, TMetadataView>>();
+ foreach (var providerHandle in providerHandles)
+ {
+ // first, check content type match
+ if ((excludedContentType == null || !ExtensionSelector.ContentTypeMatch(excludedContentType, providerHandle.Metadata.ContentTypes)) &&
+ ExtensionSelector.ContentTypeMatch(documentContentType, providerHandle.Metadata.ContentTypes) &&
+ viewRoles.ContainsAny(providerHandle.Metadata.TextViewRoles))
+ {
+ result.Add(providerHandle);
+ }
+ }
+ return result;
+ }
+
+ /// <summary>
+ /// Given a list of extensions that provide text view roles and content types, return the
+ /// instantiated extension which best matches the given content type and matches at least one of the roles.
+ /// </summary>
+ public static TExtensionInstance InvokeBestMatchingFactory<TExtensionInstance, TExtensionFactory, TMetadataView>
+ (IEnumerable<Lazy<TExtensionFactory, TMetadataView>> providerHandles,
+ IContentType dataContentType,
+ ITextViewRoleSet viewRoles,
+ Func<TExtensionFactory, TExtensionInstance> getter,
+ IContentTypeRegistryService contentTypeRegistryService,
+ IGuardedOperations guardedOperations,
+ object errorSource)
+ where TMetadataView : IContentTypeAndTextViewRoleMetadata // both content type and text view role are required
+ where TExtensionFactory : class
+ where TExtensionInstance : class
+ {
+ var roleMatchingProviderHandles = SelectMatchingExtensions(providerHandles, viewRoles);
+ return guardedOperations.InvokeBestMatchingFactory(roleMatchingProviderHandles, dataContentType, getter, contentTypeRegistryService, errorSource);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/VisualStudioMefHostServices.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/VisualStudioMefHostServices.cs
new file mode 100644
index 0000000000..1c081cf429
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Composition/VisualStudioMefHostServices.cs
@@ -0,0 +1,97 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Immutable;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Host;
+using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.VisualStudio.Composition;
+using Roslyn.Utilities;
+
+namespace Microsoft.VisualStudio.LanguageServices
+{
+ /// <summary>
+ /// Provides host services imported via VS MEF.
+ /// </summary>
+ internal sealed class VisualStudioMefHostServices : HostServices, IMefHostExportProvider
+ {
+ // the export provider for the MEF composition
+ private readonly ExportProvider _exportProvider;
+
+ // accumulated cache for exports
+ private ImmutableDictionary<ExportKey, IEnumerable> _exportsMap
+ = ImmutableDictionary<ExportKey, IEnumerable>.Empty;
+
+ private VisualStudioMefHostServices(ExportProvider exportProvider)
+ {
+ Contract.ThrowIfNull(exportProvider);
+ _exportProvider = exportProvider;
+ }
+
+ public static VisualStudioMefHostServices Create(ExportProvider exportProvider)
+ => new VisualStudioMefHostServices(exportProvider);
+
+ /// <summary>
+ /// Creates a new <see cref="HostWorkspaceServices"/> associated with the specified workspace.
+ /// </summary>
+ protected internal override HostWorkspaceServices CreateWorkspaceServices(Workspace workspace)
+ => new MefWorkspaceServices(this, workspace);
+
+ /// <summary>
+ /// Gets all the MEF exports of the specified type with the specified metadata.
+ /// </summary>
+ public IEnumerable<Lazy<TExtension, TMetadata>> GetExports<TExtension, TMetadata>()
+ {
+ var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, typeof(TMetadata).AssemblyQualifiedName);
+ if (!_exportsMap.TryGetValue(key, out var exports))
+ {
+ exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
+ {
+ return _exportProvider.GetExports<TExtension, TMetadata>().ToImmutableArray();
+ });
+ }
+
+ return (IEnumerable<Lazy<TExtension, TMetadata>>)exports;
+ }
+
+ /// <summary>
+ /// Gets all the MEF exports of the specified type.
+ /// </summary>
+ public IEnumerable<Lazy<TExtension>> GetExports<TExtension>()
+ {
+ var key = new ExportKey(typeof(TExtension).AssemblyQualifiedName, "");
+ if (!_exportsMap.TryGetValue(key, out var exports))
+ {
+ exports = ImmutableInterlocked.GetOrAdd(ref _exportsMap, key, _ =>
+ _exportProvider.GetExports<TExtension>().ToImmutableArray());
+ }
+
+ return (IEnumerable<Lazy<TExtension>>)exports;
+ }
+
+ private struct ExportKey : IEquatable<ExportKey>
+ {
+ internal readonly string ExtensionTypeName;
+ internal readonly string MetadataTypeName;
+ private readonly int _hash;
+
+ public ExportKey(string extensionTypeName, string metadataTypeName)
+ {
+ ExtensionTypeName = extensionTypeName;
+ MetadataTypeName = metadataTypeName;
+ _hash = Hash.Combine(metadataTypeName.GetHashCode(), extensionTypeName.GetHashCode());
+ }
+
+ public bool Equals(ExportKey other)
+ => string.Compare(ExtensionTypeName, other.ExtensionTypeName, StringComparison.OrdinalIgnoreCase) == 0 &&
+ string.Compare(MetadataTypeName, other.MetadataTypeName, StringComparison.OrdinalIgnoreCase) == 0;
+
+ public override bool Equals(object obj)
+ => obj is ExportKey key && Equals(key);
+
+ public override int GetHashCode()
+ => Hash.Combine(MetadataTypeName.GetHashCode(), ExtensionTypeName.GetHashCode());
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
index f337143d22..f7ba28cf59 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
@@ -1,55 +1,47 @@
-//
-// PlatformService.cs
-//
-// Author:
-// Geoff Norton <gnorton@novell.com>
-//
-// Copyright (C) 2007 Novell, Inc (http://www.novell.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.
-//
-
+//
+// PlatformService.cs
+//
+// Author:
+// Geoff Norton <gnorton@novell.com>
+//
+// Copyright (C) 2007 Novell, Inc (http://www.novell.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 System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
-using System.Text.RegularExpressions;
-
-using Microsoft.VisualStudio.Platform;
-using Microsoft.VisualStudio.Utilities;
-
-using Mono.Addins;
using MonoDevelop.Core;
using Mono.Unix;
using MonoDevelop.Ide.Extensions;
using MonoDevelop.Core.Execution;
using MonoDevelop.Components;
using MonoDevelop.Components.MainToolbar;
-using MonoDevelop.Ide.Composition;
-using System.Threading.Tasks;
namespace MonoDevelop.Ide.Desktop
{
- public abstract class PlatformService
+ public abstract partial class PlatformService
{
Hashtable iconHash = new Hashtable ();
static readonly bool UsePlatformFileIcons = false;
@@ -102,7 +94,7 @@ namespace MonoDevelop.Ide.Desktop
public string GetMimeTypeForUri (string uri)
{
if (!String.IsNullOrEmpty (uri)) {
- MimeTypeNode mt = FindMimeTypeForFile (uri);
+ MimeTypeNode mt = MimeTypeCatalog.Instance.FindMimeTypeForFile (uri);
if (mt != null)
return mt.Id;
}
@@ -126,55 +118,13 @@ namespace MonoDevelop.Ide.Desktop
return GettextCatalog.GetString ("Text file");
if (mimeType == "application/octet-stream")
return GettextCatalog.GetString ("Unknown");
- MimeTypeNode mt = FindMimeType (mimeType);
+ MimeTypeNode mt = MimeTypeCatalog.Instance.FindMimeType (mimeType);
if (mt != null && mt.Description != null)
return mt.Description;
else
return OnGetMimeTypeDescription (mimeType) ?? string.Empty;
}
- public bool GetMimeTypeIsText (string mimeType)
- {
- return GetMimeTypeIsSubtype (mimeType, "text/plain");
- }
-
- public bool GetMimeTypeIsSubtype (string subMimeType, string baseMimeType)
- {
- foreach (string mt in GetMimeTypeInheritanceChain (subMimeType))
- if (mt == baseMimeType)
- return true;
- return false;
- }
-
- public IEnumerable<string> GetMimeTypeInheritanceChain (string mimeType)
- {
- yield return mimeType;
-
- while (mimeType != null && mimeType != "text/plain" && mimeType != "application/octet-stream") {
- MimeTypeNode mt = FindMimeType (mimeType);
- if (mt != null && !string.IsNullOrEmpty (mt.BaseType))
- mimeType = mt.BaseType;
- else {
- if (mimeType.EndsWith ("+xml", StringComparison.Ordinal))
- mimeType = "application/xml";
- else if (mimeType.StartsWith ("text/", StringComparison.Ordinal) || OnGetMimeTypeIsText (mimeType))
- mimeType = "text/plain";
- else
- break;
- }
- yield return mimeType;
- }
- }
-
- public string GetMimeTypeForRoslynLanguage (string language)
- {
- foreach (MimeTypeNode mt in MimeTypeNodes.All) {
- if (mt.RoslynName == language)
- return mt.Id;
- }
- return null;
- }
-
public Xwt.Drawing.Image GetIconForFile (string filename)
{
Xwt.Drawing.Image pic = null;
@@ -189,7 +139,7 @@ namespace MonoDevelop.Ide.Desktop
if (pic == null) {
string mtype = GetMimeTypeForUri (filename);
if (mtype != null) {
- foreach (string mt in GetMimeTypeInheritanceChain (mtype)) {
+ foreach (string mt in MimeTypeCatalog.Instance.GetMimeTypeInheritanceChain (mtype)) {
pic = GetIconForType (mt);
if (pic != null)
return pic;
@@ -205,7 +155,7 @@ namespace MonoDevelop.Ide.Desktop
if (bf != null)
return bf;
- foreach (string type in GetMimeTypeInheritanceChain (mimeType)) {
+ foreach (string type in MimeTypeCatalog.Instance.GetMimeTypeInheritanceChain (mimeType)) {
// Try getting an icon name for the type
string icon = GetIconIdForType (type);
if (icon != null) {
@@ -249,7 +199,7 @@ namespace MonoDevelop.Ide.Desktop
string GetIconIdForFile (string fileName)
{
- MimeTypeNode mt = FindMimeTypeForFile (fileName);
+ MimeTypeNode mt = MimeTypeCatalog.Instance.FindMimeTypeForFile (fileName);
if (mt != null)
return mt.Icon;
else
@@ -260,7 +210,7 @@ namespace MonoDevelop.Ide.Desktop
{
if (type == "text/plain")
return "md-text-file-icon";
- MimeTypeNode mt = FindMimeType (type);
+ MimeTypeNode mt = MimeTypeCatalog.Instance.FindMimeType (type);
if (mt != null)
return mt.Icon;
else if (UsePlatformFileIcons)
@@ -269,68 +219,6 @@ namespace MonoDevelop.Ide.Desktop
return null;
}
- static class MimeTypeNodes
- {
- public static List<MimeTypeNode> All => mimeTypeNodes;
-
- static List<MimeTypeNode> mimeTypeNodes = new List<MimeTypeNode> ();
-
- static MimeTypeNodes ()
- {
- if (AddinManager.IsInitialized) {
- AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Core/MimeTypes", delegate (object sender, ExtensionNodeEventArgs args) {
- var newList = new List<MimeTypeNode> (mimeTypeNodes);
- var mimeTypeNode = (MimeTypeNode)args.ExtensionNode;
- switch (args.Change) {
- case ExtensionChange.Add:
- // initialize child nodes.
- mimeTypeNode.ChildNodes.GetEnumerator ();
- newList.Add (mimeTypeNode);
- break;
- case ExtensionChange.Remove:
- newList.Remove (mimeTypeNode);
- break;
- }
- mimeTypeNodes = newList;
- });
- }
- }
- }
-
- static Lazy<IFileToContentTypeService> fileToContentTypeService = CompositionManager.GetExport<IFileToContentTypeService> ();
- MimeTypeNode FindMimeTypeForFile (string fileName)
- {
- try {
- IContentType contentType = fileToContentTypeService.Value.GetContentTypeForFilePath (fileName);
- if (contentType != PlatformCatalog.Instance.ContentTypeRegistryService.UnknownContentType) {
- string mimeType = PlatformCatalog.Instance.MimeToContentTypeRegistryService.GetMimeType (contentType);
- if (mimeType != null) {
- MimeTypeNode mt = FindMimeType (mimeType);
- if (mt != null) {
- return mt;
- }
- }
- }
- } catch (Exception ex) {
- LoggingService.LogError ("IFilePathToContentTypeProvider query failed", ex);
- }
-
- foreach (MimeTypeNode mt in MimeTypeNodes.All) {
- if (mt.SupportsFile (fileName))
- return mt;
- }
- return null;
- }
-
- MimeTypeNode FindMimeType (string type)
- {
- foreach (MimeTypeNode mt in MimeTypeNodes.All) {
- if (mt.Id == type)
- return mt;
- }
- return null;
- }
-
protected virtual string OnGetMimeTypeForUri (string uri)
{
return null;
@@ -341,11 +229,6 @@ namespace MonoDevelop.Ide.Desktop
return null;
}
- protected virtual bool OnGetMimeTypeIsText (string mimeType)
- {
- return false;
- }
-
protected virtual string OnGetIconIdForFile (string filename)
{
return null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs
index afc9320832..f9ab26a40e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractBraceMatcher.cs
//
// Author:
@@ -33,6 +33,7 @@ using System;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class AbstractBraceMatcher
{
public string MimeType {
@@ -48,6 +49,7 @@ namespace MonoDevelop.Ide.Editor
public abstract Task<BraceMatchingResult?> GetMatchingBracesAsync(IReadonlyTextDocument editor, DocumentContext context, int offset, CancellationToken cancellationToken = default(CancellationToken));
}
+ [Obsolete]
sealed class DefaultBraceMatcher : AbstractBraceMatcher
{
public override bool CanHandle (TextEditor editor)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
index 06f3297c3f..f67c03b5e9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractNavigationExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractNavigationExtension.cs
//
// Author:
@@ -35,6 +35,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class AbstractNavigationExtension : TextEditorExtension
{
uint timerId;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
index 76e692de88..425fa51992 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractUsagesExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// AbstractUsagesExtension.cs
//
// Author:
@@ -38,6 +38,7 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class UsageProviderEditorExtension : TextEditorExtension
{
public abstract ImmutableArray<Usage> Usages {
@@ -57,6 +58,7 @@ namespace MonoDevelop.Ide.Editor.Extension
/// <summary>
/// Provides a base class for implementing highlighting of usages inside the text editor.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class AbstractUsagesExtension<T> : UsageProviderEditorExtension
{
[SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AutoInsertBracketTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AutoInsertBracketTextEditorExtension.cs
index 79af756444..c688470176 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AutoInsertBracketTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AutoInsertBracketTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// AutoInsertBracketTextEditorExtension.cs
//
// Author:
@@ -32,12 +32,14 @@ using MonoDevelop.Ide.Extensions;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class AutoInsertBracketHandler
{
public virtual bool CanHandle (TextEditor editor) => true;
public abstract bool Handle (TextEditor editor, DocumentContext ctx, KeyDescriptor descriptor);
}
+ [Obsolete]
class AutoInsertBracketTextEditorExtension : TextEditorExtension
{
const string extensionPoint = "/MonoDevelop/Ide/AutoInsertBracketHandler";
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BlockStructureFoldingTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BlockStructureFoldingTextEditorExtension.cs
index 083a842b45..11bcc20eff 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BlockStructureFoldingTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BlockStructureFoldingTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// BlockStructureFoldingTextEditorExtension.cs
//
// Author:
@@ -39,6 +39,7 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class BlockStructureFoldingTextEditorExtension : TextEditorExtension
{
CancellationTokenSource src = new CancellationTokenSource ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs
index 8f788490c1..fbda12e096 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// BraceMatcherTextEditorExtension.cs
//
// Author:
@@ -37,6 +37,7 @@ using MonoDevelop.Ide.Extensions;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
sealed class BraceMatcherTextEditorExtension : TextEditorExtension
{
CancellationTokenSource src = new CancellationTokenSource();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs
index 8b0b980acc..4232fee5c0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs
@@ -30,10 +30,13 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.Editor
{
[Flags]
- public enum BraceMatchingProperties {
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
+ public enum BraceMatchingProperties
+ {
None = 0,
Hidden = 1
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public readonly struct BraceMatchingResult
{
public ISegment LeftSegment { get; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
index 8652d08524..921ce6079c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
@@ -1,4 +1,4 @@
-// CompletionTextEditorExtension.cs
+// CompletionTextEditorExtension.cs
//
// Author:
// Lluis Sanchez Gual
@@ -41,6 +41,7 @@ using MonoDevelop.Core.Instrumentation;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public enum SignatureHelpTriggerReason
{
InvokeSignatureHelpCommand,
@@ -48,6 +49,7 @@ namespace MonoDevelop.Ide.Editor.Extension
RetriggerCommand
}
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public readonly struct SignatureHelpTriggerInfo
{
public char? TriggerCharacter {
@@ -70,6 +72,7 @@ namespace MonoDevelop.Ide.Editor.Extension
}
}
+ [Obsolete("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public class CompletionTextEditorExtension : TextEditorExtension
{
CompletionStatistics completionStats = new CompletionStatistics ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/DefaultCommandTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/DefaultCommandTextEditorExtension.cs
index 4d2ff642ea..b29a4c78c4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/DefaultCommandTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/DefaultCommandTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// DefaultCommandTextEditorExtension.cs
//
// Author:
@@ -37,6 +37,7 @@ using System.Threading;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class DefaultCommandTextEditorExtension : TextEditorExtension
{
#region Commands
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/EditorFormattingServiceTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/EditorFormattingServiceTextEditorExtension.cs
index becedf94c4..3c75568454 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/EditorFormattingServiceTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/EditorFormattingServiceTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// EditorFormattingServiceTextEditorExtension.cs
//
// Author:
@@ -24,7 +24,8 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System.Threading;
+using System;
+using System.Threading;
using Microsoft.CodeAnalysis.Editor;
using MonoDevelop.Core;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
@@ -36,6 +37,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
partial class EditorFormattingServiceTextEditorExtension : TextEditorExtension
{
protected override void Initialize()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
index fdb85df7ef..5132c142ce 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ErrorHandlerTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// ErrorHandlerTextEditorExtension.cs
//
// Author:
@@ -38,6 +38,7 @@ using MonoDevelop.Projects;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class ErrorHandlerTextEditorExtension: TextEditorExtension, IQuickTaskProvider
{
CancellationTokenSource src = new CancellationTokenSource ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/FoldingTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/FoldingTextEditorExtension.cs
index d2e252b50e..82eae3fc76 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/FoldingTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/FoldingTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// FoldingTextEditorExtension.cs
//
// Author:
@@ -36,6 +36,7 @@ using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class FoldingTextEditorExtension : TextEditorExtension
{
CancellationTokenSource src = new CancellationTokenSource ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/HighlightUrlExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/HighlightUrlExtension.cs
index f4c271881a..31c8827877 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/HighlightUrlExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/HighlightUrlExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// HighlightUrlExtension.cs
//
// Author:
@@ -35,6 +35,7 @@ using System.Text.RegularExpressions;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class HighlightUrlExtension : TextEditorExtension
{
List<IUrlTextLineMarker> markers = new List<IUrlTextLineMarker> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IQuickTaskProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IQuickTaskProvider.cs
index 53bd9925dc..e270c48d46 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IQuickTaskProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IQuickTaskProvider.cs
@@ -30,6 +30,7 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public interface IQuickTaskProvider
{
ImmutableArray<QuickTask> QuickTasks {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IndentationTracker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IndentationTracker.cs
index 10c65520b1..e9a198a969 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IndentationTracker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/IndentationTracker.cs
@@ -29,7 +29,9 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.Editor.Extension
{
[Flags]
- public enum IndentationTrackerFeatures {
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
+ public enum IndentationTrackerFeatures
+ {
None = 0,
SmartBackspace = 1,
CustomIndentationEngine = 2,
@@ -40,6 +42,7 @@ namespace MonoDevelop.Ide.Editor.Extension
/// <summary>
/// The indentation tracker is for giving the editor information about virtual line indentations.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class IndentationTracker
{
public virtual IndentationTrackerFeatures SupportedFeatures {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/KeyDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/KeyDescriptor.cs
index d11ed56097..203d029929 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/KeyDescriptor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/KeyDescriptor.cs
@@ -1,4 +1,4 @@
-//
+//
// KeyDescriptor.cs
//
// Author:
@@ -30,6 +30,7 @@ using AppKit;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public readonly struct KeyDescriptor
{
public static KeyDescriptor Empty = new KeyDescriptor (SpecialKey.None, '\0', ModifierKeys.None, null);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/LineSeparatorTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/LineSeparatorTextEditorExtension.cs
index 6565d9fdeb..574a34db2c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/LineSeparatorTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/LineSeparatorTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// LineSeparatorTextEditorExtension.cs
//
// Author:
@@ -35,6 +35,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class LineSeparatorTextEditorExtension : TextEditorExtension
{
CancellationTokenSource src = new CancellationTokenSource ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ModifierKeys.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ModifierKeys.cs
index 4b902cdf0f..911b9b6373 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ModifierKeys.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/ModifierKeys.cs
@@ -1,4 +1,4 @@
-//
+//
// ModifierKeys.cs
//
// Author:
@@ -27,6 +27,7 @@ using System;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
[Flags]
public enum ModifierKeys
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/QuickTask.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/QuickTask.cs
index 96162525b1..f36cc828db 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/QuickTask.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/QuickTask.cs
@@ -34,7 +34,8 @@ using MonoDevelop.Components.Commands;
using Microsoft.CodeAnalysis;
namespace MonoDevelop.Ide.Editor.Extension
-{
+{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class QuickTask
{
Lazy<string> description;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SelectionSurroundingProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SelectionSurroundingProvider.cs
index 903e05a6ba..74a3698d01 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SelectionSurroundingProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SelectionSurroundingProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// ISelectionSurroundingProvider.cs
//
// Author:
@@ -32,6 +32,7 @@ namespace MonoDevelop.Ide.Editor.Extension
/// A selection surrounding provider handles a special handling how the text editor behaves when the user
/// types a key with a selection. The selection can be surrounded instead of beeing replaced.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class SelectionSurroundingProvider
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SpecialKey.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SpecialKey.cs
index f16b4d1c99..79a127115e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SpecialKey.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/SpecialKey.cs
@@ -1,4 +1,4 @@
-//
+//
// SpecialKey.cs
//
// Author:
@@ -27,6 +27,7 @@ using System;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public enum SpecialKey
{
None,
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TagCommentsTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TagCommentsTextEditorExtension.cs
index 9cd018c8e5..dc3f583955 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TagCommentsTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TagCommentsTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// TagCommentsTextEditorExtension.cs
//
// Author:
@@ -34,6 +34,7 @@ using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete]
class TagCommentsTextEditorExtension : TextEditorExtension, IQuickTaskProvider
{
ITodoListProvider todoListProvider = CompositionManager.Instance.GetExportedValue<ITodoListProvider> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
index a6b4cf594c..ba505c9685 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextEditorExtension.cs
@@ -35,6 +35,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class TextEditorExtension : ICommandRouter, IDisposable
{
public DocumentContext DocumentContext {
@@ -116,6 +117,7 @@ namespace MonoDevelop.Ide.Editor.Extension
}
}
+ [Obsolete]
class TextEditorExtensionMarker : TextEditorExtension
{
public override bool IsValidInContext (DocumentContext context)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextPasteHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextPasteHandler.cs
index c4f205af02..fde5f2b77e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextPasteHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/TextPasteHandler.cs
@@ -1,4 +1,4 @@
-//
+//
// TextPasteHandler.cs
//
// Author:
@@ -33,6 +33,7 @@ namespace MonoDevelop.Ide.Editor.Extension
/// The text paste handler can do formattings to a text that is about to be pasted
/// into the text document.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public abstract class TextPasteHandler
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/Usage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/Usage.cs
index ea8dade4d3..bcc3b44fc2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/Usage.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/Usage.cs
@@ -32,6 +32,7 @@ using MonoDevelop.Ide.FindInFiles;
namespace MonoDevelop.Ide.Editor.Extension
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class Usage : AbstractSegment
{
public readonly ReferenceUsageType UsageType;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
index 08edefc551..4f0c50461d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
@@ -34,6 +34,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
/// <summary>
/// A colored segment is used in the highlighter to specify a color scheme style to a specfic part of text.
/// </summary>
+ [Obsolete ("Old editor")]
public sealed class ColoredSegment : AbstractSegment
{
readonly ScopeStack scopeStack;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/OldFormat.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/OldFormat.cs
index 5c32b65efd..a2e11c503d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/OldFormat.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/OldFormat.cs
@@ -192,6 +192,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
settings.Add (new ThemeSetting ("Comment XML Doc Tag", new List<string> { "comment.line.documentation.tag" }, ConvertChunkStyle (colorScheme.CommentsForDocumentationTags)));
settings.Add (new ThemeSetting ("String", new List<string> { "string" }, ConvertChunkStyle (colorScheme.String)));
+ settings.Add (new ThemeSetting ("String Verbatim", new List<string> { "string.verbatim" }, ConvertChunkStyle (colorScheme.StringVerbatim)));
settings.Add (new ThemeSetting ("punctuation.definition.string", new List<string> { "punctuation.definition.string" }, ConvertChunkStyle (colorScheme.String)));
settings.Add (new ThemeSetting ("Number", new List<string> { "constant.numeric" }, ConvertChunkStyle (colorScheme.Number)));
@@ -226,6 +227,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
settings.Add (new ThemeSetting ("Tag name", new List<string> { "entity.name.tag" }, ConvertChunkStyle (colorScheme.HtmlElementName)));
settings.Add (new ThemeSetting ("Preprocessor", new List<string> { "meta.preprocessor" }, ConvertChunkStyle (colorScheme.Preprocessor)));
settings.Add (new ThemeSetting ("Preprocessor region name", new List<string> { "meta.preprocessor.region.name" }, ConvertChunkStyle (colorScheme.PreprocessorRegionName)));
+ settings.Add (new ThemeSetting ("Excluded Code", new List<string> { "comment.excluded" }, ConvertChunkStyle (colorScheme.ExcludedCode)));
settings.Add (new ThemeSetting ("Tag attribute", new List<string> { "entity.other.attribute-name" }, ConvertChunkStyle (colorScheme.XmlAttribute)));
settings.Add (new ThemeSetting ("Function call", new List<string> { "variable.function" }, ConvertChunkStyle (colorScheme.UserMethodDeclaration)));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/Sublime3Format.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/Sublime3Format.cs
index 0e56db76b6..7c76092b57 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/Sublime3Format.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/Sublime3Format.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using YamlDotNet.RepresentationModel;
@@ -11,6 +11,7 @@ using System.Globalization;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Old editor")]
static class Sublime3Format
{
public static SyntaxHighlightingDefinition ReadHighlighting (TextReader input)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/TextMateFormat.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/TextMateFormat.cs
index 10da29799a..9c93c198be 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/TextMateFormat.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Formats/TextMateFormat.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMatePlistFormat.cs
//
// Author:
@@ -64,6 +64,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
var uuid = (PString)dictionary ["uuid"];
+ #pragma warning disable CS0618 // Type or member is obsolete
var methodDecl = GetSetting (settings, EditorThemeColors.UserMethodDeclaration);
var methodUsage = GetSetting (settings, EditorThemeColors.UserMethodUsage);
if (methodUsage == null && methodDecl != null) {
@@ -72,7 +73,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
new List<string> { EditorThemeColors.UserMethodUsage },
settings [0].Settings
));
- }
+ }
+ #pragma warning restore CS0618 // Type or member is obsolete
+
ConvertSetting (settings, "storage.type", EditorThemeColors.UserTypesInterfaces);
ConvertSetting (settings, "entity.name", EditorThemeColors.UserTypes);
ConvertSetting (settings, "entity.name", EditorThemeColors.UserTypesEnums);
@@ -93,7 +96,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting
EditorThemeColors.UserTypesTypeParameters,
EditorThemeColors.UserTypesDelegates,
EditorThemeColors.UserTypesMutable,
- EditorThemeColors.UserFieldDeclaration,
+ #pragma warning disable CS0618 // Type or member is obsolete
+ EditorThemeColors.UserFieldDeclaration,
EditorThemeColors.UserFieldUsage,
EditorThemeColors.UserPropertyDeclaration,
EditorThemeColors.UserPropertyUsage,
@@ -105,6 +109,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
EditorThemeColors.UserParameterUsage,
EditorThemeColors.UserVariableDeclaration,
EditorThemeColors.UserVariableUsage
+ #pragma warning restore CS0618 // Type or member is obsolete
};
foreach (var semanticColor in semanticColors) {
if (GetSetting (settings, semanticColor) == null) {
@@ -283,18 +288,20 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
return new ThemeSetting (themeSetting.Name, themeSetting.Scopes, settings);
- }
-
+ }
+
#endregion
-
+
#region Syntax highlighting
-
+
+ [Obsolete ("Old editor")]
internal static SyntaxHighlightingDefinition ReadHighlighting (Stream stream)
{
var dictionary = PDictionary.FromStream (stream);
return ReadHighlighting (dictionary);
- }
-
+ }
+
+ [Obsolete ("Old editor")]
internal static SyntaxHighlightingDefinition ReadHighlighting (PDictionary dictionary)
{
@@ -327,8 +334,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
// var uuid = (dictionary ["uuid"] as PString)?.Value;
var hideFromUser = (dictionary ["hideFromUser"] as PBoolean)?.Value;
return new SyntaxHighlightingDefinition (name, scope, firstLineMatch, hideFromUser == true, extensions, contexts);
- }
-
+ }
+
+ [Obsolete ("Old editor")]
private static void ReadRepository (PDictionary repository, List<SyntaxContext> contexts)
{
foreach (var kv in repository) {
@@ -356,8 +364,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
- }
-
+ }
+
+ [Obsolete ("Old editor")]
static void ReadPatterns (PArray patternsArray, List<object> includesAndMatches)
{
foreach (var type in patternsArray) {
@@ -382,8 +391,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
includesAndMatches.Add (newMatch);
}
- }
-
+ }
+
+ [Obsolete ("Old editor")]
static SyntaxMatch ReadMatch (PDictionary dict)
{
List<string> matchScope = new List<string> ();
@@ -468,8 +478,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return null;
return new SyntaxMatch (Sublime3Format.CompileRegex (match), matchScope, captures, pushContext, false, null, null);
- }
-
+ }
+
+ [Obsolete ("Old editor")]
static Captures ReadCaptureDictionary (PDictionary captureDict)
{
var group = new List<Tuple<int, string>> ();
@@ -488,10 +499,12 @@ namespace MonoDevelop.Ide.Editor.Highlighting
group.Add (Tuple.Create (g, s));
}
return new Captures(group, named);
- }
+ }
#endregion
-
+
#region JSon Format
+
+ [Obsolete ("Old editor")]
internal static SyntaxHighlightingDefinition ReadHighlightingFromJson(Stream stream)
{
byte [] bytes;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlighting.cs
index 74b3652f72..cb82a6195f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlighting.cs
@@ -35,6 +35,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Old editor")]
public sealed class HighlightedLine
{
public ISegment TextSegment { get; }
@@ -71,6 +72,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
/// <summary>
/// The basic interface for all syntax modes
/// </summary>
+ [Obsolete ("Old editor")]
public interface ISyntaxHighlighting : IDisposable
{
/// <summary>
@@ -85,11 +87,13 @@ namespace MonoDevelop.Ide.Editor.Highlighting
event EventHandler<LineEventArgs> HighlightingStateChanged;
}
+ [Obsolete ("Old editor")]
interface ISyntaxHighlighting2 : ISyntaxHighlighting
{
bool IsUpdatingOnTextChange { get; }
}
+ [Obsolete ("Old editor")]
public sealed class DefaultSyntaxHighlighting : ISyntaxHighlighting
{
public static readonly DefaultSyntaxHighlighting Instance = new DefaultSyntaxHighlighting ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlightingDefinitionProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlightingDefinitionProvider.cs
index d265f5e55c..2c0943a0c7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlightingDefinitionProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ISyntaxHighlightingDefinitionProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// ISyntaxHighlightingDefinitionProvider.cs
//
// Author:
@@ -36,6 +36,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Old editor")]
interface ISyntaxHighlightingDefinitionProvider
{
string Name { get; }
@@ -45,6 +46,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
SyntaxHighlightingDefinition GetSyntaxHighlightingDefinition ();
}
+ [Obsolete ("Old editor")]
enum SyntaxHighlightingDefinitionFormat
{
TextMate,
@@ -52,6 +54,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
Sublime3
}
+ [Obsolete ("Old editor")]
abstract class AbstractSyntaxHighlightingDefinitionProvider : ISyntaxHighlightingDefinitionProvider
{
readonly Func<IStreamProvider> getStreamProvider;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/LanguageBundle.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/LanguageBundle.cs
index ea54e1f33f..0da06c8841 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/LanguageBundle.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/LanguageBundle.cs
@@ -1,4 +1,4 @@
-//
+//
// LanguageBundle.cs
//
// Author:
@@ -30,6 +30,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
{
class LanguageBundle
{
+ [Obsolete]
List<ISyntaxHighlightingDefinitionProvider> highlightings = new List<ISyntaxHighlightingDefinitionProvider> ();
List<TmSetting> settings = new List<TmSetting> ();
List<TmSnippet> snippets = new List<TmSnippet> ();
@@ -41,6 +42,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public IReadOnlyList<ISyntaxHighlightingDefinitionProvider> Highlightings {
get {
return highlightings;
@@ -96,6 +98,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
snippets.Add (snippet);
}
+ [Obsolete ("Old editor")]
public void Add (ISyntaxHighlightingDefinitionProvider highlighting)
{
highlightings.Add (highlighting);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Makefile.am b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Makefile.am
deleted file mode 100644
index fc16b3af83..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-EXTRA_DIST += \
- $(wildcard syntaxes/*) \
- $(wildcard themes/*) \
- $(wildcard VSCodeImport/*)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/Regex.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/Regex.cs
index 01b09b5233..5b4b693159 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/Regex.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/Regex.cs
@@ -1,4 +1,4 @@
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
// <copyright file="Regex.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
@@ -40,6 +40,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
class Regex
#if !SILVERLIGHT
: ISerializable
@@ -1346,13 +1347,16 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
delegate String MatchEvaluator(Match match);
/*
* Used to cache byte codes or compiled factories
*/
- internal sealed class CachedCodeEntry {
+ [Obsolete ("Old editor")]
+ internal sealed class CachedCodeEntry
+ {
internal string _key;
internal RegexCode _code;
#if SILVERLIGHT
@@ -1398,7 +1402,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
/*
* Used to cache one exclusive runner reference
*/
- internal sealed class ExclusiveReference {
+ [Obsolete ("Old editor")]
+ internal sealed class ExclusiveReference
+ {
RegexRunner _ref;
Object _obj;
int _locked;
@@ -1480,7 +1486,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
/*
* Used to cache a weak reference in a threadsafe way
*/
- internal sealed class SharedReference {
+ [Obsolete ("Old editor")]
+ internal sealed class SharedReference
+ {
WeakReference _ref = new WeakReference(null);
int _locked;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexBoyerMoore.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexBoyerMoore.cs
index 22cf9e76df..23a3cc2958 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexBoyerMoore.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexBoyerMoore.cs
@@ -22,7 +22,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
using System.Globalization;
using MonoDevelop.Core.Text;
- internal sealed class RegexBoyerMoore {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexBoyerMoore
+ {
internal int[] _positive;
internal int[] _negativeASCII;
internal int[][] _negativeUnicode;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCapture.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCapture.cs
index 75d67bb5ce..d585d00d56 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCapture.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCapture.cs
@@ -22,7 +22,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
- class Capture {
+ [Obsolete ("Old editor")]
+ class Capture
+ {
internal string _text;
internal int _index;
internal int _length;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCaptureCollection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCaptureCollection.cs
index 3fbf6f7a69..58f7e53112 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCaptureCollection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCaptureCollection.cs
@@ -27,6 +27,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
class CaptureCollection : ICollection {
internal Group _group;
internal int _capcount;
@@ -165,6 +166,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
internal class CaptureEnumerator : IEnumerator {
internal CaptureCollection _rcc;
internal int _curindex;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCharClass.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCharClass.cs
index 8060a0af80..f39a1b92ca 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCharClass.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCharClass.cs
@@ -31,7 +31,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Globalization;
using System.Diagnostics;
- internal sealed class RegexCharClass {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexCharClass
+ {
// instance data
private List<SingleRange> _rangelist;
private StringBuilder _categories;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCode.cs
index 2530804a7c..9b74985e25 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCode.cs
@@ -27,7 +27,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Diagnostics;
using System.Globalization;
- internal sealed class RegexCode {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexCode
+ {
// the following primitive operations come directly from the parser
// lef/back operands description
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompilationInfo.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompilationInfo.cs
index c43d0d6c89..d586cfa114 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompilationInfo.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompilationInfo.cs
@@ -17,7 +17,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
/// [To be supplied]
/// </para>
/// </devdoc>
- [ Serializable() ]
+ [ Serializable() ]
+ [Obsolete ("Old editor")]
class RegexCompilationInfo {
private String pattern;
private RegexOptions options;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompiler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompiler.cs
index 0d2e7f1ecd..04b1ea52be 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompiler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexCompiler.cs
@@ -39,6 +39,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
* While we're at it, we just create one RegexCompiler per thread
* as well, and have RegexCompiler inherit from RegexDynamicModule.
*/
+ [Obsolete ("Old editor")]
internal abstract class RegexCompiler {
// fields that never change (making them saves about 6% overall running time)
@@ -3028,6 +3029,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
}
+ [Obsolete ("Old editor")]
internal class RegexTypeCompiler : RegexCompiler {
private static int _typeCount = 0;
private static LocalDataStoreSlot _moduleSlot = Thread.AllocateDataSlot();
@@ -3373,6 +3375,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
+ [Obsolete ("Old editor")]
internal class RegexLWCGCompiler : RegexCompiler {
private static int _regexCount = 0;
private static Type[] _paramTypes = new Type[] {typeof(RegexRunner)};
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexFCD.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexFCD.cs
index 80ccc6575f..05dfec8643 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexFCD.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexFCD.cs
@@ -20,7 +20,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Collections;
using System.Globalization;
- internal sealed class RegexFCD {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexFCD
+ {
private int[] _intStack;
private int _intDepth;
private RegexFC[] _fcStack;
@@ -494,6 +496,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
}
+ [Obsolete ("Old editor")]
internal sealed class RegexFC {
internal RegexCharClass _cc;
internal bool _nullable;
@@ -562,7 +565,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
}
- internal sealed class RegexPrefix {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexPrefix
+ {
internal String _prefix;
internal bool _caseInsensitive;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroup.cs
index fdf7c94f2f..1defac2784 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroup.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroup.cs
@@ -23,6 +23,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
class Group : Capture {
// the empty group object
internal static Group _emptygroup = new Group("", new int[0], 0);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroupCollection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroupCollection.cs
index 8a3306d542..f45833b64f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroupCollection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexGroupCollection.cs
@@ -23,6 +23,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
class GroupCollection : ICollection {
internal Match _match;
#if SILVERLIGHT
@@ -192,6 +193,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
* This non-public enumerator lists all the captures
* Should it be public?
*/
+ [Obsolete ("Old editor")]
internal class GroupEnumerator : IEnumerator {
internal GroupCollection _rgc;
internal int _curindex;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexInterpreter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexInterpreter.cs
index 0f07741719..c25595879f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexInterpreter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexInterpreter.cs
@@ -17,7 +17,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine
using System.Collections;
using System.Diagnostics;
using System.Globalization;
-
+
+ [Obsolete ("Old editor")]
internal sealed class RegexInterpreter : RegexRunner {
internal int runoperator;
internal int [] runcodes;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatch.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatch.cs
index 4aa2c26776..d09033a5b9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatch.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatch.cs
@@ -46,6 +46,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
+ [Obsolete ("Old editor")]
class Match : Group {
internal static Match _empty = new Match(null, 1, "", 0, 0, 0);
internal GroupCollection _groupcoll;
@@ -415,6 +416,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
* MatchSparse is for handling the case where slots are
* sparsely arranged (e.g., if somebody says use slot 100000)
*/
+ [Obsolete ("Old editor")]
internal class MatchSparse : Match {
// the lookup hashtable
#if SILVERLIGHT
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchCollection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchCollection.cs
index 6156791c88..bbb80cd734 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchCollection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchCollection.cs
@@ -27,7 +27,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
/// names in a regular expression.
/// </para>
/// </devdoc>
- [ Serializable() ]
+ [ Serializable() ]
+ [Obsolete ("Old editor")]
class MatchCollection : ICollection {
internal Regex _regex;
internal List<Match> _matches;
@@ -197,7 +198,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
#if !SILVERLIGHT
[ Serializable() ]
#endif
- internal class MatchEnumerator : IEnumerator {
+ [Obsolete ("Old editor")]
+ internal class MatchEnumerator : IEnumerator {
internal MatchCollection _matchcoll;
internal Match _match = null;
internal int _curindex;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchTimeoutException.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchTimeoutException.cs
index 05e7a6e8f2..5057e3cb97 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchTimeoutException.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexMatchTimeoutException.cs
@@ -27,6 +27,7 @@ internal
class RegexMatchTimeoutException : TimeoutException {
#else
[Serializable]
+[Obsolete ("Old editor")]
public class RegexMatchTimeoutException : TimeoutException, ISerializable {
#endif
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexNode.cs
index 74a4802284..76ba0aa975 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexNode.cs
@@ -51,6 +51,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Diagnostics;
using System.Globalization;
+ [Obsolete ("Old editor")]
internal sealed class RegexNode {
/*
* RegexNode types
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexOptions.cs
index 5bb0340979..431bf56df3 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexOptions.cs
@@ -13,7 +13,9 @@ using System;
/// <para>[To be supplied.]</para>
/// </devdoc>
[Flags]
- enum RegexOptions {
+ [Obsolete ("Old editor")]
+ enum RegexOptions
+ {
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexParser.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexParser.cs
index 607b5a6b5c..8757959d52 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexParser.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexParser.cs
@@ -21,7 +21,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Collections.Generic;
using System.Globalization;
- internal sealed class RegexParser {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexParser
+ {
internal RegexNode _stack;
internal RegexNode _group;
internal RegexNode _alternation;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexReplacement.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexReplacement.cs
index 7159c84137..a73e8ec619 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexReplacement.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexReplacement.cs
@@ -16,7 +16,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Collections.Generic;
using MonoDevelop.Core.Text;
- internal sealed class RegexReplacement {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexReplacement
+ {
/*
* Since RegexReplacement shares the same parser as Regex,
* the constructor takes a RegexNode which is a concatenation
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunner.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunner.cs
index ee0c2ea8f1..26f3844ef7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunner.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunner.cs
@@ -41,7 +41,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
#if !SILVERLIGHT
- abstract class RegexRunner {
+ [Obsolete ("Old editor")]
+ abstract class RegexRunner
+ {
#else
abstract internal class RegexRunner {
#endif
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunnerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunnerFactory.cs
index 9bffc8b5e2..80104f583e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunnerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexRunnerFactory.cs
@@ -8,16 +8,18 @@
// we need to compile a factory because Type.CreateInstance is much slower
// than calling the constructor directly.
-namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
-
- using System.ComponentModel;
+namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
+ using System;
+ using System.ComponentModel;
#if !SILVERLIGHT
/// <internalonly/>
[ EditorBrowsable(EditorBrowsableState.Never) ]
#endif
#if !SILVERLIGHT
- abstract class RegexRunnerFactory {
+ [Obsolete ("Old editor")]
+ abstract class RegexRunnerFactory
+ {
#else
abstract internal class RegexRunnerFactory {
#endif
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexTree.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexTree.cs
index 9be80dfc42..b054c1cd2b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexTree.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexTree.cs
@@ -14,7 +14,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Collections;
using System.Collections.Generic;
- internal sealed class RegexTree {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexTree
+ {
#if SILVERLIGHT
internal RegexTree(RegexNode root, Dictionary<Int32, Int32> caps, Int32[] capnumlist, int captop, Dictionary<String, Int32> capnames, String[] capslist, RegexOptions opts)
#else
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexWriter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexWriter.cs
index 412daa8fa7..1072fa6cce 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexWriter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/RegexWriter.cs
@@ -23,7 +23,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
using System.Collections;
using System.Globalization;
- internal sealed class RegexWriter {
+ [Obsolete ("Old editor")]
+ internal sealed class RegexWriter
+ {
internal int[] _intStack;
internal int _depth;
internal int[] _emitted;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunner.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunner.cs
index 4943eaf785..12b20b4ab0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunner.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunner.cs
@@ -12,6 +12,7 @@ using System.Reflection.Emit;
namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
+ [Obsolete ("Old editor")]
internal sealed class CompiledRegexRunner : RegexRunner {
NoParamDelegate goMethod;
FindFirstCharDelegate findFirstCharMethod;
@@ -38,8 +39,11 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
}
- internal delegate void NoParamDelegate(RegexRunner r);
- internal delegate bool FindFirstCharDelegate(RegexRunner r);
+ [Obsolete ("Old editor")]
+ internal delegate void NoParamDelegate (RegexRunner r);
+
+ [Obsolete ("Old editor")]
+ internal delegate bool FindFirstCharDelegate (RegexRunner r);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunnerfactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunnerfactory.cs
index b66c1ea239..aecc8dc015 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunnerfactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/RegexEngine/compiledregexrunnerfactory.cs
@@ -6,13 +6,14 @@
using System.Diagnostics;
using System.Security.Permissions;
-
+using System;
+
#if !SILVERLIGHT && !FULL_AOT_RUNTIME
using System.Reflection.Emit;
namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
-
+ [Obsolete ("Old editor")]
internal sealed class CompiledRegexRunnerFactory : RegexRunnerFactory {
DynamicMethod goMethod;
DynamicMethod findFirstCharMethod;
@@ -39,7 +40,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting.RegexEngine {
}
}
- internal delegate RegexRunner CreateInstanceDelegate();
+ [Obsolete ("Old editor")]
+ internal delegate RegexRunner CreateInstanceDelegate ();
}
#endif
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ScopeStack.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ScopeStack.cs
index b3f5d1dbda..c30adbd79d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ScopeStack.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ScopeStack.cs
@@ -1,4 +1,4 @@
-//
+//
// ScopeStack.cs
//
// Author:
@@ -31,6 +31,7 @@ using System.Collections;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+
public sealed class ScopeStack : IEnumerable<string>
{
public static readonly ScopeStack Empty = new ScopeStack (null, ImmutableStack<string>.Empty, 0, null);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SemanticHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SemanticHighlighting.cs
index 77b4825712..48ec463818 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SemanticHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SemanticHighlighting.cs
@@ -1,4 +1,4 @@
-//
+//
// SemanticHighlighting.cs
//
// Author:
@@ -33,6 +33,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
/// Semantic highlighting adds the ability to add highlighting for things that require
/// a background parser to be colored. For example type names.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public abstract class SemanticHighlighting : IDisposable
{
protected readonly internal TextEditor editor;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/StackMatchExpression.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/StackMatchExpression.cs
index f149db04a2..6cd22241c8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/StackMatchExpression.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/StackMatchExpression.cs
@@ -1,4 +1,4 @@
-//
+//
// StackMatchExpression.cs
//
// Author:
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlighting.cs
index c5c682ac3c..6acb741f21 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlighting.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using YamlDotNet.RepresentationModel;
@@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Execution;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class SyntaxHighlighting : ISyntaxHighlighting
{
readonly SyntaxHighlightingDefinition definition;
@@ -178,10 +179,11 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
static readonly TimeSpan matchTimeout = TimeSpan.FromMilliseconds (500);
+ const int maxLineLength = 1 << 16;
public Task<HighlightedLine> GetColoredSegments (ITextSource text, int startOffset, int length)
{
- if (ContextStack.IsEmpty)
+ if (ContextStack.IsEmpty || length > maxLineLength)
return Task.FromResult (new HighlightedLine (new TextSegment (startOffset, length), new [] { new ColoredSegment (0, length, ScopeStack.Empty) }));
SyntaxContext currentContext = null;
Match match = null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingDefinition.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingDefinition.cs
index 76d55d5fab..b31f8c8332 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingDefinition.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingDefinition.cs
@@ -35,6 +35,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Old editor")]
public class SyntaxHighlightingDefinition : ISyntaxHighlightingDefinitionProvider
{
public string Name { get; internal set; }
@@ -80,7 +81,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
SyntaxHighlightingDefinition ISyntaxHighlightingDefinitionProvider.GetSyntaxHighlightingDefinition () => this;
}
-
+ [Obsolete ("Old editor")]
class SyntaxContextWithPrototype : SyntaxContext
{
SyntaxContext ctx;
@@ -102,6 +103,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public class SyntaxContext
{
protected List<SyntaxMatch> matches;
@@ -294,6 +296,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public class Captures
{
public static readonly Captures Empty = new Captures (new List<Tuple<int, string>> (), new List<Tuple<string, string>> ());
@@ -313,6 +316,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public class SyntaxMatch
{
public string Match { get; private set; }
@@ -363,11 +367,13 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public abstract class ContextReference
{
public abstract IEnumerable<SyntaxContext> GetContexts (SyntaxContext context);
}
+ [Obsolete ("Old editor")]
public class ContextNameContextReference : ContextReference
{
public string Name { get; private set; }
@@ -395,6 +401,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public class ContextNameListContextReference : ContextReference
{
public ContextNameListContextReference (IReadOnlyList<string> names)
@@ -411,6 +418,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ [Obsolete ("Old editor")]
public class AnonymousMatchContextReference : ContextReference
{
public SyntaxContext Context { get; private set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs
index d4c5ab9f4b..aa902cfe5c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxHighlightingService.cs
@@ -44,7 +44,6 @@ using System.Diagnostics;
namespace MonoDevelop.Ide.Editor.Highlighting
{
-
public static class SyntaxHighlightingService
{
static LanguageBundle builtInBundle = new LanguageBundle ("default", null) { BuiltInBundle = true };
@@ -252,11 +251,13 @@ namespace MonoDevelop.Ide.Editor.Highlighting
static void PrepareMatches ()
{
+ #pragma warning disable CS0618 // Type or member is obsolete
foreach (var bundle in languageBundles) {
- foreach (var h in bundle.Highlightings)
- if (h is SyntaxHighlightingDefinition def)
+ foreach (var h in bundle.Highlightings)
+ if (h is SyntaxHighlightingDefinition def)
def.PrepareMatches ();
}
+ #pragma warning restore CS0618 // Type or member is obsolete
}
internal static object LoadStyleOrMode (LanguageBundle bundle, string file)
@@ -279,6 +280,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting
static object LoadFile (LanguageBundle bundle, string file, Func<Stream> openStream, Func<IStreamProvider> getStreamProvider)
{
+ // this method dispatches to obsoleted methods for loading highlighting definitions and non-obsoleted methods for loading color themes
+ #pragma warning disable CS0618 // Type or member is obsolete
if (file.EndsWith (".json", StringComparison.OrdinalIgnoreCase)) {
using (var stream = openStream ()) {
string styleName;
@@ -289,8 +292,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting
var oldThemeProvider = AbstractThemeProvider.CreateProvider (EditorThemeFormat.XamarinStudio, styleName, getStreamProvider);
bundle.Add (oldThemeProvider);
return oldThemeProvider;
- case JSonFormat.TextMateJsonSyntax:
- var syntaxProvider = AbstractSyntaxHighlightingDefinitionProvider.CreateProvider (SyntaxHighlightingDefinitionFormat.TextMateJson, styleName, scopeName, fileTypes, getStreamProvider);
+ case JSonFormat.TextMateJsonSyntax:
+ var syntaxProvider = AbstractSyntaxHighlightingDefinitionProvider.CreateProvider (SyntaxHighlightingDefinitionFormat.TextMateJson, styleName, scopeName, fileTypes, getStreamProvider);
bundle.Add (syntaxProvider);
return syntaxProvider;
}
@@ -382,6 +385,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
return null;
+ #pragma warning restore CS0618 // Type or member is obsolete
}
static void LoadStylesAndModes (Assembly assembly)
@@ -629,7 +633,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
internal static void AddStyle (IStreamProvider provider)
- {
+ {
+ // this method dispatches to obsoleted methods for loading highlighting definitions and non-obsoleted methods for loading color themes
+ #pragma warning disable CS0618 // Type or member is obsolete
string styleName;
JSonFormat format;
using (var stream = provider.Open ()) {
@@ -639,13 +645,14 @@ namespace MonoDevelop.Ide.Editor.Highlighting
var oldThemeProvider = AbstractThemeProvider.CreateProvider (EditorThemeFormat.XamarinStudio, styleName, () => provider);
builtInBundle.Add (oldThemeProvider);
break;
- case JSonFormat.TextMateJsonSyntax:
- var syntaxProvider = AbstractSyntaxHighlightingDefinitionProvider.CreateProvider (SyntaxHighlightingDefinitionFormat.TextMateJson, styleName, scopeName, fileTypes, () => provider);
+ case JSonFormat.TextMateJsonSyntax:
+ var syntaxProvider = AbstractSyntaxHighlightingDefinitionProvider.CreateProvider (SyntaxHighlightingDefinitionFormat.TextMateJson, styleName, scopeName, fileTypes, () => provider);
builtInBundle.Add (syntaxProvider);
break;
}
}
}
+ #pragma warning restore CS0618 // Type or member is obsolete
}
internal static void RemoveStyle (IStreamProvider provider)
@@ -688,12 +695,13 @@ namespace MonoDevelop.Ide.Editor.Highlighting
static void OnSyntaxModeExtensionChanged (object s, ExtensionNodeEventArgs args)
{
+ #pragma warning disable CS0618 // Type or member is obsolete
var codon = (TemplateCodon)args.ExtensionNode;
if (args.Change == ExtensionChange.Add) {
try {
- var o = LoadFile (extensionBundle, codon.Name, () => codon.Open (), () => codon);
- if (o is SyntaxHighlightingDefinition)
+ var o = LoadFile (extensionBundle, codon.Name, () => codon.Open (), () => codon);
+ if (o is SyntaxHighlightingDefinition)
((SyntaxHighlightingDefinition)o).PrepareMatches ();
var bundle = o as LanguageBundle;
if (bundle != null) {
@@ -705,6 +713,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
LoggingService.LogError ("Error while loading custom editor extension file.", e);
}
}
+ #pragma warning restore CS0618 // Type or member is obsolete
}
public static HslColor GetColor (EditorTheme style, string key)
@@ -735,8 +744,9 @@ namespace MonoDevelop.Ide.Editor.Highlighting
DefaultColorStyle.TryGetColor (key, out result);
}
return new ChunkStyle() { Foreground = result };
- }
-
+ }
+
+ [Obsolete ("Old editor")]
static SyntaxHighlightingDefinition GetSyntaxHighlightingDefinitionByName (FilePath fileName)
{
SyntaxHighlightingDefinition bestMatch = null;
@@ -777,6 +787,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return bestMatch;
}
+ [Obsolete ("Old editor")]
static SyntaxHighlightingDefinition GetSyntaxHighlightingDefinitionByMimeType (string mimeType)
{
foreach (string mt in IdeServices.DesktopService.GetMimeTypeInheritanceChain (mimeType)) {
@@ -798,6 +809,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return null;
}
+ [Obsolete ("Old editor")]
internal static SyntaxHighlightingDefinition GetSyntaxHighlightingDefinition (FilePath fileName, string mimeType)
{
if (!fileName.IsNullOrEmpty) {
@@ -818,6 +830,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return GetSyntaxHighlightingDefinitionByMimeType (mimeType);
}
+ [Obsolete ("Old editor")]
internal static ScopeStack GetScopeForFileName (string fileName)
{
string scope = null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateCodon.cs
index dd84cd6565..3985bd358e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateCodon.cs
@@ -1,45 +1,48 @@
-// TemplateCodon.cs
-//
-// Author:
-// Mike Krüger <mkrueger@novell.com>
-//
-// Copyright (c) 2008 Novell, Inc (http://www.novell.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 System.IO;
+// TemplateCodon.cs
+//
+// Author:
+// Mike Krüger <mkrueger@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.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 System;
-using System.Xml;
-
+using System.IO;
using Mono.Addins;
namespace MonoDevelop.Ide.Editor.Highlighting
{
[ExtensionNode (Description="A template for color and syntax shemes.")]
class TemplateCodon : ExtensionNode, IStreamProvider
- {
- [NodeAttribute("resource", "Name of the resource where the template is stored.")]
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
+ [NodeAttribute ("resource", "Name of the resource where the template is stored.")]
string resource;
[NodeAttribute("file", "Name of the file where the template is stored.")]
- string file;
-
+ string file;
+
+ #pragma warning restore 649
+
public string Name { get { return file ?? resource; } }
public TemplateCodon ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
index 01f8d92179..75abc983cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
@@ -30,6 +30,7 @@ using MonoDevelop.Ide.Editor.Highlighting;
namespace MonoDevelop.Ide.Editor.Highlighting
{
+ [Obsolete ("Old editor")]
static class TemplateExtensionNodeLoader
{
static bool initialized = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSetting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSetting.cs
index 4f6516ac84..23d7bb3c07 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSetting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSetting.cs
@@ -35,7 +35,7 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.Editor.Highlighting
{
- sealed class TmSetting
+ sealed class TmSetting
{
public readonly string Name = ""; // not defined in vs.net
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSnippet.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSnippet.cs
index 6ec576c47e..5ee8d88692 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSnippet.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TmSnippet.cs
@@ -1,29 +1,30 @@
-//
-// TmSnippet.cs
-//
-// Author:
-// Mike Krüger <mikkrg@microsoft.com>
-//
-// Copyright (c) 2016 Microsoft Corporation
-//
-// 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.
-
+//
+// TmSnippet.cs
+//
+// Author:
+// Mike Krüger <mikkrg@microsoft.com>
+//
+// Copyright (c) 2016 Microsoft Corporation
+//
+// 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 System;
using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor.Highlighting
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/IIndentEngine.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/IIndentEngine.cs
index 0501cee653..211b5682ce 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/IIndentEngine.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/IIndentEngine.cs
@@ -1,4 +1,4 @@
-//
+//
// IIndentEngine.cs
//
// Author:
@@ -23,13 +23,13 @@
// 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 System;
using System.Collections.Generic;
-using MonoDevelop.Ide.Editor.Highlighting;
-using MonoDevelop.Ide.Editor.Highlighting.RegexEngine;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
interface IDocumentIndentEngine
{
/// <summary>
@@ -48,7 +48,8 @@ namespace MonoDevelop.Ide.Editor.TextMate
int LineNumber { get; }
string CurrentIndent { get; }
- new IDocumentIndentEngine Clone ();
+
+ IDocumentIndentEngine Clone ();
/// <summary>
/// Resets the engine.
@@ -66,6 +67,7 @@ namespace MonoDevelop.Ide.Editor.TextMate
/// The decorator is based on periodical caching of the engine's state and
/// delegating all logic behind indentation to the currently active engine.
/// </remarks>
+ [Obsolete]
class CacheIndentEngine : IDocumentIndentEngine
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/ShowTextMateScopesHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/ShowTextMateScopesHandler.cs
index 11906d5d09..294ee455e5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/ShowTextMateScopesHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/ShowTextMateScopesHandler.cs
@@ -1,4 +1,4 @@
-//
+//
// ShowTextMateScopesHandler.cs
//
// Author:
@@ -34,6 +34,7 @@ using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
class ShowTextMateScopesHandler : CommandHandler
{
protected override void Run ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateBundleOptionsPanelWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateBundleOptionsPanelWidget.cs
index e36e096565..0c1d726aa9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateBundleOptionsPanelWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateBundleOptionsPanelWidget.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMateBundleOptionsPanelWidget.cs
//
// Author:
@@ -89,11 +89,13 @@ namespace MonoDevelop.Ide.Editor.TextMate
}
if (success) {
var bundle = SyntaxHighlightingService.LoadStyleOrMode (SyntaxHighlightingService.userThemeBundle, newFileName) as LanguageBundle;
- if (bundle != null) {
- foreach (var h in bundle.Highlightings) {
+ if (bundle != null) {
+#pragma warning disable CS0618 // Type or member is obsolete
+ foreach (var h in bundle.Highlightings) {
var def = h as SyntaxHighlightingDefinition;
def?.PrepareMatches ();
}
+#pragma warning restore CS0618 // Type or member is obsolete
FillBundles ();
} else {
MessageService.ShowError (GettextCatalog.GetString ("Invalid bundle: {0}", dialog.SelectedFile.FileName));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateCompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateCompletionTextEditorExtension.cs
index cd7c7da16d..42b9b76ee7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateCompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateCompletionTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMateCompletionTextEditorExtension.cs
//
// Author:
@@ -37,6 +37,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
class TextMateCompletionTextEditorExtension : CompletionTextEditorExtension
{
bool inactive;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateDocumentIndentEngine.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateDocumentIndentEngine.cs
index 81b640cd49..358d837266 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateDocumentIndentEngine.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateDocumentIndentEngine.cs
@@ -32,6 +32,7 @@ using System.Threading;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
class TextMateDocumentIndentEngine : IDocumentIndentEngine
{
readonly TextEditor editor;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateFoldingTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateFoldingTextEditorExtension.cs
index 0fec0f30a3..5d7626b050 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateFoldingTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateFoldingTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMateFoldingTextEditorExtension.cs
//
// Author:
@@ -36,6 +36,7 @@ using MonoDevelop.Ide.Editor.Highlighting.RegexEngine;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
class TextMateFoldingTextEditorExtension : TextEditorExtension
{
Regex foldingStartMarker, foldingStopMarker;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTextEditorExtension.cs
index fa98a7570c..5e314fc8c5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMateIndentationTextEditorExtension.cs
//
// Author:
@@ -28,6 +28,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public class TextMateIndentationTextEditorExtension : TextEditorExtension
{
protected override void Initialize ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTracker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTracker.cs
index ab2452d540..0d7d9dc9cf 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTracker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateIndentationTracker.cs
@@ -31,6 +31,7 @@ using MonoDevelop.Ide.Editor.Highlighting.RegexEngine;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete]
class TextMateIndentationTracker : IndentationTracker
{
readonly TextEditor editor;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateLanguage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateLanguage.cs
index a91d784c9c..9102d6f880 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateLanguage.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.TextMate/TextMateLanguage.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMateLanguage.cs
//
// Author:
@@ -34,6 +34,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.TextMate
{
+ [Obsolete("Old editor")]
public class TextMateLanguage
{
readonly ScopeStack scope;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/Diff.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/Diff.cs
index 5fddc5cd20..6f8dd2d161 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/Diff.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/Diff.cs
@@ -102,6 +102,7 @@ namespace MonoDevelop.Ide.Editor.Util
/// <summary>
/// A DiffHunk represents a single change in a diff between two files.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public readonly struct DiffHunk : IEquatable<DiffHunk>
{
public static readonly DiffHunk Empty = new DiffHunk (0, 0, 0, 0);
@@ -194,6 +195,7 @@ namespace MonoDevelop.Ide.Editor.Util
}
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
sealed class Diff
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
index 769f3b6ea4..eaab3c7355 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
@@ -1,4 +1,4 @@
-//
+//
// SimpleBracketMatcher.cs
//
// Author:
@@ -33,6 +33,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Editor.Util
{
+ [Obsolete]
static class SimpleBracketMatcher
{
const string openBrackets = "([{<";
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleReadonlyDocument.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleReadonlyDocument.cs
index 0a48513af9..7b8338337d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleReadonlyDocument.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleReadonlyDocument.cs
@@ -1,4 +1,4 @@
-//
+//
// SimpleReadonlyDocument.cs
//
// Author:
@@ -35,6 +35,7 @@ namespace MonoDevelop.Ide.Editor.Util
/// <summary>
/// A simple and fast implementation for a read only text document.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class SimpleReadonlyDocument : IReadonlyTextDocument
{
readonly ITextSource textSource;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Commands/DynamicAbbrevHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Commands/DynamicAbbrevHandler.cs
index 08306da514..d57c5c3de6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Commands/DynamicAbbrevHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Commands/DynamicAbbrevHandler.cs
@@ -29,9 +29,11 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui;
using System.Collections.Generic;
using MonoDevelop.Ide;
-
+using System;
+
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete]
class DynamicAbbrevHandler : CommandHandler
{
enum AbbrevState {
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 746ddb8efe..e55bcba4dc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -1,4 +1,4 @@
-//
+//
// DefaultSourceEditorOptions.cs
//
// Author:
@@ -32,6 +32,9 @@ using Microsoft.VisualStudio.CodingConventions;
using System.Threading.Tasks;
using MonoDevelop.Ide.TypeSystem;
+using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.Components.Extensions;
+
namespace MonoDevelop.Ide.Editor
{
public enum WordNavigationStyle
@@ -184,8 +187,9 @@ namespace MonoDevelop.Ide.Editor
get {
return DefaultSourceEditorOptions.Instance.RemoveTrailingWhitespaces;
}
- }
-
+ }
+
+ [Obsolete ("Old editor")]
bool ITextEditorOptions.WrapLines {
get {
return DefaultSourceEditorOptions.Instance.WrapLines;
@@ -273,21 +277,29 @@ namespace MonoDevelop.Ide.Editor
});
IdeApp.Preferences.ColorScheme.Changed += OnColorSchemeChanged;
+ IdeApp.Preferences.Editor.FollowCodingConventions.Changed += OnFollowCodingConventionsChanged;
+ }
+
+ void OnFollowCodingConventionsChanged (object sender, EventArgs e)
+ {
+ UpdateContextOptions (null, null).Ignore ();
}
+
void UpdateFont ()
{
this.OnChanged (EventArgs.Empty);
}
+ TextStylePolicy currentPolicy;
internal void UpdateStylePolicy (MonoDevelop.Ide.Gui.Content.TextStylePolicy currentPolicy)
{
- defaultEolMarker = TextStylePolicy.GetEolMarker (currentPolicy.EolMarker);
- tabsToSpaces = currentPolicy.TabsToSpaces; // PropertyService.Get ("TabsToSpaces", false);
- indentationSize = currentPolicy.TabWidth; //PropertyService.Get ("TabIndent", 4);
- rulerColumn = currentPolicy.FileWidth; //PropertyService.Get ("RulerColumn", 80);
+ if (currentPolicy == this.currentPolicy)
+ return;
+ this.currentPolicy = currentPolicy;
+ rulerColumn = currentPolicy.FileWidth; //PropertyService.Get ("RulerColumn", 80);
allowTabsAfterNonTabs = !currentPolicy.NoTabsAfterNonTabs; //PropertyService.Get ("AllowTabsAfterNonTabs", true);
- removeTrailingWhitespaces = currentPolicy.RemoveTrailingWhitespace; //PropertyService.Get ("RemoveTrailingWhitespaces", true);
+ OnChanged (EventArgs.Empty);
}
internal DefaultSourceEditorOptions Create ()
@@ -315,7 +327,7 @@ namespace MonoDevelop.Ide.Editor
this.context.CodingConventionsChangedAsync -= UpdateContextOptions;
this.context = context;
context.CodingConventionsChangedAsync += UpdateContextOptions;
- UpdateContextOptions (null, null);
+ UpdateContextOptions (null, null).Ignore ();
}
private Task UpdateContextOptions (object sender, CodingConventionsChangedEventArgs arg)
@@ -323,29 +335,31 @@ namespace MonoDevelop.Ide.Editor
if (context == null)
return Task.FromResult (false);
+ bool followCodingConventions = IdeApp.Preferences.Editor.FollowCodingConventions;
+
defaultEolMarkerFromContext = null;
- if (context.CurrentConventions.UniversalConventions.TryGetLineEnding (out string eolMarker))
+ if (followCodingConventions && context.CurrentConventions.UniversalConventions.TryGetLineEnding (out string eolMarker))
defaultEolMarkerFromContext = eolMarker;
tabsToSpacesFromContext = null;
- if (context.CurrentConventions.UniversalConventions.TryGetIndentStyle (out Microsoft.VisualStudio.CodingConventions.IndentStyle result))
+ if (followCodingConventions && context.CurrentConventions.UniversalConventions.TryGetIndentStyle (out Microsoft.VisualStudio.CodingConventions.IndentStyle result))
tabsToSpacesFromContext = result == Microsoft.VisualStudio.CodingConventions.IndentStyle.Spaces;
indentationSizeFromContext = null;
- if (context.CurrentConventions.UniversalConventions.TryGetIndentSize (out int indentSize))
+ if (followCodingConventions && context.CurrentConventions.UniversalConventions.TryGetIndentSize (out int indentSize))
indentationSizeFromContext = indentSize;
removeTrailingWhitespacesFromContext = null;
- if (context.CurrentConventions.UniversalConventions.TryGetAllowTrailingWhitespace (out bool allowTrailing))
+ if (followCodingConventions && context.CurrentConventions.UniversalConventions.TryGetAllowTrailingWhitespace (out bool allowTrailing))
removeTrailingWhitespacesFromContext = !allowTrailing;
tabSizeFromContext = null;
- if (context.CurrentConventions.UniversalConventions.TryGetTabWidth (out int tSize))
+ if (followCodingConventions && context.CurrentConventions.UniversalConventions.TryGetTabWidth (out int tSize))
tabSizeFromContext = tSize;
rulerColumnFromContext = null;
showRulerFromContext = null;
- if (context.CurrentConventions.TryGetConventionValue<string> (EditorConfigService.MaxLineLengthConvention, out string maxLineLength)) {
+ if (followCodingConventions && context.CurrentConventions.TryGetConventionValue<string> (EditorConfigService.MaxLineLengthConvention, out string maxLineLength)) {
if (maxLineLength != "off" && int.TryParse (maxLineLength, out int i)) {
rulerColumnFromContext = i;
showRulerFromContext = true;
@@ -364,6 +378,7 @@ namespace MonoDevelop.Ide.Editor
set { IdeApp.Preferences.EnableAutoCodeCompletion.Set (value); }
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> defaultRegionsFolding = ConfigurationProperty.Create ("DefaultRegionsFolding", false);
public bool DefaultRegionsFolding {
get {
@@ -374,7 +389,8 @@ namespace MonoDevelop.Ide.Editor
OnChanged (EventArgs.Empty);
}
}
-
+
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> defaultCommentFolding = ConfigurationProperty.Create ("DefaultCommentFolding", true);
public bool DefaultCommentFolding {
get {
@@ -386,6 +402,52 @@ namespace MonoDevelop.Ide.Editor
}
}
+ ConfigurationProperty<bool> enableNewEditor = ConfigurationProperty.Create ("EnableNewEditor", false);
+ public bool EnableNewEditor {
+ get {
+ return enableNewEditor;
+ }
+ set {
+ if (!enableNewEditor.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.CloseAllDocumentsAsync (false);
+ });
+ }
+
+ OnChanged (EventArgs.Empty);
+ }
+ }
+
+
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> enableSemanticHighlighting = ConfigurationProperty.Create ("EnableSemanticHighlighting", true);
public bool EnableSemanticHighlighting {
get {
@@ -397,6 +459,8 @@ namespace MonoDevelop.Ide.Editor
}
}
+
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> tabIsReindent = ConfigurationProperty.Create ("TabIsReindent", false);
public bool TabIsReindent {
get {
@@ -408,7 +472,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- ConfigurationProperty<bool> autoInsertMatchingBracket = ConfigurationProperty.Create ("AutoInsertMatchingBracket", true);
+ ConfigurationProperty<bool> autoInsertMatchingBracket = IdeApp.Preferences.Editor.EnableBraceCompletion;
public bool AutoInsertMatchingBracket {
get {
return autoInsertMatchingBracket;
@@ -419,6 +483,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> smartSemicolonPlacement = ConfigurationProperty.Create ("SmartSemicolonPlacement", false);
public bool SmartSemicolonPlacement {
get {
@@ -430,6 +495,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<IndentStyle> indentStyle = ConfigurationProperty.Create ("IndentStyle", IndentStyle.Smart);
public IndentStyle IndentStyle {
get {
@@ -441,6 +507,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> enableHighlightUsages = ConfigurationProperty.Create ("EnableHighlightUsages", true);
public bool EnableHighlightUsages {
get {
@@ -451,7 +518,8 @@ namespace MonoDevelop.Ide.Editor
OnChanged (EventArgs.Empty);
}
}
-
+
+ // TODO: Windows equivalent?
ConfigurationProperty<LineEndingConversion> lineEndingConversion = ConfigurationProperty.Create ("LineEndingConversion", LineEndingConversion.LeaveAsIs);
public LineEndingConversion LineEndingConversion {
get {
@@ -463,6 +531,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> showProcedureLineSeparators = ConfigurationProperty.Create ("ShowProcedureLineSeparators", false);
public bool ShowProcedureLineSeparators {
get {
@@ -487,21 +556,29 @@ namespace MonoDevelop.Ide.Editor
}
#region ITextEditorOptions
- string defaultEolMarker = Environment.NewLine;
+ ConfigurationProperty<string> defaultEolMarker = IdeApp.Preferences.Editor.NewLineCharacter;
string defaultEolMarkerFromContext = null;
+ string overrridenDefaultEolMarker = null;
+ // TODO: This isn't surfaced in properties, only policies. We have no UI for it.
public string DefaultEolMarker {
get {
- return defaultEolMarkerFromContext ?? defaultEolMarker;
+ if (overrridenDefaultEolMarker != null)
+ return overrridenDefaultEolMarker;
+ if (defaultEolMarkerFromContext != null)
+ return defaultEolMarkerFromContext;
+ if (currentPolicy != null)
+ return TextStylePolicy.GetEolMarker (currentPolicy.EolMarker);
+ return defaultEolMarker;
}
set {
- if (defaultEolMarker != value) {
- defaultEolMarker = value;
+ overrridenDefaultEolMarker = value;
+ if (defaultEolMarker.Set (value))
OnChanged (EventArgs.Empty);
- }
}
}
-
+
+ // TODO: Windows equivalent?
ConfigurationProperty<WordNavigationStyle> wordNavigationStyle;
public WordNavigationStyle WordNavigationStyle {
get {
@@ -526,7 +603,8 @@ namespace MonoDevelop.Ide.Editor
throw new System.NotImplementedException ();
}
}
-
+
+ // TODO: Windows equivalent?
bool allowTabsAfterNonTabs = true;
public bool AllowTabsAfterNonTabs {
get {
@@ -541,70 +619,94 @@ namespace MonoDevelop.Ide.Editor
}
}
- bool tabsToSpaces = true;
+ ConfigurationProperty<bool> tabsToSpaces = IdeApp.Preferences.Editor.ConvertTabsToSpaces;
bool? tabsToSpacesFromContext;
+ bool? overriddenTabsToSpaces;
public bool TabsToSpaces {
get {
- return tabsToSpacesFromContext ?? tabsToSpaces;
+ if (overriddenTabsToSpaces.HasValue)
+ return overriddenTabsToSpaces.Value;
+ if (tabsToSpacesFromContext.HasValue)
+ return tabsToSpacesFromContext.Value;
+ if (currentPolicy != null)
+ return currentPolicy.TabsToSpaces;
+ return tabsToSpaces;
}
set {
- if (tabsToSpaces != value) {
- PropertyService.Set ("TabsToSpaces", value);
- tabsToSpaces = value;
+ overriddenTabsToSpaces = value;
+ if (tabsToSpaces.Set (value))
OnChanged (EventArgs.Empty);
- }
}
}
-
- int indentationSize = 4;
+
+ ConfigurationProperty<int> indentationSize = IdeApp.Preferences.Editor.IndentSize;
int? indentationSizeFromContext;
+ int? overriddenIndentationSize;
public int IndentationSize {
get {
+ if (overriddenIndentationSize.HasValue)
+ return overriddenIndentationSize.Value;
+ if (indentationSizeFromContext.HasValue)
+ return indentationSizeFromContext.Value;
+ if (currentPolicy != null)
+ return currentPolicy.IndentWidth; //PropertyService.Get ("IndentWidth", 4);
return indentationSizeFromContext ?? indentationSize;
}
set {
- if (indentationSize != value) {
- PropertyService.Set ("TabIndent", value);
- indentationSize = value;
+ overriddenIndentationSize = value;
+ if (indentationSize.Set (value))
OnChanged (EventArgs.Empty);
- }
}
}
-
public string IndentationString {
get {
return TabsToSpaces ? new string (' ', this.TabSize) : "\t";
}
}
+ ConfigurationProperty<int> tabSize = IdeApp.Preferences.Editor.TabSize;
int? tabSizeFromContext;
+ int? overriddenTabSize;
public int TabSize {
get {
- return tabSizeFromContext ?? IndentationSize;
+ if (overriddenTabSize.HasValue)
+ return overriddenTabSize.Value;
+ if (tabSizeFromContext.HasValue)
+ return tabSizeFromContext.Value;
+ if (currentPolicy != null)
+ return currentPolicy.TabWidth; //PropertyService.Get ("IndentWidth", 4);
+ return tabSize;
}
set {
- IndentationSize = value;
+ overriddenTabSize = value;
+ if (tabSize.Set (value))
+ OnChanged (EventArgs.Empty);
}
}
- bool removeTrailingWhitespaces = true;
+ ConfigurationProperty<bool> trimTrailingWhitespace = IdeApp.Preferences.Editor.TrimTrailingWhitespace;
bool? removeTrailingWhitespacesFromContext;
+ bool? overriddenRemoveTrailingWhitespacesFromContext;
public bool RemoveTrailingWhitespaces {
get {
- return removeTrailingWhitespacesFromContext ?? removeTrailingWhitespaces;
+ if (overriddenRemoveTrailingWhitespacesFromContext.HasValue)
+ return overriddenRemoveTrailingWhitespacesFromContext.Value;
+ if (removeTrailingWhitespacesFromContext.HasValue)
+ return removeTrailingWhitespacesFromContext.Value;
+ if (currentPolicy != null)
+ return currentPolicy.RemoveTrailingWhitespace;
+ return trimTrailingWhitespace;
}
set {
- if (removeTrailingWhitespaces != value) {
- PropertyService.Set ("RemoveTrailingWhitespaces", value);
+ overriddenRemoveTrailingWhitespacesFromContext = value;
+ if (trimTrailingWhitespace.Set(value))
OnChanged (EventArgs.Empty);
- removeTrailingWhitespaces = value;
- }
}
}
-
- ConfigurationProperty<bool> showLineNumberMargin = ConfigurationProperty.Create ("ShowLineNumberMargin", true);
+
+ ConfigurationProperty<bool> showLineNumberMargin = IdeApp.Preferences.Editor.ShowLineNumberMargin;
public bool ShowLineNumberMargin {
get {
return showLineNumberMargin;
@@ -615,32 +717,29 @@ namespace MonoDevelop.Ide.Editor
}
}
- ConfigurationProperty<bool> hideFoldMargin = ConfigurationProperty.Create ("HideFoldMargin", false);
+ ConfigurationProperty<bool> showFoldMargin = IdeApp.Preferences.Editor.ShowOutliningMargin;
public bool ShowFoldMargin {
get {
- return !hideFoldMargin;
+ return showFoldMargin;
}
set {
- if (hideFoldMargin.Set (!value))
+ if (showFoldMargin.Set (value))
OnChanged (EventArgs.Empty);
}
}
-
- bool showIconMargin = true;
+
+ ConfigurationProperty<bool> showIconMargin = IdeApp.Preferences.Editor.ShowGlyphMargin;
public bool ShowIconMargin {
get {
return showIconMargin;
}
set {
- if (showIconMargin != value) {
- PropertyService.Set ("ShowIconMargin", value);
- showIconMargin = value;
+ if (showIconMargin.Set (value))
OnChanged (EventArgs.Empty);
- }
}
}
-
- ConfigurationProperty<bool> highlightCaretLine = ConfigurationProperty.Create ("HighlightCaretLine", false);
+
+ ConfigurationProperty<bool> highlightCaretLine = IdeApp.Preferences.Editor.EnableHighlightCurrentLine;
public bool HighlightCaretLine {
get {
return highlightCaretLine;
@@ -651,6 +750,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> enableSyntaxHighlighting = ConfigurationProperty.Create ("EnableSyntaxHighlighting", true);
public bool EnableSyntaxHighlighting {
get {
@@ -662,7 +762,7 @@ namespace MonoDevelop.Ide.Editor
}
}
- internal ConfigurationProperty<bool> highlightMatchingBracket = ConfigurationProperty.Create ("HighlightMatchingBracket", true);
+ internal ConfigurationProperty<bool> highlightMatchingBracket = IdeApp.Preferences.Editor.EnableHighlightDelimiter;
public bool HighlightMatchingBracket {
get {
return highlightMatchingBracket;
@@ -677,6 +777,7 @@ namespace MonoDevelop.Ide.Editor
int? rulerColumnFromContext;
+ // TODO: VS equivalent?
public int RulerColumn {
get {
return rulerColumnFromContext ?? rulerColumn;
@@ -689,7 +790,8 @@ namespace MonoDevelop.Ide.Editor
}
}
}
-
+
+ // TODO: VS equivalent?
ConfigurationProperty<bool> showRuler = ConfigurationProperty.Create ("ShowRuler", true);
bool? showRulerFromContext;
public bool ShowRuler {
@@ -702,6 +804,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: ???
ConfigurationProperty<bool> enableAnimations = ConfigurationProperty.Create ("EnableAnimations", true);
public bool EnableAnimations {
get {
@@ -712,8 +815,8 @@ namespace MonoDevelop.Ide.Editor
OnChanged (EventArgs.Empty);
}
}
-
- ConfigurationProperty<bool> drawIndentationMarkers = ConfigurationProperty.Create ("DrawIndentationMarkers", false);
+
+ ConfigurationProperty<bool> drawIndentationMarkers = IdeApp.Preferences.Editor.ShowBlockStructure;
public bool DrawIndentationMarkers {
get {
return drawIndentationMarkers;
@@ -724,18 +827,19 @@ namespace MonoDevelop.Ide.Editor
}
}
- ConfigurationProperty<bool> wrapLines = ConfigurationProperty.Create ("WrapLines", false);
- public bool WrapLines {
- get {
- return wrapLines;
- }
+ [Obsolete ("Deprecated - use WordWrapStyle")]
+ public bool WrapLines => false;
+
+ ConfigurationProperty<WordWrapStyles> wordWrapStyle = IdeApp.Preferences.Editor.WordWrapStyle;
+ public WordWrapStyles WordWrapStyle {
+ get => wordWrapStyle;
set {
- if (wrapLines.Set (value))
+ if (wordWrapStyle.Set (value))
OnChanged (EventArgs.Empty);
}
}
- ConfigurationProperty<bool> enableQuickDiff = ConfigurationProperty.Create ("EnableQuickDiff", false);
+ ConfigurationProperty<bool> enableQuickDiff = IdeApp.Preferences.Editor.ShowChangeTrackingMargin;
public bool EnableQuickDiff {
get {
return enableQuickDiff;
@@ -746,6 +850,20 @@ namespace MonoDevelop.Ide.Editor
}
}
+
+#if !WINDOWS
+ readonly ConfigurationProperty<bool> shouldMoveCaretOnSelectAll = IdeApp.Preferences.Editor.ShouldMoveCaretOnSelectAll;
+#else
+ readonly ConfigurationProperty<bool> shouldMoveCaretOnSelectAll = ConfigurationProperty.Create (nameof (ShouldMoveCaretOnSelectAll), false);
+#endif
+ public bool ShouldMoveCaretOnSelectAll {
+ get => shouldMoveCaretOnSelectAll;
+ set {
+ if (shouldMoveCaretOnSelectAll.Set (value))
+ OnChanged (EventArgs.Empty);
+ }
+ }
+
public string FontName {
get {
return IdeServices.FontService.FilterFontName (IdeServices.FontService.GetUnderlyingFontName ("Editor"));
@@ -778,8 +896,8 @@ namespace MonoDevelop.Ide.Editor
{
OnChanged (EventArgs.Empty);
}
-
- ConfigurationProperty<bool> generateFormattingUndoStep = ConfigurationProperty.Create ("GenerateFormattingUndoStep", true);
+
+ ConfigurationProperty<bool> generateFormattingUndoStep = IdeApp.Preferences.Editor.OutliningUndoStep;
public bool GenerateFormattingUndoStep {
get {
return generateFormattingUndoStep;
@@ -814,7 +932,14 @@ namespace MonoDevelop.Ide.Editor
}
}
+#if !WINDOWS
+ ConfigurationProperty<ShowWhitespaces> showWhitespaces = IdeApp.Preferences.Editor.ShowWhitespaces;
+ ConfigurationProperty<IncludeWhitespaces> includeWhitespaces = IdeApp.Preferences.Editor.IncludeWhitespaces;
+#else
ConfigurationProperty<ShowWhitespaces> showWhitespaces = ConfigurationProperty.Create ("ShowWhitespaces", ShowWhitespaces.Never);
+ ConfigurationProperty<IncludeWhitespaces> includeWhitespaces = ConfigurationProperty.Create ("IncludeWhitespaces", IncludeWhitespaces.All);
+#endif
+
public ShowWhitespaces ShowWhitespaces {
get {
return showWhitespaces;
@@ -825,7 +950,6 @@ namespace MonoDevelop.Ide.Editor
}
}
- ConfigurationProperty<IncludeWhitespaces> includeWhitespaces = ConfigurationProperty.Create ("IncludeWhitespaces", IncludeWhitespaces.All);
public IncludeWhitespaces IncludeWhitespaces {
get {
return includeWhitespaces;
@@ -836,6 +960,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ // TODO: Windows equivalent?
ConfigurationProperty<bool> smartBackspace = ConfigurationProperty.Create ("SmartBackspace", true);
public bool SmartBackspace{
get {
@@ -853,17 +978,31 @@ namespace MonoDevelop.Ide.Editor
{
IdeServices.FontService.RemoveCallback (UpdateFont);
IdeApp.Preferences.ColorScheme.Changed -= OnColorSchemeChanged;
+ IdeApp.Preferences.Editor.FollowCodingConventions.Changed -= OnFollowCodingConventionsChanged;
if (context != null)
context.CodingConventionsChangedAsync -= UpdateContextOptions;
}
- protected void OnChanged (EventArgs args)
+ void OnChanged (EventArgs args)
{
- if (Changed != null)
- Changed (null, args);
+ Changed?.Invoke (null, args);
}
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);
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
index 3ba5fc2762..e0f49914fc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentContext.cs
@@ -1,4 +1,4 @@
-//
+//
// DocumentContext.cs
//
// Author:
@@ -89,39 +89,45 @@ namespace MonoDevelop.Ide.Editor
return MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<T> (types);
}
+ [Obsolete ("Use Roslyn directly")]
public Microsoft.CodeAnalysis.Workspace RoslynWorkspace
{
get { return IdeApp.TypeSystemService.GetWorkspace (workspaceId); }
protected set { workspaceId = ((MonoDevelopWorkspace)value).Id; }
- }
-
+ }
+
/// <summary>
/// Returns the roslyn document for this document. This may return <c>null</c> if it's no compileable document.
/// Even if it's a C# file. Is always not <c>null</c> when the parser returns <c>true</c> on CanGenerateAnalysisDocument.
/// </summary>
+ [Obsolete ("Use Roslyn directly")]
public abstract Microsoft.CodeAnalysis.Document AnalysisDocument
{
get;
}
+ [Obsolete ("Use Roslyn directly")]
public event EventHandler AnalysisDocumentChanged;
+ [Obsolete ("Use Roslyn directly")]
protected virtual void OnAnalysisDocumentChanged (global::System.EventArgs e)
{
AnalysisDocumentChanged?.Invoke (this, e);
- }
-
+ }
+
/// <summary>
/// The parsed document. Contains all syntax information about the text.
/// </summary>
+ [Obsolete ("Use Visual Studio Editor APIs")]
public abstract ParsedDocument ParsedDocument
{
get;
- }
-
+ }
+
/// <summary>
/// If true, the document is part of the ProjectContent.
/// </summary>
+ [Obsolete ("Use Visual Studio Editor APIs")]
public virtual bool IsCompileableInProject
{
get
@@ -143,13 +149,15 @@ namespace MonoDevelop.Ide.Editor
var t = this as T;
if (t != null)
yield return t;
- }
-
+ }
+
/// <summary>
/// This is called after the ParsedDocument updated.
/// </summary>
+ [Obsolete ("Use Visual Studio Editor APIs")]
public event EventHandler DocumentParsed;
+ [Obsolete ("Use Visual Studio Editor APIs")]
protected void OnDocumentParsed (EventArgs e)
{
var handler = DocumentParsed;
@@ -157,16 +165,18 @@ namespace MonoDevelop.Ide.Editor
handler (this, e);
}
- public abstract void AttachToProject (Project project);
-
+ public abstract void AttachToProject (Project project);
+
/// <summary>
/// Forces a reparse of the document. This call doesn't block the ui thread.
/// The next call to ParsedDocument will give always the current parsed document but may block the UI thread.
/// </summary>
+ [Obsolete ("Use Visual Studio Editor APIs")]
public abstract void ReparseDocument ();
public abstract OptionSet GetOptionSet ();
+ [Obsolete ("Use Visual Studio Editor APIs")]
public abstract Task<ParsedDocument> UpdateParseDocument ();
public event EventHandler Saved;
@@ -178,11 +188,13 @@ namespace MonoDevelop.Ide.Editor
handler (this, e);
}
+ [Obsolete]
internal virtual Task<IReadOnlyList<Editor.Projection.Projection>> GetPartialProjectionsAsync (CancellationToken cancellationToken = default(CancellationToken))
{
return null;
}
+ [Obsolete]
internal virtual void UpdateDocumentId (Microsoft.CodeAnalysis.DocumentId newId)
{
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentRegion.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentRegion.cs
index d6a6f405e6..bfa748adf2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentRegion.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentRegion.cs
@@ -32,6 +32,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// An (Begin, End) pair representing a document span. It's a TextSegment working with lines &amp; columns instead of offsets.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public readonly struct DocumentRegion : IEquatable<DocumentRegion>
{
public static readonly DocumentRegion Empty = new DocumentRegion (0, 0, 0, 0);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
index 5dcee5b563..ced77ae9cb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditActions.cs
@@ -1,4 +1,4 @@
-//
+//
// EditActions.cs
//
// Author:
@@ -29,10 +29,11 @@ using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Editor.Util;
namespace MonoDevelop.Ide.Editor
-{
+{
/// <summary>
/// This class contains some common actions for the text editor.
/// </summary>
+ [Obsolete("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class EditActions
{
public static void MoveCaretDown (TextEditor editor)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditSession.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditSession.cs
index ceb6029287..e91532b945 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditSession.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditSession.cs
@@ -1,4 +1,4 @@
-//
+//
// EditSession.cs
//
// Author:
@@ -29,7 +29,8 @@ using MonoDevelop.Ide.Editor.Highlighting;
using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor
-{
+{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public abstract class EditSession : IDisposable
{
private TextEditor editor;
@@ -136,6 +137,7 @@ namespace MonoDevelop.Ide.Editor
}
+ [Obsolete]
abstract class PairInsertEditSession : EditSession
{
IGenericTextSegmentMarker marker;
@@ -200,6 +202,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// Reassembles the old skip char system - shouldn't be used by new features anymore.
/// </summary>
+ [Obsolete ("Use Visual Studio Editor APIs")]
class SkipCharSession : PairInsertEditSession
{
readonly char ch;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorConfigService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorConfigService.cs
index ed8b11718e..975c0b1531 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorConfigService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorConfigService.cs
@@ -1,4 +1,4 @@
-//
+//
// EditorConfigService.cs
//
// Author:
@@ -83,16 +83,18 @@ namespace MonoDevelop.Ide.Editor
}
}
- public static async Task RemoveEditConfigContext (string fileName)
+ public static Task RemoveEditConfigContext (string fileName)
{
- ICodingConventionContext ctx;
- lock (contextCacheLock) {
- if (!contextCache.TryGetValue (fileName, out ctx))
- return;
- contextCache = contextCache.Remove(fileName);
- }
- if (ctx != null)
- ctx.Dispose ();
+ return Task.Run (() => {
+ ICodingConventionContext ctx;
+ lock (contextCacheLock) {
+ if (!contextCache.TryGetValue (fileName, out ctx))
+ return;
+ contextCache = contextCache.Remove (fileName);
+ }
+ if (ctx != null)
+ ctx.Dispose ();
+ });
}
class ConventionsFileManager : IFileWatcher
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorPreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorPreferences.cs
new file mode 100644
index 0000000000..e7de100b4b
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/EditorPreferences.cs
@@ -0,0 +1,321 @@
+//
+// EditorPreferences.cs
+//
+// Author:
+// Marius Ungureanu <maungu@microsoft.com>
+//
+// Copyright (c) 2019 Microsoft Inc.
+//
+// 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 System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion;
+using Microsoft.VisualStudio.Text.Editor;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Composition;
+
+namespace MonoDevelop.Ide.Editor
+{
+ public class EditorPreferences
+ {
+ readonly Dictionary<string, Action<object>> EditorToIdeMapping = new Dictionary<string, Action<object>> ();
+ readonly Dictionary<string, string> IdeToEditorMapping = new Dictionary<string, string> ();
+
+ readonly IEditorOptionsFactoryService2 factoryService;
+ readonly IEditorOptions globalOptions;
+
+ #region Mapped Editor Options
+ public readonly ConfigurationProperty<bool> ConvertTabsToSpaces;
+ public readonly ConfigurationProperty<bool> EnableBraceCompletion;
+ public readonly ConfigurationProperty<bool> EnableCompletionSuggestionMode;
+ public readonly ConfigurationProperty<bool> EnableHighlightCurrentLine;
+ public readonly ConfigurationProperty<bool> EnableHighlightDelimiter;
+ public readonly ConfigurationProperty<bool> FollowCodingConventions; // TODO: Needs UI
+ public readonly ConfigurationProperty<int> IndentSize;
+ public readonly ConfigurationProperty<string> NewLineCharacter; // TODO: Needs UI
+ public readonly ConfigurationProperty<bool> OutliningUndoStep;
+ public readonly ConfigurationProperty<bool> ShowChangeTrackingMargin;
+ public readonly ConfigurationProperty<bool> ShowGlyphMargin;
+ public readonly ConfigurationProperty<bool> ShowLineNumberMargin;
+ public readonly ConfigurationProperty<bool> ShowOutliningMargin;
+ public readonly ConfigurationProperty<int> TabSize;
+ public readonly ConfigurationProperty<bool> TrimTrailingWhitespace;
+ public readonly ConfigurationProperty<WordWrapStyles> WordWrapStyle;
+#if !WINDOWS
+ public readonly ConfigurationProperty<ShowWhitespaces> ShowWhitespaces;
+ public readonly ConfigurationProperty<IncludeWhitespaces> IncludeWhitespaces;
+ public readonly ConfigurationProperty<bool> ShouldMoveCaretOnSelectAll;
+#endif
+ public readonly ConfigurationProperty<bool> ShowBlockStructure;
+ // TODO: Maybe per language preferences?
+ #endregion
+
+ internal EditorPreferences ()
+ {
+ factoryService = CompositionManager.GetExportedValue<IEditorOptionsFactoryService2> ();
+ globalOptions = factoryService.GlobalOptions;
+
+ PropertyService.PropertyChanged += PropertyService_PropertyChanged;
+ globalOptions.OptionChanged += GlobalOptions_OptionChanged;
+
+ Migrate ("HideLineNumberMargin", "ShowLineNumberMargin", Flip);
+
+ // Prefered to write in code rather than extension to use actual string constants
+ ConvertTabsToSpaces = Wrap<bool> ("TabsToSpaces", DefaultOptions.ConvertTabsToSpacesOptionName);
+ EnableBraceCompletion = Wrap<bool> ("AutoInsertMatchingBracket", DefaultTextViewOptions.BraceCompletionEnabledOptionName);
+ EnableCompletionSuggestionMode = Map<bool> ("ForceCompletionSuggestionMode", PredefinedCompletionNames.SuggestionModeInCompletionOptionName, IdeApp.Preferences.ForceSuggestionMode);
+ // have to use literal because it's in different types on different platforms (DefaultTextViewOptions vs. DefaultWpfViewOptions)
+ EnableHighlightCurrentLine = Wrap ("HighlightCaretLine", "Adornments/HighlightCurrentLine/Enable", false);
+ EnableHighlightDelimiter = Wrap<bool> ("HighlightMatchingBracket", DefaultOptions.AutomaticDelimiterHighlightingName);
+ FollowCodingConventions = Wrap<bool> ("FollowCodingConventions", DefaultOptions.FollowCodingConventionsName);
+ IndentSize = Wrap<int> ("TabIndent", DefaultOptions.IndentSizeOptionName);
+ NewLineCharacter = Wrap<string> ("NewLineCharacter", DefaultOptions.NewLineCharacterOptionName, Environment.NewLine);
+ OutliningUndoStep = Wrap<bool> ("GenerateFormattingUndoStep", DefaultTextViewOptions.OutliningUndoOptionName);
+ ShowChangeTrackingMargin = Wrap ("EnableQuickDiff", DefaultTextViewHostOptions.ChangeTrackingName, false);
+ ShowGlyphMargin = Wrap<bool> ("ShowGlyphMargin", DefaultTextViewHostOptions.GlyphMarginName);
+ ShowLineNumberMargin = Wrap<bool> ("ShowLineNumberMargin", DefaultTextViewHostOptions.LineNumberMarginName);
+ ShowOutliningMargin = Wrap<bool> ("ShowFoldMargin", DefaultTextViewHostOptions.OutliningMarginName);
+ TrimTrailingWhitespace = Wrap ("RemoveTrailingWhitespaces", DefaultOptions.TrimTrailingWhiteSpaceOptionName, true);
+ // UseVirtualSpace should be a combination of IndentStyle == MonoDevelop.Ide.Editor.IndentStyle.Smart && RemoveTrailingWhitespaces
+ WordWrapStyle = Wrap<WordWrapStyles> ("WordWrapStyle", DefaultTextViewOptions.WordWrapStyleName);
+ TabSize = Wrap<int> ("TabSize", DefaultOptions.TabSizeOptionName);
+#if !WINDOWS
+ ShowWhitespaces = new ShowWhitespacesProperty (this);
+ IncludeWhitespaces = new IncludeWhitespacesProperty (this);
+ ShouldMoveCaretOnSelectAll = Wrap<bool> ("ShouldMoveCaretOnSelectAll", DefaultTextViewOptions.ShouldMoveCaretOnSelectAllName, false);
+#endif
+ ShowBlockStructure = Wrap<bool> ("ShowBlockStructure", DefaultTextViewOptions.ShowBlockStructureName);
+
+ LogNonMappedOptions ();
+ }
+
+ static Func<bool, bool> Flip = value => !value;
+
+ void Migrate<T> (string oldKey, string newKey, Func<T, T> transform = null)
+ {
+ // Check the old key
+ if (!PropertyService.HasValue (oldKey))
+ return;
+
+ // Migrate old to new if new doesn't exist and then unset the old one
+ if (!PropertyService.HasValue (newKey)) {
+ var value = PropertyService.Get<T> (oldKey);
+ if (transform != null)
+ value = transform (value);
+
+ PropertyService.Set (newKey, value);
+ }
+ PropertyService.Set (oldKey, null);
+
+ }
+
+
+ [Conditional ("DEBUG")]
+ void LogNonMappedOptions ()
+ {
+ foreach (var option in globalOptions.SupportedOptions) {
+ if (!EditorToIdeMapping.ContainsKey (option.Name)) {
+ LoggingService.LogDebug ("Unmapped editor command: {0}", option.Name);
+ }
+ }
+ }
+
+ #region Cross-service updating logic
+ void PropertyService_PropertyChanged (object sender, PropertyChangedEventArgs e)
+ {
+ if (IdeToEditorMapping.TryGetValue (e.Key, out var editorKey)) {
+ globalOptions.SetOptionValue (editorKey, e.NewValue);
+ }
+ }
+
+ void GlobalOptions_OptionChanged (object sender, EditorOptionChangedEventArgs e)
+ {
+ if (EditorToIdeMapping.TryGetValue (e.OptionId, out var updater)) {
+ updater (globalOptions.GetOptionValue (e.OptionId));
+ }
+ }
+ #endregion
+
+ #region Property creation logic
+ /// <summary>
+ /// Wrap the specified editor option using the editor default value
+ /// </summary>
+ /// <returns>The property.</returns>
+ /// <param name="name">The key in the IDE Properties.</param>
+ /// <param name="editorOptionId">Editor option identifier.</param>
+ /// <typeparam name="T">The option type.</typeparam>
+ internal ConfigurationProperty<T> Wrap<T> (string name, string editorOptionId)
+ {
+ var definition = factoryService.GetOptionDefinition (editorOptionId);
+ var defaultValue = (T)definition.DefaultValue;
+
+ return Create (name, editorOptionId, defaultValue);
+ }
+
+ /// <summary>
+ /// Wrap the specified editor option overwriting it's default value.
+ /// </summary>
+ /// <returns>The property.</returns>
+ /// <param name="name">The key in the IDE Properties.</param>
+ /// <param name="editorOptionId">Editor option identifier.</param>
+ /// <param name="defaultValue">Default value override.</param>
+ /// <typeparam name="T">The option type.</typeparam>
+ internal ConfigurationProperty<T> Wrap<T> (string name, string editorOptionId, T defaultValue)
+ {
+ return Create (name, editorOptionId, defaultValue);
+ }
+
+ ConfigurationProperty<T> Create<T> (string name, string editorOptionId, T defaultValue)
+ {
+ return Map (name, editorOptionId, ConfigurationProperty.Create (name, defaultValue));
+ }
+
+ ConfigurationProperty<T> Map<T> (string name, string editorOptionId, ConfigurationProperty<T> property)
+ {
+ IdeToEditorMapping.Add (name, editorOptionId);
+ EditorToIdeMapping.Add (editorOptionId, value => property.Value = (T)value);
+
+ // Set the editor options to override any editor option that we use.
+ globalOptions.SetOptionValue (editorOptionId, property.Value);
+
+ return property;
+ }
+
+#if !WINDOWS
+ class IncludeWhitespacesProperty : ConfigurationProperty<IncludeWhitespaces>
+ {
+ IncludeWhitespaces propertyValue;
+ const string propertyName = "IncludeWhitespaces";
+ readonly EditorPreferences editorPreferences;
+
+ public IncludeWhitespacesProperty (EditorPreferences editorPreferences)
+ {
+ this.editorPreferences = editorPreferences;
+ var definition = editorPreferences.factoryService.GetOptionDefinition (DefaultTextViewOptions.UseVisibleWhitespaceIncludeName);
+ propertyValue = PropertyService.Get (propertyName, Convert ((DefaultTextViewOptions.IncludeWhitespaces)definition.DefaultValue));
+ UpdateEditor (propertyValue);
+ editorPreferences.globalOptions.OptionChanged += GlobalOptions_OptionChanged;
+ }
+
+ private IncludeWhitespaces Convert (DefaultTextViewOptions.IncludeWhitespaces includeWhitespaces)
+ {
+ return (IncludeWhitespaces)(int)includeWhitespaces;
+ }
+
+ void GlobalOptions_OptionChanged (object sender, EditorOptionChangedEventArgs e)
+ {
+ if (e.OptionId == DefaultTextViewOptions.UseVisibleWhitespaceName) {
+ this.Set (Convert (editorPreferences.globalOptions.GetOptionValue<DefaultTextViewOptions.IncludeWhitespaces> (DefaultTextViewOptions.UseVisibleWhitespaceName)));
+ }
+ }
+
+ protected override IncludeWhitespaces OnGetValue ()
+ {
+ return propertyValue;
+ }
+
+ protected override bool OnSetValue (IncludeWhitespaces value)
+ {
+ if (this.propertyValue == value)
+ return false;
+ this.propertyValue = value;
+ PropertyService.Set (propertyName, value);
+ OnChanged ();
+ UpdateEditor (value);
+ return true;
+ }
+
+ private void UpdateEditor (IncludeWhitespaces value)
+ {
+ var val = (DefaultTextViewOptions.IncludeWhitespaces)(int)value;
+ if (val.HasFlag (DefaultTextViewOptions.IncludeWhitespaces.Spaces))
+ val |= DefaultTextViewOptions.IncludeWhitespaces.Ideographics;
+ editorPreferences.globalOptions.SetOptionValue (DefaultTextViewOptions.UseVisibleWhitespaceIncludeName, val);
+ }
+ }
+
+ class ShowWhitespacesProperty : ConfigurationProperty<ShowWhitespaces>
+ {
+ ShowWhitespaces value;
+ const string propertyName = "ShowWhitespaces";
+ readonly EditorPreferences editorPreferences;
+
+ public ShowWhitespacesProperty (EditorPreferences editorPreferences)
+ {
+ this.editorPreferences = editorPreferences;
+ var definitionEnabled = editorPreferences.factoryService.GetOptionDefinition (DefaultTextViewOptions.UseVisibleWhitespaceName);
+ var definitionSelection = editorPreferences.factoryService.GetOptionDefinition (DefaultTextViewOptions.UseVisibleWhitespaceOnlyWhenSelectedName);
+ value = PropertyService.Get (propertyName, Convert ((bool)definitionEnabled.DefaultValue, (bool)definitionSelection.DefaultValue));
+ UpdateEditor (value);
+ editorPreferences.globalOptions.OptionChanged += GlobalOptions_OptionChanged;
+ }
+
+ private ShowWhitespaces Convert (bool enable, bool selection)
+ {
+ if (enable)
+ if (selection)
+ return Editor.ShowWhitespaces.Selection;
+ else
+ return Editor.ShowWhitespaces.Always;
+ else
+ return Editor.ShowWhitespaces.Never;
+ }
+
+ void GlobalOptions_OptionChanged (object sender, EditorOptionChangedEventArgs e)
+ {
+ if (e.OptionId == DefaultTextViewOptions.UseVisibleWhitespaceName ||
+ e.OptionId == DefaultTextViewOptions.UseVisibleWhitespaceOnlyWhenSelectedName) {
+ if (editorPreferences.globalOptions.GetOptionValue<bool> (DefaultTextViewOptions.UseVisibleWhitespaceName)) {
+ if (editorPreferences.globalOptions.GetOptionValue<bool> (DefaultTextViewOptions.UseVisibleWhitespaceOnlyWhenSelectedName))
+ Set (Editor.ShowWhitespaces.Selection);
+ else
+ Set (Editor.ShowWhitespaces.Always);
+ } else {
+ Set (Editor.ShowWhitespaces.Never);
+ }
+ }
+ }
+
+ protected override ShowWhitespaces OnGetValue ()
+ {
+ return value;
+ }
+
+ protected override bool OnSetValue (ShowWhitespaces value)
+ {
+ if (this.value == value)
+ return false;
+ this.value = value;
+ PropertyService.Set (propertyName, value);
+ OnChanged ();
+ UpdateEditor (value);
+ return true;
+ }
+
+ private void UpdateEditor (ShowWhitespaces value)
+ {
+ editorPreferences.globalOptions.SetOptionValue (DefaultTextViewOptions.UseVisibleWhitespaceName, value != Editor.ShowWhitespaces.Never);
+ editorPreferences.globalOptions.SetOptionValue (DefaultTextViewOptions.UseVisibleWhitespaceOnlyWhenSelectedName, value == Editor.ShowWhitespaces.Selection);
+ }
+ }
+#endif
+ #endregion
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/FoldSegmentFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/FoldSegmentFactory.cs
index 468defb00f..9522f7e90c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/FoldSegmentFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/FoldSegmentFactory.cs
@@ -1,4 +1,4 @@
-//
+//
// FoldSegmentFactory.cs
//
// Author:
@@ -28,6 +28,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class FoldSegmentFactory
{
public static IFoldSegment CreateFoldSegment (TextEditor editor, int offset, int length, bool isCollapsed = false, string collapsedText = "...", FoldingType foldingType = FoldingType.Unknown)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
index 059599d9ed..9ead1ca7f8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IDocumentLine.cs
@@ -1,4 +1,4 @@
-//
+//
// IDocumentLine.cs
//
// Author:
@@ -33,6 +33,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// A line inside a <see cref="ITextDocument"/>.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public interface IDocumentLine : ISegment
{
/// <summary>
@@ -83,6 +84,7 @@ namespace MonoDevelop.Ide.Editor
IDocumentLine NextLine { get; }
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class DocumentLineExt
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IFoldSegment.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IFoldSegment.cs
index d1708faf36..65b9ba5b07 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IFoldSegment.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IFoldSegment.cs
@@ -1,4 +1,4 @@
-//
+//
// IFoldSegment.cs
//
// Author:
@@ -32,6 +32,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// Represents the origin for a fold segment
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public enum FoldingType {
Unknown,
Region,
@@ -43,6 +44,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// A fold segment represents a collapsible region inside the text editor.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public interface IFoldSegment : ISegment
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IReadonlyTextDocument.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IReadonlyTextDocument.cs
index eab7151462..4d4ad793e4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IReadonlyTextDocument.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IReadonlyTextDocument.cs
@@ -33,6 +33,7 @@ using MonoDevelop.Ide.Editor.Util;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public interface IReadonlyTextDocument : ITextSource
{
bool IsReadOnly { get; }
@@ -65,8 +66,9 @@ namespace MonoDevelop.Ide.Editor
IncludeEol = includeEol;
TrimLines = trimLines;
}
- }
-
+ }
+
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public static class ReadonlyTextDocumentExtensions
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextDocument.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextDocument.cs
index 96f9bc284b..44a03a61ff 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextDocument.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextDocument.cs
@@ -32,6 +32,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public interface ITextDocument : IReadonlyTextDocument
{
/// <summary>
@@ -108,6 +109,7 @@ namespace MonoDevelop.Ide.Editor
// event EventHandler<LineEventArgs> LineRemoved;
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public static class DocumentExtensions
{
public static void RemoveText (this ITextDocument document, ISegment segment)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorFactoryService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorFactoryService.cs
deleted file mode 100644
index 18425e55e4..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorFactoryService.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// 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.Editor
-{
- using System;
- using System.Collections.Generic;
- using Microsoft.VisualStudio.Text.Document;
-
- /// <summary>
- /// Creates editor views.
- /// </summary>
- /// <remarks>This is a MEF component part, and should be imported as follows:
- /// [Import]
- /// ITextEditorFactoryService factory = null;
- /// </remarks>
- public interface ITextEditorFactoryService
- {
- ITextView CreateTextView (MonoDevelop.Ide.Editor.TextEditor textEditor, ITextViewRoleSet roles = null, IEditorOptions parentOptions = null);
-
- /// <summary>
- /// The empty ITextViewRoleSet.
- /// </summary>
- ITextViewRoleSet NoRoles { get; }
-
- /// <summary>
- /// The set of all predefined text view roles.
- /// </summary>
- ITextViewRoleSet AllPredefinedRoles { get; }
-
- /// <summary>
- /// The set of roles that are used when creating a text view without specifying text view roles.
- /// </summary>
- ITextViewRoleSet DefaultRoles { get; }
-
- /// <summary>
- /// Creates a <see cref="ITextViewRoleSet"/> containing the given roles.
- /// </summary>
- /// <param name="roles">The roles of interest.</param>
- /// <returns>The text view role set.</returns>
- /// <exception cref="ArgumentNullException"> roles is null.</exception>
- ITextViewRoleSet CreateTextViewRoleSet(IEnumerable<string> roles);
-
- /// <summary>
- /// Creates a <see cref="ITextViewRoleSet"/> containing the given roles.
- /// </summary>
- /// <param name="roles">The roles of interest.</param>
- /// <returns>The text view role set.</returns>
- ITextViewRoleSet CreateTextViewRoleSet(params string[] roles);
-
- /// <summary>
- /// Raised when any <see cref="ITextView"/> is created.
- /// </summary>
- event EventHandler<TextViewCreatedEventArgs> TextViewCreated;
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorInitializationService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorInitializationService.cs
new file mode 100644
index 0000000000..df843fb07d
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorInitializationService.cs
@@ -0,0 +1,10 @@
+using System;
+
+namespace Microsoft.VisualStudio.Text.Editor
+{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
+ public interface ITextEditorInitializationService
+ {
+ ITextView CreateTextView (MonoDevelop.Ide.Editor.TextEditor textEditor);
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
index e362c9e65c..fcd278305b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextEditorOptions.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextEditorOptions.cs
//
// Author:
@@ -86,7 +86,8 @@ namespace MonoDevelop.Ide.Editor
bool OverrideDocumentEolMarker { get; }
bool EnableSyntaxHighlighting { get; }
bool RemoveTrailingWhitespaces { get; }
-
+
+ [Obsolete ("Old editor")]
bool WrapLines { get; }
string FontName { get; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextLineMarker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextLineMarker.cs
index 982033e951..f5b400f912 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextLineMarker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextLineMarker.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextLineMarker.cs
//
// Author:
@@ -28,6 +28,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Old editor")]
public interface ITextLineMarker
{
IDocumentLine Line {
@@ -45,12 +46,15 @@ namespace MonoDevelop.Ide.Editor
}
}
- public enum UrlType {
+ [Obsolete ("Old editor")]
+ public enum UrlType
+ {
Unknown,
Url,
Email
}
+ [Obsolete ("Old editor")]
public interface IUrlTextLineMarker : ITextLineMarker
{
UrlType UrlType {
@@ -62,11 +66,13 @@ namespace MonoDevelop.Ide.Editor
}
}
+ [Obsolete ("Old editor")]
public interface ICurrentDebugLineTextMarker : ITextLineMarker
{
}
+ [Obsolete ("Old editor")]
public interface IMessageBubbleLineMarker : ITextLineMarker
{
int TaskCount { get; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
index ad3ecbecc4..3b81e83834 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/ITextSegmentMarker.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextSegmentMarker.cs
//
// Author:
@@ -31,6 +31,7 @@ using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use Visual Studio Editor APIs")]
public interface ITextSegmentMarker : ISegment
{
bool IsVisible {
@@ -47,7 +48,9 @@ namespace MonoDevelop.Ide.Editor
event EventHandler<TextMarkerMouseEventArgs> MouseHover;
}
- public enum TextSegmentMarkerEffect {
+ [Obsolete ("Use Visual Studio Editor APIs")]
+ public enum TextSegmentMarkerEffect
+ {
/// <summary>
/// The region is marked as waved underline.
/// </summary>
@@ -74,6 +77,7 @@ namespace MonoDevelop.Ide.Editor
Background
}
+ [Obsolete ("Use Visual Studio Editor APIs")]
public interface IGenericTextSegmentMarker : ITextSegmentMarker
{
TextSegmentMarkerEffect Effect { get; }
@@ -81,11 +85,13 @@ namespace MonoDevelop.Ide.Editor
HslColor Color { get; set; }
}
+ [Obsolete ("Use Visual Studio Editor APIs")]
public interface IErrorMarker : ITextSegmentMarker
{
Error Error { get; }
}
+ [Obsolete ("Use Visual Studio Editor APIs")]
public interface ISmartTagMarker : ITextSegmentMarker
{
bool IsInsideSmartTag (double x, double y);
@@ -94,6 +100,7 @@ namespace MonoDevelop.Ide.Editor
event EventHandler CancelPopup;
}
+ [Obsolete ("Use Visual Studio Editor APIs")]
public interface ILinkTextMarker : ITextSegmentMarker
{
bool OnlyShowLinkOnHover { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IUnitTestMarker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IUnitTestMarker.cs
index 0350ff9839..e0898ca46e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IUnitTestMarker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/IUnitTestMarker.cs
@@ -1,8 +1,9 @@
-using System;
+using System;
using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Old editor")]
public interface IUnitTestMarker : ITextLineMarker
{
UnitTestLocation UnitTest { get; }
@@ -10,6 +11,7 @@ namespace MonoDevelop.Ide.Editor
void UpdateState ();
}
+ [Obsolete ("Old editor")]
public abstract class UnitTestMarkerHost
{
public abstract Xwt.Drawing.Image GetStatusIcon (string unitTestIdentifier, string caseId = null);
@@ -20,6 +22,7 @@ namespace MonoDevelop.Ide.Editor
public abstract void PopupContextMenu (UnitTestLocation unitTest, int x, int y);
}
+ [Obsolete ("Old editor")]
public class UnitTestLocation
{
public int Offset { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionCursorEventArgs.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionCursorEventArgs.cs
index 2f5996cc6a..f98c494d2c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionCursorEventArgs.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionCursorEventArgs.cs
@@ -1,4 +1,4 @@
-//
+//
// InsertionCursorEventArgs.cs
//
// Author:
@@ -28,6 +28,7 @@ using System;
namespace MonoDevelop.Ide.Editor
{
[Serializable]
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class InsertionCursorEventArgs : EventArgs
{
public bool Success {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionModeOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionModeOptions.cs
index d678aadc1a..3179842583 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionModeOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionModeOptions.cs
@@ -1,4 +1,4 @@
-//
+//
// InsertionModeOptions.cs
//
// Author:
@@ -31,6 +31,7 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// This class contains information the editor needs to initiate the insertion mode.
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class InsertionModeOptions
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionPoint.cs
index 7bf2808146..6941001833 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionPoint.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InsertionPoint.cs
@@ -1,4 +1,4 @@
-//
+//
// InsertionPoint.cs
//
// Author:
@@ -29,6 +29,7 @@ using MonoDevelop.Ide.CodeFormatting;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public enum NewLineInsertion
{
None,
@@ -36,6 +37,7 @@ namespace MonoDevelop.Ide.Editor
BlankLine
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class InsertionPoint
{
public DocumentLocation Location {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorFactory.cs
index 61a24fc464..380e3dc8f2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorFactory.cs
@@ -1,34 +1,36 @@
-//
-// ITextEditorFactory.cs
-//
-// Author:
-// Mike Krüger <mkrueger@xamarin.com>
-//
-// Copyright (c) 2014 Xamarin Inc. (http://xamarin.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.
-
+//
+// ITextEditorFactory.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.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 System;
using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Gui.Documents;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete]
interface ITextEditorFactory
{
ITextDocument CreateNewDocument ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
index c80ef8eb79..76e193915a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
@@ -40,6 +40,7 @@ using System.Text;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion APIs")]
public enum EditMode
{
Edit,
@@ -47,6 +48,7 @@ namespace MonoDevelop.Ide.Editor
CursorInsertion
}
+ [Obsolete]
interface ITextEditorImpl : IDisposable
{
DocumentController DocumentController { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
index 4310ba9300..c687104798 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextMarkerFactory.cs
@@ -1,4 +1,4 @@
-//
+//
// ITextMarkerFactory.cs
//
// Author:
@@ -31,12 +31,14 @@ using MonoDevelop.Components;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public enum LinkRequest
{
SameView,
RequestNewView
}
+ [Obsolete]
interface ITextMarkerFactory
{
#region Line marker
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/LineEventArgs.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/LineEventArgs.cs
index d33c1b5519..368fad1d14 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/LineEventArgs.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/LineEventArgs.cs
@@ -1,4 +1,4 @@
-//
+//
// LineEventArgs.cs
//
// Author:
@@ -27,6 +27,7 @@ using System;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Old editor")]
public class LineEventArgs : System.EventArgs
{
public readonly static LineEventArgs AllLines = new LineEventArgs ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/OSXEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/OSXEditor.cs
index fc35dba10c..2aff415590 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/OSXEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/OSXEditor.cs
@@ -66,12 +66,11 @@ namespace MonoDevelop.Ide.Editor
{
var editorFont = Xwt.Drawing.Font.FromName(fontName);
- using (var nsFont = NSFont.FromFontName (editorFont.Family, (nfloat)editorFont.Size)) {
- if (nsFont == null)
- return -1;
- using (var lm = new NSLayoutManager ())
- return lm.DefaultLineHeightForFont (nsFont);
- }
+ var nsFont = NSFont.FromFontName(editorFont.Family, (nfloat)editorFont.Size);
+ if (nsFont == null)
+ return -1;
+ using (var lm = new NSLayoutManager ())
+ return lm.DefaultLineHeightForFont (nsFont);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/IProjectionExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/IProjectionExtension.cs
index b995eaabe1..bbab6492b0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/IProjectionExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/IProjectionExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// IProjectionExtension.cs
//
// Author:
@@ -28,6 +28,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete]
interface IProjectionExtension
{
IReadOnlyList<Projection> Projections {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
index 1c6aa1f99f..76a9f0146d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectedCompletionExtension.cs
//
// Author:
@@ -32,6 +32,7 @@ using System.Threading.Tasks;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete]
sealed class ProjectedCompletionExtension : CompletionTextEditorExtension, IProjectionExtension
{
DocumentContext ctx;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedDocumentContext.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedDocumentContext.cs
index aef67b15c3..26914978c9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedDocumentContext.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedDocumentContext.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectedDocumentContext.cs
//
// Author:
@@ -34,7 +34,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.Projection
{
-
+ [Obsolete]
class ProjectedDocumentContext : DocumentContext
{
DocumentContext originalContext;
@@ -97,6 +97,7 @@ namespace MonoDevelop.Ide.Editor.Projection
{
}
+ [Obsolete]
public override void ReparseDocument ()
{
ReparseDocumentInternal ().Ignore ();
@@ -123,6 +124,7 @@ namespace MonoDevelop.Ide.Editor.Projection
return originalContext.GetOptionSet ();
}
+ [Obsolete]
public override async Task<MonoDevelop.Ide.TypeSystem.ParsedDocument> UpdateParseDocument ()
{
await ReparseDocumentInternal ();
@@ -141,6 +143,7 @@ namespace MonoDevelop.Ide.Editor.Projection
}
}
+ [Obsolete]
public override Microsoft.CodeAnalysis.Document AnalysisDocument {
get {
@@ -148,6 +151,7 @@ namespace MonoDevelop.Ide.Editor.Projection
}
}
+ [Obsolete]
public override MonoDevelop.Ide.TypeSystem.ParsedDocument ParsedDocument {
get {
return parsedDocument;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
index 5ea96558a7..95286c0a3b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectedFilterCompletionTextEditorExtension.cs
//
// Author:
@@ -31,6 +31,7 @@ using MonoDevelop.Ide.Editor.Extension;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete]
sealed class ProjectedFilterCompletionTextEditorExtension : CompletionTextEditorExtension, IProjectionExtension
{
CompletionTextEditorExtension completionTextEditorExtension;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
index 20d6872813..448a65b46f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectedSemanticHighlighting.cs
//
// Author:
@@ -30,6 +30,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete]
sealed class ProjectedSemanticHighlighting : SemanticHighlighting
{
List<Projection> projections;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
index ed61bb40b1..9d16923a80 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedTooltipProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// ProjectedTooltipProvider.cs
//
// Author:
@@ -30,6 +30,7 @@ using MonoDevelop.Components;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete]
sealed class ProjectedTooltipProvider : TooltipProvider
{
readonly Projection projection;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
index cbe4e492cd..d309e8e420 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
@@ -1,4 +1,4 @@
-//
+//
// Projection.cs
//
// Author:
@@ -34,6 +34,7 @@ using MonoDevelop.Core;
namespace MonoDevelop.Ide.Editor.Projection
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class Projection : IDisposable
{
public ITextDocument Document { get; private set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/SegmentTree.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/SegmentTree.cs
index b9ca9676fc..ce623fc405 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/SegmentTree.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/SegmentTree.cs
@@ -37,6 +37,7 @@ namespace MonoDevelop.Ide.Editor
/// A segment tree contains overlapping segments and get all segments overlapping a segment. It's implemented as a augmented interval tree
/// described in Cormen et al. (2001, Section 14.3: Interval trees, pp. 311–317).
/// </summary>
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public class SegmentTree<T> : TextSegmentTree, ICollection<T> where T : TreeSegment
{
readonly RedBlackTree tree = new RedBlackTree ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
index 900ef6baf4..17c4e9cfae 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
@@ -44,9 +44,12 @@ using Xwt;
using System.Collections.Immutable;
using MonoDevelop.Components.Commands;
using System.Threading.Tasks;
+using MonoDevelop.Ide.Composition;
+using Microsoft.VisualStudio.Text.Editor;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public sealed class TextEditor : Control, ITextDocument, IDisposable
{
readonly ITextEditorImpl textEditorImpl;
@@ -1054,7 +1057,7 @@ namespace MonoDevelop.Ide.Editor
TextEditor_MimeTypeChanged (null, null);
- this.TextView = Microsoft.VisualStudio.Platform.PlatformCatalog.Instance.TextEditorFactoryService.CreateTextView(this);
+ this.TextView = CompositionManager.GetExportedValue<ITextEditorInitializationService> ().CreateTextView (this);
}
void TextEditor_ZoomLevelChanged (object sender, EventArgs e)
@@ -1082,8 +1085,16 @@ namespace MonoDevelop.Ide.Editor
{
textEditorImpl.ClearTooltipProviders ();
foreach (var extensionNode in allProviders) {
- if (extensionNode.IsValidFor (MimeType))
- textEditorImpl.AddTooltipProvider ((TooltipProvider)extensionNode.CreateInstance ());
+ if (extensionNode.IsValidFor (MimeType)) {
+ TooltipProvider provider;
+ try {
+ provider = (TooltipProvider)extensionNode.CreateInstance ();
+ } catch (Exception ex) {
+ LoggingService.LogInternalError ("Error while creating tooltip provider " + extensionNode.Id, ex);
+ continue;
+ }
+ textEditorImpl.AddTooltipProvider (provider);
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
index b751ee7f33..db38553b50 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
@@ -1,4 +1,4 @@
-//
+//
// DocumentFactory.cs
//
// Author:
@@ -32,6 +32,7 @@ using MonoDevelop.Ide.Gui.Documents;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class TextEditorFactory
{
static ITextEditorFactory currentFactory;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
index d65d95dcdc..9b17c2b8df 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
@@ -39,6 +39,8 @@ using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Ide.Gui.Documents;
using MonoDevelop.Projects;
using MonoDevelop.Projects.Policies;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
namespace MonoDevelop.Ide.Editor
{
@@ -311,7 +313,16 @@ namespace MonoDevelop.Ide.Editor
{
foreach (var r in base.OnGetContents (type))
yield return r;
- if (textEditorImpl != null) {
+
+ if (textEditorImpl != null) {
+ if (type == typeof(ITextBuffer)) {
+ yield return textEditor.TextView.TextBuffer;
+ yield break;
+ }
+ if (type == typeof (ITextView)) {
+ yield return textEditor.TextView;
+ yield break;
+ }
if (type.IsAssignableFrom (typeof (TextEditor))) {
yield return textEditor;
yield break;
@@ -385,6 +396,7 @@ namespace MonoDevelop.Ide.Editor
{
// TOTEST
textEditor.GrabFocus ();
+ DefaultSourceEditorOptions.SetUseAsyncCompletion (false);
}
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
index 2d11a72c5e..765d81e559 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextMarkerFactory.cs
@@ -1,4 +1,4 @@
-//
+//
// TextMarkerFactory.cs
//
// Author:
@@ -30,11 +30,12 @@ using MonoDevelop.Ide.Editor.Extension;
using MonoDevelop.Ide.TypeSystem;
namespace MonoDevelop.Ide.Editor
-{
+{
/// <summary>
/// The text marker factory creates line and segment markers for the text editor.
/// Note that this is the only valid way of creating markers for the editor.
/// </summary>
+ [Obsolete("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class TextMarkerFactory
{
#region Line marker
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipExtensionNode.cs
index d47513e925..ce88468d91 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipExtensionNode.cs
@@ -1,49 +1,38 @@
-//
-// TooltipExtensionNode.cs
-//
-// Author:
-// Mike Krüger <mkrueger@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://xamarin.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 System;
-using MonoDevelop.Core.Text;
-using MonoDevelop.Components;
-using MonoDevelop.Ide.CodeCompletion;
+//
+// TooltipExtensionNode.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.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.Ide.Editor
{
sealed class TooltipExtensionNode : TypeExtensionNode
{
- [NodeAttribute("mimeType", false, "The mimetype that this tooltip provider can handle.")]
- string mimeType;
-
- public string MimeType {
- get { return mimeType; }
- }
-
- internal bool IsValidFor (string mimeType)
- {
- return string.IsNullOrEmpty (this.mimeType) || this.mimeType == mimeType;
- }
+ [NodeAttribute ("mimeType", false, "The mimetype that this tooltip provider can handle.")]
+ public string MimeType { get; private set; }
+
+ internal bool IsValidFor (string mimeType) => string.IsNullOrEmpty (MimeType) || MimeType == mimeType;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
index c405c4aba0..91027bbed0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TooltipProvider.cs
@@ -32,6 +32,7 @@ using System.Threading;
namespace MonoDevelop.Ide.Editor
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense IAsyncQuickInfo* APIs")]
public sealed class TooltipItem : ISegment
{
int offset;
@@ -84,6 +85,7 @@ namespace MonoDevelop.Ide.Editor
}
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense IAsyncQuickInfo* APIs")]
public enum TooltipCloseReason
{
Force,
@@ -91,7 +93,8 @@ namespace MonoDevelop.Ide.Editor
MouseMove
}
- // TODO: Improve tooltip API - that really looks messy
+ [Obsolete ("Use the Microsoft.VisualStudio.Language.Intellisense IAsyncQuickInfo* APIs")]
+ // TODO: Improve tooltip API - that really looks messy
public abstract class TooltipProvider : IDisposable
{
public abstract Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default (CancellationToken));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
index 98c0d235fb..accf96d634 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
@@ -601,13 +601,13 @@ namespace MonoDevelop.Ide.Execution
}
class ExecutionCommandCustomizer: TypeExtensionNode, IExecutionCommandCustomizer
- {
+ {
+ [NodeAttribute ("_name", Localizable = true)]
+ public string Name { get; private set; }
+
IExecutionCommandCustomizer customizer;
- [NodeAttribute ("_name", Localizable=true)]
- string name;
-
- protected override void Read (Mono.Addins.NodeElement elem)
+ protected override void Read (NodeElement elem)
{
base.Read (elem);
customizer = (IExecutionCommandCustomizer) GetInstance (typeof(IExecutionCommandCustomizer));
@@ -627,12 +627,6 @@ namespace MonoDevelop.Ide.Execution
{
return customizer.CreateEditor ();
}
-
- public string Name {
- get {
- return name;
- }
- }
}
class RunWithPromptHandler: IExecutionHandler
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/CustomToolExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/CustomToolExtensionNode.cs
index 00890177fe..94ef1a8a49 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/CustomToolExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/CustomToolExtensionNode.cs
@@ -1,30 +1,24 @@
-//
-// CustomToolExtensionNode.cs
-//
-// Author:
-// Michael Hutchinson <mhutchinson@novell.com>
-//
-// Copyright (c) 2010 Novell, Inc.
-//
-// 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 System;
+//
+// Copyright (c) 2010 Novell, Inc.
+//
+// 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;
using MonoDevelop.Ide.CustomTools;
@@ -32,13 +26,9 @@ namespace MonoDevelop.Ide.Extensions
{
public class CustomToolExtensionNode : TypeExtensionNode
{
- [NodeAttribute (Description="Custom tool name.", Required=true)]
- string name;
-
- public string Name {
- get { return name; }
- }
-
+ [NodeAttribute ("name", Description="Custom tool name.", Required=true)]
+ public string Name { get; private set; }
+
public SingleProjectFileCustomTool Tool {
get {
var instance = base.GetInstance ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/MimeTypeNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/MimeTypeNode.cs
index 71b486b1eb..be33a34c7e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/MimeTypeNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/MimeTypeNode.cs
@@ -1,77 +1,75 @@
-// MimeTypeNode.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2008 Novell, Inc (http://www.novell.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.
-//
-//
-
+// MimeTypeNode.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.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 System;
using System.Collections.Generic;
-using System.Text;
-using System.IO;
+using System.Linq;
using System.Text.RegularExpressions;
using Mono.Addins;
using MonoDevelop.Core;
-using System.Linq;
-
namespace MonoDevelop.Ide.Extensions
{
[ExtensionNodeChild (typeof(MimeTypeFileNode), "File")]
class MimeTypeNode: ExtensionNode
- {
+ {
+ [NodeAttribute ("_description", Localizable=true)]
+ public string Description { get; private set; }
+
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute]
string icon;
- [NodeAttribute ("_description", Localizable=true)]
- string description;
-
[NodeAttribute (Required=false)]
string baseType;
[NodeAttribute (Required=false)]
- protected bool isText;
+ protected bool isText;
+
+ #pragma warning restore 649
+
+ /// <summary>
+ /// The name used by Roslyn to identify this language.
+ /// </summary>
+ [NodeAttribute ("roslynName", "The name used by Roslyn to identify this language", Required=false)]
+ public string RoslynName { get; private set; }
+
+ [NodeAttribute ("contentType", "The content type name used by the Visual Studio editor to identify this language", Required = false)]
+ public string ContentType { get; private set; }
IFileNameEvaluator regex;
public IconId Icon {
- get {
- return icon;
- }
- set {
- icon = value;
- }
- }
-
- public string Description {
- get {
- return description;
- }
- set {
- description = value;
- }
- }
-
+ get => icon;
+ set => icon = value;
+ }
+
public string BaseType {
get {
if (string.IsNullOrEmpty (baseType))
@@ -81,12 +79,22 @@ namespace MonoDevelop.Ide.Extensions
}
}
- /// <summary>
- /// The name used by Roslyn to identify this language.
- /// </summary>
- [NodeAttribute ("roslynName", "The name used by Roslyn to identify this language", Required=false)]
- public string RoslynName { get; private set; }
-
+ string overrideId;
+ public new string Id => overrideId ?? (overrideId = base.Id);
+
+ //deserialization
+ public MimeTypeNode () { }
+
+ public MimeTypeNode (string id, string baseType, string description, string icon, bool isText, string contentType)
+ {
+ overrideId = id;
+ this.baseType = baseType;
+ Description = description;
+ this.icon = icon;
+ this.isText = isText;
+ ContentType = contentType;
+ }
+
interface IFileNameEvaluator
{
bool SupportsFile (string fileName);
@@ -192,7 +200,10 @@ namespace MonoDevelop.Ide.Extensions
}
class MimeTypeFileNode: ExtensionNode
- {
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute]
string pattern;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsDialogSection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsDialogSection.cs
index 1c8e0e7f88..90779d77fe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsDialogSection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsDialogSection.cs
@@ -1,34 +1,33 @@
-// OptionsDialogSection.cs
-//
-// Author:
-// Lluis Sanchez Gual <lluis@novell.com>
-//
-// Copyright (c) 2008 Novell, Inc (http://www.novell.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.
-//
-//
-
+// OptionsDialogSection.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2008 Novell, Inc (http://www.novell.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 System;
using Mono.Addins;
using MonoDevelop.Core;
-using MonoDevelop.Components;
namespace MonoDevelop.Ide.Extensions
{
@@ -36,7 +35,10 @@ namespace MonoDevelop.Ide.Extensions
[ExtensionNodeChild (typeof(OptionsPanelNode))]
[ExtensionNode ("Section")]
class OptionsDialogSection: OptionsPanelNode, ICloneable
- {
+ {
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute]
string icon;
@@ -44,8 +46,10 @@ namespace MonoDevelop.Ide.Extensions
string headerImageResource;
[NodeAttribute]
- string headerFillerImageResource;
-
+ string headerFillerImageResource;
+
+ #pragma warning restore 649
+
public OptionsDialogSection ()
{
}
@@ -55,12 +59,8 @@ namespace MonoDevelop.Ide.Extensions
}
public IconId Icon {
- get {
- return icon;
- }
- set {
- icon = value;
- }
+ get => icon;
+ set => icon = value;
}
public Xwt.Drawing.Image HeaderImage { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/StockIconCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/StockIconCodon.cs
index 7561214243..9e65f64a89 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/StockIconCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/StockIconCodon.cs
@@ -1,37 +1,34 @@
-//
-// StockIconAssembly.cs
-//
-// Author:
-// Lluis Sanchez Gual
-//
-
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-
-
+//
+// StockIconAssembly.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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 System;
-using System.Collections;
-using System.ComponentModel;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Core.Imaging;
using Mono.Addins;
namespace MonoDevelop.Ide.Extensions
@@ -40,45 +37,59 @@ namespace MonoDevelop.Ide.Extensions
internal class StockIconCodon : ExtensionNode
{
[NodeAttribute ("stockid", true, "Id of the stock icon.")]
- string stockid;
+ public string StockId { get; private set; }
[NodeAttribute ("size", "Size of the icon.")]
- Gtk.IconSize size = Gtk.IconSize.Invalid;
-
+ public Gtk.IconSize IconSize { get; private set; }
+
[NodeAttribute ("resource", "Name of the resource where the icon is stored.")]
- string resource;
-
+ public string Resource { get; private set; }
+
[NodeAttribute ("file", "Name of the file where the icon is stored.")]
- string file;
-
+ public string File { get; private set; }
+
[NodeAttribute ("icon", "Id of another icon or combination of icons to assign to this stock id.")]
- string iconid;
-
+ public string IconId { get; private set; }
+
[NodeAttribute ("animation", "An animation specification.")]
- string animation;
+ public string Animation { get; private set; }
- public string StockId {
- get { return stockid; }
- }
-
- public Gtk.IconSize IconSize {
- get { return size; }
- }
-
- public string Resource {
- get { return resource; }
- }
-
- public string File {
- get { return file; }
- }
-
- public string IconId {
- get { return iconid; }
- }
-
- public string Animation {
- get { return animation; }
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
+ [NodeAttribute ("imageid", "One or more semicolon-separated Visual Studio ImageIds, in format `{guid}#454;{guid}#7832;...`. The KnownImages GUID may be omitted.")]
+ string imageid;
+
+ #pragma warning restore 649
+
+ public IEnumerable<ImageId> GetImageIds() {
+ if (imageid == null)
+ yield break;
+
+ int start = 0;
+
+ do {
+ int end = imageid.IndexOf (';', start);
+ if (end < 0) {
+ end = imageid.Length;
+ }
+
+ Guid guid = KnownImagesGuid;
+ int hashIdx = imageid.IndexOf ('#', start, end - start);
+ if (hashIdx > -1) {
+ guid = Guid.Parse (imageid.Substring (start, hashIdx - start));
+ start = hashIdx + 1;
+ }
+
+ int id = int.Parse (imageid.Substring (start, end - start));
+
+ yield return new ImageId (guid, id);
+
+ start = end + 1;
+ }
+ while (start < imageid.Length);
}
+
+ static readonly Guid KnownImagesGuid = Guid.Parse ("{ae27a6b0-e345-4288-96df-5eaf394ee369}");
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Commands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Commands.cs
index c0b0007c80..44c2715d7c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Commands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Commands.cs
@@ -29,7 +29,15 @@ using MonoDevelop.Components.Commands;
namespace MonoDevelop.Ide.FindInFiles
{
- class FindInFilesHandler : CommandHandler
+ class InFilesHandler : CommandHandler
+ {
+ protected override void Update (CommandInfo info)
+ {
+ info.Enabled = IdeApp.Workbench.RootWindow.Visible;
+ }
+ }
+
+ class FindInFilesHandler : InFilesHandler
{
protected override void Run ()
{
@@ -37,7 +45,7 @@ namespace MonoDevelop.Ide.FindInFiles
}
}
- class ReplaceInFilesHandler : CommandHandler
+ class ReplaceInFilesHandler : InFilesHandler
{
protected override void Run ()
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs
index a4910bf5ba..23e58e2652 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FileProvider.cs
@@ -1,4 +1,4 @@
-//
+//
// FileProvider.cs
//
// Author:
@@ -34,49 +34,49 @@ using System;
using MonoDevelop.Core.Text;
using System.Threading.Tasks;
using MonoDevelop.Ide.Editor;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text;
namespace MonoDevelop.Ide.FindInFiles
{
class OpenFileProvider : FileProvider
{
- readonly TextEditor editor;
+ readonly ITextBuffer textBuffer;
+ ITextEdit textEdit;
- public OpenFileProvider (TextEditor editor, Project project) : this(editor, project, -1, -1)
+ public OpenFileProvider (ITextBuffer textBuffer, Project project, string fileName) : this(textBuffer, project, fileName, - 1, -1)
{
}
- public OpenFileProvider (TextEditor editor, Project project, int selectionStartPostion, int selectionEndPosition) : base (editor.FileName, project, selectionStartPostion, selectionEndPosition)
+ public OpenFileProvider (ITextBuffer textBuffer, Project project, string fileName, int selectionStartPostion, int selectionEndPosition) : base (fileName, project, selectionStartPostion, selectionEndPosition)
{
- this.editor = editor;
+ this.textBuffer = textBuffer;
}
public override TextReader ReadString (bool readBinaryFiles)
{
- return editor.CreateReader ();
+ return new Microsoft.VisualStudio.Platform.NewTextSnapshotToTextReader (textBuffer.CurrentSnapshot);
}
- IDisposable undoGroup;
public override void BeginReplace (string content, Encoding encoding)
{
Gtk.Application.Invoke ((o, args) => {
- undoGroup = editor.OpenUndoGroup ();
+ textEdit = textBuffer.CreateEdit ();
});
}
- public override void Replace (int offset, int length, string replacement)
+ public override void Replace (int offset, int offsetWithoutDelta, int length, string replacement)
{
Gtk.Application.Invoke ((o, args) => {
- editor.ReplaceText (offset, length, replacement);
+ textEdit.Replace (offsetWithoutDelta, length, replacement);
});
}
public override void EndReplace ()
{
Gtk.Application.Invoke ((o, args) => {
- if (undoGroup != null) {
- undoGroup.Dispose ();
- undoGroup = null;
- }
+ textEdit.Apply ();
+ textEdit = null;
});
}
}
@@ -133,14 +133,10 @@ namespace MonoDevelop.Ide.FindInFiles
if (buffer != null) {
return new StringReader (buffer.ToString ());
} else {
- Document doc = null;
-
- var task = SearchDocument ();
- if (task.Wait (1000))
- doc = task.Result;
-
- if (doc != null && doc.Editor != null) {
- return doc.Editor.CreateReader ();
+ var doc = SearchDocument ();
+ var tb = doc?.GetContent<ITextBuffer> ();
+ if (tb != null) {
+ return new Microsoft.VisualStudio.Platform.NewTextSnapshotToTextReader (tb.CurrentSnapshot);
} else {
return GetReaderForFileName (readBinaryFiles);
}
@@ -163,40 +159,40 @@ namespace MonoDevelop.Ide.FindInFiles
}
}
- Task<Document> SearchDocument ()
+ Document SearchDocument ()
{
string fullPath = Path.GetFullPath (FileName);
- return Runtime.RunInMainThread (() => IdeServices.DocumentManager.Documents.FirstOrDefault (d => !string.IsNullOrEmpty (d.FileName) && Path.GetFullPath (d.FileName) == fullPath));
+ return IdeServices.DocumentManager.Documents.FirstOrDefault (d => !string.IsNullOrEmpty (d.FileName) && Path.GetFullPath (d.FileName) == fullPath);
}
- Document document;
+ ITextBuffer textBuffer;
StringBuilder buffer = null;
bool somethingReplaced;
- IDisposable undoGroup;
+ ITextEdit textEdit;
Encoding encoding;
- public virtual async void BeginReplace (string content, Encoding encoding)
+ public virtual void BeginReplace (string content, Encoding encoding)
{
somethingReplaced = false;
buffer = new StringBuilder (content);
- document = await SearchDocument ();
+ textBuffer = SearchDocument ()?.GetContent<ITextBuffer> ();
this.encoding = encoding;
- if (document != null) {
+ if (textBuffer != null) {
Gtk.Application.Invoke ((o, args) => {
- undoGroup = document.Editor.OpenUndoGroup ();
+ textEdit = textBuffer.CreateEdit ();
});
return;
}
}
- public virtual void Replace (int offset, int length, string replacement)
+ public virtual void Replace (int offset, int offsetWithoutDelta, int length, string replacement)
{
somethingReplaced = true;
buffer.Remove (offset, length);
buffer.Insert (offset, replacement);
- if (document != null) {
+ if (textBuffer != null) {
Gtk.Application.Invoke ((o, args) => {
- document.Editor.ReplaceText (offset, length, replacement);
+ textEdit.Replace (offsetWithoutDelta, length, replacement);
});
return;
}
@@ -204,13 +200,10 @@ namespace MonoDevelop.Ide.FindInFiles
public virtual void EndReplace ()
{
- if (document != null) {
+ if (textBuffer != null) {
Gtk.Application.Invoke ((o, args) => {
- if (undoGroup != null) {
- undoGroup.Dispose ();
- undoGroup = null;
- }
- /*document.Editor.Document.CommitUpdateAll (); */
+ textEdit.Apply ();
+ textEdit = null;
});
return;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs
index b33d81cc41..d2673e7ef6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindInFilesDialog.cs
@@ -36,6 +36,8 @@ using System.Collections.Generic;
using MonoDevelop.Ide.Gui.Content;
using System.Threading.Tasks;
using MonoDevelop.Components.AtkCocoaHelper;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text;
namespace MonoDevelop.Ide.FindInFiles
{
@@ -205,9 +207,9 @@ namespace MonoDevelop.Ide.FindInFiles
toggleFindInFiles.Toggle ();
if (IdeApp.Workbench.ActiveDocument != null) {
- var view = IdeApp.Workbench.ActiveDocument.Editor;
+ var view = IdeApp.Workbench.ActiveDocument.GetContent<ITextView>();
if (view != null) {
- string selectedText = FormatPatternToSelectionOption (view.SelectedText, properties.Get ("RegexSearch", false));
+ string selectedText = FormatPatternToSelectionOption (view.Selection.SelectedSpans.FirstOrDefault ().GetText(), properties.Get ("RegexSearch", false));
if (!string.IsNullOrEmpty (selectedText)) {
if (selectedText.Any (c => c == '\n' || c == '\r')) {
// comboboxScope.Active = ScopeSelection;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs
index a25f88f21f..a09b8252ac 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/FindReplace.cs
@@ -259,7 +259,7 @@ namespace MonoDevelop.Ide.FindInFiles
if (!filter.WholeWordsOnly || FilterOptions.IsWholeWordAt (content, match.Index, match.Length)) {
string replacement = match.Result (replacePattern);
results.Add (new SearchResult (provider, match.Index + delta, replacement.Length));
- provider.Replace (match.Index + delta, match.Length, replacement);
+ provider.Replace (match.Index + delta, match.Index, match.Length, replacement);
delta += replacement.Length - match.Length;
}
}
@@ -355,7 +355,7 @@ namespace MonoDevelop.Ide.FindInFiles
{
int delta = 0;
foreach (var sr in searchResult) {
- provider.Replace (sr.Offset + delta, sr.Length, replacePattern);
+ provider.Replace (sr.Offset + delta, sr.Offset, sr.Length, replacePattern);
delta += replacePattern.Length - sr.Length;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Scope.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Scope.cs
index a632fcdd90..0b5dd2761d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Scope.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/Scope.cs
@@ -1,4 +1,4 @@
-//
+//
// Scope.cs
//
// Author:
@@ -34,6 +34,8 @@ using MonoDevelop.Core;
using System.Security.Permissions;
using System.Security;
using System.Threading.Tasks;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Editor;
namespace MonoDevelop.Ide.FindInFiles
{
@@ -77,8 +79,9 @@ namespace MonoDevelop.Ide.FindInFiles
{
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in '{0}'", IdeApp.Workbench.ActiveDocument.FileName));
var doc = IdeApp.Workbench.ActiveDocument;
- if (doc.Editor != null)
- yield return new OpenFileProvider (doc.Editor, doc.Owner as Project);
+ var textBuffer = doc.GetContent<ITextBuffer> ();
+ if (textBuffer != null)
+ yield return new OpenFileProvider (textBuffer, doc.Owner as Project, doc.FileName);
}
public override string GetDescription(FilterOptions filterOptions, string pattern, string replacePattern)
@@ -104,9 +107,10 @@ namespace MonoDevelop.Ide.FindInFiles
public override IEnumerable<FileProvider> GetFiles (ProgressMonitor monitor, FilterOptions filterOptions)
{
var doc = IdeApp.Workbench.ActiveDocument;
- if (doc.Editor != null) {
- var selection = doc.Editor.SelectionRange;
- yield return new OpenFileProvider (doc.Editor, doc.Owner as Project, selection.Offset, selection.EndOffset);
+ var textView = doc.GetContent<ITextView> ();
+ if (textView != null) {
+ var selection = textView.Selection.SelectedSpans.FirstOrDefault ();
+ yield return new OpenFileProvider (textView.TextBuffer, doc.Owner as Project, doc.FileName, selection.Start, selection.End);
}
}
@@ -258,8 +262,9 @@ namespace MonoDevelop.Ide.FindInFiles
{
foreach (Document document in IdeApp.Workbench.Documents) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Looking in '{0}'", document.FileName));
- if (document.Editor != null && filterOptions.NameMatches (document.FileName))
- yield return new OpenFileProvider (document.Editor, document.Owner as Project);
+ var textBuffer = document.GetContent<ITextBuffer> ();
+ if (textBuffer != null && filterOptions.NameMatches (document.FileName))
+ yield return new OpenFileProvider (textBuffer, document.Owner as Project, document.FileName);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs
index 004ac07aa3..0f261fefbe 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontDescriptionCodon.cs
@@ -29,23 +29,16 @@ namespace MonoDevelop.Ide.Fonts
{
[ExtensionNode (Description="A template for color and syntax shemes.")]
public class FontDescriptionCodon : ExtensionNode
- {
+ {
[NodeAttribute("name", "Name of the font.")]
- string name;
- public string Name {
- get {
- return this.name;
- }
- }
-
+ public string Name { get; private set; }
+
[NodeAttribute("_displayName", "Name of the font displayed to the user.", Localizable=true)]
- string displayName;
- public string DisplayName {
- get {
- return this.displayName;
- }
- }
-
+ public string DisplayName { get; private set; }
+
+ //these fields are assigned by reflection, suppress "never assigned" warning
+ #pragma warning disable 649
+
[NodeAttribute("default", "Default font to use.")]
string fontDescription;
@@ -56,14 +49,16 @@ namespace MonoDevelop.Ide.Fonts
string fontDescriptionMacYosemite;
[NodeAttribute("defaultWindows", "Default windows font to use.")]
- string fontDescriptionWindows;
-
+ string fontDescriptionWindows;
+
+ #pragma warning restore 649
+
public string FontDescription {
get {
- if (MonoDevelop.Core.Platform.IsWindows)
+ if (Core.Platform.IsWindows)
return string.IsNullOrEmpty (fontDescriptionWindows) ? fontDescription : fontDescriptionWindows;
- if (MonoDevelop.Core.Platform.IsMac) {
- if (MonoDevelop.Core.Platform.OSVersion >= MonoDevelop.Core.MacSystemInformation.Yosemite) {
+ if (Core.Platform.IsMac) {
+ if (Core.Platform.OSVersion >= Core.MacSystemInformation.Yosemite) {
if (!string.IsNullOrEmpty (fontDescriptionMacYosemite)) {
return fontDescriptionMacYosemite;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs
index 4c5318aece..9f737ed3b4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs
@@ -1,4 +1,4 @@
-//
+//
// ExtensibleTreeView.cs
//
// Author:
@@ -2399,7 +2399,6 @@ namespace MonoDevelop.Ide.Gui.Components
ExtensibleTreeView parent;
Gdk.Rectangle buttonScreenRect;
- Gdk.Rectangle buttonAllocation;
string markup;
string secondarymarkup;
@@ -2615,10 +2614,6 @@ namespace MonoDevelop.Ide.Gui.Components
public Gdk.Point PointerPosition { get; set; }
- public Gdk.Rectangle PopupAllocation {
- get { return buttonAllocation; }
- }
-
protected override void OnDestroyed ()
{
base.OnDestroyed ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs
index 6c8d8ef3b0..c458d95785 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/DocumentStateTracker.cs
@@ -35,7 +35,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.Gui.Content
{
-
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class DocumentStateTracker<T> : IDisposable where T : IDocumentStateEngine
{
T currentEngine;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs
index 6d6ec4ab16..e18067cdc1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/ITextEditorResolver.cs
@@ -31,21 +31,25 @@ using System.Linq;
using Mono.Addins;
using Microsoft.CodeAnalysis;
using MonoDevelop.Ide.Editor;
-
+using System;
+
namespace MonoDevelop.Ide.Gui.Content
{
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public interface ITextEditorResolver
{
ISymbol GetLanguageItem (int offset);
ISymbol GetLanguageItem (int offset, string expression);
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public interface ITextEditorResolverProvider
{
ISymbol GetLanguageItem (Document document, int offset, out DocumentRegion expressionRegion);
ISymbol GetLanguageItem (Document document, int offset, string identifier);
}
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public static class TextEditorResolverService
{
static List<TextEditorResolverProviderCodon> providers = new List<TextEditorResolverProviderCodon> ();
@@ -87,6 +91,7 @@ namespace MonoDevelop.Ide.Gui.Content
}
[ExtensionNode (Description="A codon for text editor providers.")]
+ [Obsolete ("Use the Microsoft.VisualStudio.Text.Editor APIs")]
public class TextEditorResolverProviderCodon : ExtensionNode
{
[NodeAttribute("mimeType", "Mime type for this text editor provider")]
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs
index 754b69e3f6..9ede28fe48 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/CommonAboutDialog.cs
@@ -58,7 +58,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
public CommonAboutDialog ()
{
Name = "wizard_dialog";
- Title = string.Format (GettextCatalog.GetString ("About {0}"), BrandingService.ApplicationLongName);
+ Title = string.Format (GettextCatalog.GetString ("About {0}"), BrandingService.ApplicationName);
AllowGrow = false;
HasSeparator = false;
BorderWidth = 0;
@@ -91,8 +91,6 @@ namespace MonoDevelop.Ide.Gui.Dialogs
}
};
backButton.HasDefault = backButton.CanDefault = true;
-
- ShowAll ();
}
static void CopyBufferToClipboard ()
@@ -124,8 +122,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs
{
if (Platform.IsMac) {
if (instance == null) {
+ var parent = DesktopService.GetFocusedTopLevelWindow ();
instance = new CommonAboutDialog ();
- MessageService.PlaceDialog (instance, WelcomePage.WelcomePageService.WelcomeWindow ?? IdeApp.Workbench.RootWindow);
+ instance.ShowAll ();
+ MessageService.PlaceDialog (instance, parent);
instance.Response += delegate {
instance.Destroy ();
instance.Dispose ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs
index ba4eddd2d5..36f3203e12 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs
@@ -221,7 +221,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs
UpdateDefaultSettingsButton (policyContainer);
loaded = true;
hasCachedPolicy = false;
- LoadFrom (policy);
+ if (policy != null)
+ LoadFrom (policy);
}
T GetCurrentPolicy ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
index 2b7153d931..4ec666236f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs
@@ -1,4 +1,4 @@
-// OptionsDialog.cs
+// OptionsDialog.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -529,13 +529,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs
return false;
}
- internal void ShowPage (OptionsDialogSection section)
+ internal void ShowPage (OptionsDialogSection section, bool forceExpand = false)
{
if (!IsRealized) {
// Defer this until the dialog is realized due to the sizing logic in CreatePageWidget.
EventHandler deferredShowPage = null;
deferredShowPage = delegate {
- ShowPage (section);
+ ShowPage (section, true);
Realized -= deferredShowPage;
};
Realized += deferredShowPage;
@@ -555,7 +555,6 @@ namespace MonoDevelop.Ide.Gui.Dialogs
}
}
}
-
foreach (Gtk.Widget w in pageFrame.Children) {
Container cc = w as Gtk.Container;
if (cc != null) {
@@ -595,7 +594,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
((Notebook)c).Page = 0;
}
- if (!IdeServices.DesktopService.AccessibilityInUse && !IdeServices.DesktopService.AccessibilityKeyboardFocusInUse) {
+ if (!IdeServices.DesktopService.AccessibilityInUse && !IdeServices.DesktopService.AccessibilityKeyboardFocusInUse || forceExpand) {
// Don't automatically expand trees if using accessibility
// as it can be confusing with screen readers
tree.ExpandToPath (store.GetPath (page.Iter));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
index 508bf69d16..52a6b938d2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Documents/DocumentManager.cs
@@ -1,4 +1,4 @@
-//
+//
// DocumentManager.cs
//
// Author:
@@ -50,6 +50,8 @@ namespace MonoDevelop.Ide.Gui.Documents
IShell workbench;
DesktopService desktopService;
+ readonly IEditorOperationsFactoryService editorOperationsFactoryService = CompositionManager.GetExportedValue<IEditorOperationsFactoryService> ();
+
ImmutableList<Document> documents = ImmutableList<Document>.Empty;
Document activeDocument;
Dictionary<IShellNotebook, List<IWorkbenchWindow>> documentHistory = new Dictionary<IShellNotebook, List<IWorkbenchWindow>> ();
@@ -596,20 +598,42 @@ namespace MonoDevelop.Ide.Gui.Documents
metadata.ResultString = result ? "Success" : "Failure";
}
- static void ScrollToRequestedCaretLocation (Document doc, FileOpenInformation info)
+ void ScrollToRequestedCaretLocation (Document doc, FileOpenInformation info)
{
+ if (info.Line < 1 && info.Offset < 0)
+ return;
var ipos = doc.Editor;
- if ((info.Line >= 1 || info.Offset >= 0) && ipos != null) {
+ var textView = doc.GetContent<ITextView> ();
+ if (ipos != null || textView != null) {
FileSettingsStore.Remove (doc.FileName);
doc.DisableAutoScroll ();
doc.RunWhenLoaded (() => {
- var loc = new DocumentLocation (info.Line, info.Column >= 1 ? info.Column : 1);
- if (info.Offset >= 0) {
- loc = ipos.OffsetToLocation (info.Offset);
+ if (ipos != null) {
+ var loc = new DocumentLocation (info.Line, info.Column >= 1 ? info.Column : 1);
+ if (info.Offset >= 0) {
+ loc = ipos.OffsetToLocation (info.Offset);
+ }
+ if (loc.IsEmpty)
+ return;
+ ipos.SetCaretLocation (loc, info.Options.HasFlag (OpenDocumentOptions.HighlightCaretLine), info.Options.HasFlag (OpenDocumentOptions.CenterCaretLine));
+ } else {
+ var offset = info.Offset;
+ if (offset < 0) {
+ var line = textView.TextSnapshot.GetLineFromLineNumber (info.Line - 1);
+ if (info.Column >= 1)
+ offset = line.Start + info.Column - 1;
+ else
+ offset = line.Start;
+ }
+
+ if (operationsFactory != null) {
+ var editorOperations = operationsFactory.GetEditorOperations (textView);
+ var point = new VirtualSnapshotPoint (textView.TextSnapshot, offset);
+ editorOperations.SelectAndMoveCaret (point, point, TextSelectionMode.Stream, EnsureSpanVisibleOptions.AlwaysCenter);
+ } else {
+ LoggingService.LogError ("Missing editor operations");
+ }
}
- if (loc.IsEmpty)
- return;
- ipos.SetCaretLocation (loc, info.Options.HasFlag (OpenDocumentOptions.HighlightCaretLine), info.Options.HasFlag (OpenDocumentOptions.CenterCaretLine));
});
}
@@ -754,20 +778,39 @@ namespace MonoDevelop.Ide.Gui.Documents
void CheckRemovedFile (object sender, FileEventArgs args)
{
foreach (var e in args) {
- foreach (var doc in documents) {
- if (!doc.IsFile || doc.IsNewDocument)
- continue;
- if (MatchesEvent (doc.FilePath, e)) {
- if (doc.IsDirty) {
- doc.ConvertToUnsavedFile ();
- } else {
- doc.Close ().Ignore ();
+ if (e.IsDirectory) {
+ CheckRemovedDirectory (e.FileName);
+ } else {
+ foreach (var doc in documents) {
+ if (doc.IsFile && !doc.IsNewDocument && doc.FilePath == e.FileName) {
+ CloseViewForRemovedFile (doc);
+ return;
}
}
+ CheckRemovedDirectory (e.FileName);
}
}
}
+ void CheckRemovedDirectory (FilePath fileName)
+ {
+ foreach (var content in documents) {
+ if (doc.IsFile && !doc.IsNewDocument && doc.FilePath.IsChildPathOf (fileName)) {
+ CloseViewForRemovedFile (content);
+ }
+ }
+ }
+
+ static void CloseViewForRemovedFile (Document doc)
+ {
+ if (doc.IsDirty) {
+ // TOTEST
+ doc.ConvertToUnsavedFile ();
+ } else {
+ doc.Close ().Ignore ();
+ }
+ }
+
void CheckRenamedFile (object sender, FileCopyEventArgs args)
{
foreach (FileEventInfo e in args) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
index f3d2efa7c8..8e1969737f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
@@ -1,4 +1,4 @@
-//
+//
// Document.cs
//
// Author:
@@ -45,6 +45,8 @@ using MonoDevelop.Ide.Tasks;
using MonoDevelop.Ide.TypeSystem;
using MonoDevelop.Projects;
using Roslyn.Utilities;
+using Microsoft.VisualStudio.Text;
+using Microsoft.CodeAnalysis.Text;
namespace MonoDevelop.Ide.Gui
{
@@ -282,7 +284,8 @@ namespace MonoDevelop.Ide.Gui
{
window?.SelectWindow ();
}
-
+
+ [Obsolete("Use GetContent<ITextBuffer>()")]
public TextEditor Editor {
get {
return GetContent <TextEditor> ();
@@ -380,7 +383,6 @@ namespace MonoDevelop.Ide.Gui
} finally {
// Send all file change notifications
FileService.ThawEvents ();
-
}
}
@@ -400,6 +402,7 @@ namespace MonoDevelop.Ide.Gui
if (fileController == null || controller.IsViewOnly || !fileController.SupportsSaveAs)
return false;
+ // TOTEST: that the default encoding is UTF8
Encoding encoding = fileController.SupportsEncoding ? fileController.Encoding : null;
if (filename == null) {
@@ -574,6 +577,7 @@ namespace MonoDevelop.Ide.Gui
/// <param name='action'>
/// The action to run.
/// </param>
+ [Obsolete("This only works for the old editor")]
public void RunWhenLoaded (System.Action action)
{
var e = Editor;
@@ -653,7 +657,6 @@ namespace MonoDevelop.Ide.Gui
}
}
-
[Serializable]
public sealed class DocumentEventArgs : EventArgs
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
index 7c18b46f77..1a64e65607 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ProgressMonitors.cs
@@ -134,7 +134,7 @@ namespace MonoDevelop.Ide.Gui
if (!string.IsNullOrEmpty (titleSuffix)) {
title += " - " + titleSuffix;
}
- Pad pad = CreateMonitorPad (id, title, icon, bringToFront, allowMonitorReuse, true);
+ Pad pad = CreateMonitorPad (id, title, icon, bringToFront, allowMonitorReuse, IdeApp.Workbench.RootWindow.Visible);
pad.Visible = visible;
return ((DefaultMonitorPad)pad.Content).BeginProgress (title);
}).Result;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RoslynDocumentExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RoslynDocumentExtension.cs
index ea08b40837..6d23454ac5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RoslynDocumentExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/RoslynDocumentExtension.cs
@@ -1,4 +1,4 @@
-//
+//
// RoslynDocumentExtension.cs
//
// Author:
@@ -266,18 +266,26 @@ namespace MonoDevelop.Ide.Gui
{
UnsubscribeControllerEvents ();
- if (newProject == project || newProject == adhocProject)
+ if (newProject == project || (IsAdHocProject && newProject == adhocProject))
return;
project = newProject;
+ bool usingAdHocProject = IsAdHocProject
UnloadAdhocProject ();
if (adhocProject == null)
UnsubscribeAnalysisDocument ();
SubscribeControllerEvents ();
+
Editor.InitializeExtensionChain (this);
- ListenToProjectLoad();
+
+ // Do not start the parser when the project is set to null and an adHocProject is not being used. This
+ // would result in a new adHocProject being created and then RootWorkspace would not update the Document's
+ // project since it is non-null.
+
+ if (project != null || (project == null && usingAdHocProject))
+ ListenToProjectLoad();
}
void SubscribeControllerEvents ()
@@ -483,11 +491,14 @@ namespace MonoDevelop.Ide.Gui
if (RoslynWorkspace == null) // Solution not loaded yet
return Task.CompletedTask;
SubscribeRoslynWorkspace ();
- analysisDocument = FileName != null ? typeSystemService.GetDocumentId (this.Project, this.FileName) : null;
+ var newAnalysisDocument = FileName != null ? typeSystemService.GetDocumentId (this.Project, this.FileName) : null;
+ var changedAnalysisDocument = newAnalysisDocument != analysisDocument;
+ analysisDocument = newAnalysisDocument
if (analysisDocument != null && !RoslynWorkspace.CurrentSolution.ContainsAdditionalDocument (analysisDocument) && !RoslynWorkspace.IsDocumentOpen (analysisDocument)) {
- typeSystemService.InformDocumentOpen (analysisDocument, Editor, this);
- OnAnalysisDocumentChanged (EventArgs.Empty);
+ typeSystemService.InformDocumentOpen (analysisDocument, TextBuffer.AsTextContainer(), this);
}
+ if (changedAnalysisDocument)
+ OnAnalysisDocumentChanged (EventArgs.Empty);
return Task.CompletedTask;
}
}
@@ -497,42 +508,39 @@ namespace MonoDevelop.Ide.Gui
return Task.CompletedTask;
}
- if (Editor != null) {
- var node = typeSystemService.GetTypeSystemParserNode (Editor.MimeType, BuildAction.Compile);
- if (Editor.MimeType == "text/x-csharp" || node?.Parser.CanGenerateAnalysisDocument (Editor.MimeType, BuildAction.Compile, new string [0]) == true) {
- var newProject = Services.ProjectService.CreateDotNetProject ("C#");
-
- this.adhocProject = newProject;
+ if (TextBuffer.ContentType.TypeName == "CSharp") {
+ var newProject = Services.ProjectService.CreateDotNetProject ("C#");
- newProject.Name = "InvisibleProject";
- newProject.References.Add (ProjectReference.CreateAssemblyReference ("mscorlib"));
- newProject.References.Add (ProjectReference.CreateAssemblyReference ("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
- newProject.References.Add (ProjectReference.CreateAssemblyReference ("System.Core"));
+ this.adhocProject = newProject;
- // Use a different name for each project, otherwise the msbuild builder will complain about duplicate projects.
- newProject.FileName = "adhoc_" + (++adhocProjectCount) + ".csproj";
- if (!controller.IsNewDocument) {
- adHocFile = Editor.FileName;
- } else {
- adHocFile = (Platform.IsWindows ? "C:\\" : "/") + FileName + ".cs";
- }
+ newProject.Name = "InvisibleProject";
+ newProject.References.Add (ProjectReference.CreateAssemblyReference ("mscorlib"));
+ newProject.References.Add (ProjectReference.CreateAssemblyReference ("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
+ newProject.References.Add (ProjectReference.CreateAssemblyReference ("System.Core"));
- newProject.Files.Add (new ProjectFile (adHocFile, BuildAction.Compile));
-
- adhocSolution = new Solution ();
- adhocSolution.AddConfiguration ("", true);
- adhocSolution.DefaultSolutionFolder.AddItem (newProject);
- return typeSystemService.Load (adhocSolution, new ProgressMonitor (), token, false).ContinueWith (task => {
- if (token.IsCancellationRequested)
- return;
- UnsubscribeRoslynWorkspace ();
- RoslynWorkspace = task.Result.FirstOrDefault (); // 1 solution loaded ->1 workspace as result
- SubscribeRoslynWorkspace ();
- analysisDocument = RoslynWorkspace.CurrentSolution.Projects.First ().DocumentIds.First ();
- typeSystemService.InformDocumentOpen (RoslynWorkspace, analysisDocument, Editor, this);
- OnAnalysisDocumentChanged (EventArgs.Empty);
- });
+ // Use a different name for each project, otherwise the msbuild builder will complain about duplicate projects.
+ newProject.FileName = "adhoc_" + (++adhocProjectCount) + ".csproj";
+ if (!controller.IsNewDocument) {
+ adHocFile = FileName;
+ } else {
+ adHocFile = (Platform.IsWindows ? "C:\\" : "/") + FileName + ".cs";
}
+
+ newProject.Files.Add (new ProjectFile (adHocFile, BuildAction.Compile));
+
+ adhocSolution = new Solution ();
+ adhocSolution.AddConfiguration ("", true);
+ adhocSolution.DefaultSolutionFolder.AddItem (newProject);
+ return typeSystemService.Load (adhocSolution, new ProgressMonitor (), token, false).ContinueWith (task => {
+ if (token.IsCancellationRequested)
+ return;
+ UnsubscribeRoslynWorkspace ();
+ RoslynWorkspace = task.Result.FirstOrDefault (); // 1 solution loaded ->1 workspace as result
+ SubscribeRoslynWorkspace ();
+ analysisDocument = RoslynWorkspace.CurrentSolution.Projects.First ().DocumentIds.First ();
+ typeSystemService.InformDocumentOpen (RoslynWorkspace, analysisDocument, TextBuffer.AsTextContainer (), this);
+ OnAnalysisDocumentChanged (EventArgs.Empty);
+ });
}
}
return Task.CompletedTask;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
index 74d474600d..9ff1295d77 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs
@@ -59,6 +59,10 @@ using MonoDevelop.Core.Instrumentation;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui.Documents;
using MonoDevelop.Ide.Gui.Shell;
+using Microsoft.VisualStudio.Text.Editor;
+using Microsoft.VisualStudio.Text;
+using Microsoft.VisualStudio.Text.Operations;
+using MonoDevelop.Ide.Composition;
namespace MonoDevelop.Ide.Gui
{
@@ -226,15 +230,16 @@ namespace MonoDevelop.Ide.Gui
internal TextReader[] GetDocumentReaders (List<string> filenames)
{
+ // TOTEST
TextReader [] results = new TextReader [filenames.Count];
int idx = 0;
foreach (var f in filenames) {
var fullPath = (FilePath)FileService.GetFullPath (f);
- Document doc = documentManager.Documents.Find (d => d.Editor != null && (fullPath == FileService.GetFullPath (d.Name)));
+ var doc = documentManager.Documents.Find (d => d.GetContent<ITextBuffer>() != null && (fullPath == FileService.GetFullPath (d.Name)));
if (doc != null) {
- results [idx] = doc.Editor.CreateReader ();
+ results [idx] = new Microsoft.VisualStudio.Platform.NewTextSnapshotToTextReader (doc.GetContent<ITextBuffer> ().CurrentSnapshot);
} else {
results [idx] = null;
}
@@ -820,9 +825,11 @@ namespace MonoDevelop.Ide.Gui
var dp = new DocumentUserPrefs ();
dp.FileName = FileService.AbsoluteToRelativePath (args.Item.BaseDirectory, path);
- if (document.Editor != null) {
- dp.Line = document.Editor.CaretLine;
- dp.Column = document.Editor.CaretColumn;
+ if (document.GetContent<ITextView> () is ITextView view) {
+ var pos = view.Caret.Position.BufferPosition;
+ var line = pos.Snapshot.GetLineFromPosition (pos.Position);
+ dp.Line = line.LineNumber + 1;
+ dp.Column = pos.Position - line.Start + 1;
}
return dp;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
index 91ad434dac..aeadec1209 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/NavigationHistoryService.cs
@@ -1,28 +1,30 @@
-//
-// NavigationHistoryManager.cs
-//
+//
// Author:
-// Lluis Sanchez <llsan@microsoft.com>
-//
-// Copyright (c) 2019 Microsoft
-//
-// 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:
+// Mikayla Hutchinson <m.j.hutchinson@gmail.com>
+// Lluis Sanchez Gual <lluis@novell.com>
//
-// 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.
+// Copyright (C) Microsoft. All rights reserved.
+// Copyright (C) 2008 Novell, Inc (http://www.novell.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 System;
using System.Collections.Generic;
using System.Threading.Tasks;
@@ -42,7 +44,6 @@ namespace MonoDevelop.Ide.Navigation
List<Tuple<NavigationPoint, int>> closedHistory = new List<Tuple<NavigationPoint, int>> ();
DocumentManager documentManager;
RootWorkspace workspace;
- TextEditorService textEditorService;
//used to prevent re-logging the current point during a switch
bool switching;
@@ -65,9 +66,6 @@ namespace MonoDevelop.Ide.Navigation
documentManager.DocumentClosing -= DocumentManager_DocumentClosing;
documentManager.ActiveDocumentChanged -= ActiveDocChanged;
- textEditorService.LineCountChanged -= LineCountChanged;
- textEditorService.LineCountChangesCommitted -= CommitCountChanges;
- textEditorService.LineCountChangesReset -= ResetCountChanges;
return Task.CompletedTask;
}
@@ -83,58 +81,29 @@ namespace MonoDevelop.Ide.Navigation
documentManager.ActiveDocumentChanged += ActiveDocChanged;
//keep nav points up to date
- textEditorService = await serviceProvider.GetService<TextEditorService> ();
- textEditorService.LineCountChanged += LineCountChanged;
- textEditorService.LineCountChangesCommitted += CommitCountChanges;
- textEditorService.LineCountChangesReset += ResetCountChanges;
- }
-
- void Workspace_LastWorkspaceItemClosed (object sender, EventArgs e)
- {
- Reset ();
- }
-
- void DocumentManager_DocumentOpened (object sender, DocumentEventArgs e)
- {
- closedHistory.RemoveAll (np => (np.Item1 as DocumentNavigationPoint)?.FileName == e.Document.FileName);
- OnClosedHistoryChanged ();
- }
-
- Task DocumentManager_DocumentClosing (object sender, DocumentCloseEventArgs e)
- {
- NavigationPoint point = GetNavPointForDoc (e.Document, true) as DocumentNavigationPoint;
- if (point == null)
- return Task.CompletedTask;
-
- closedHistory.Add (new Tuple<NavigationPoint, int> (point, documentManager.Documents.IndexOf (e.Document)));
- OnClosedHistoryChanged ();
- return Task.CompletedTask;
- }
-
- public void LogActiveDocument ()
- {
- LogActiveDocument (false);
- }
-
- public void Reset ()
- {
- history.Clear ();
- OnHistoryChanged ();
- closedHistory.Clear ();
- OnClosedHistoryChanged ();
+ IdeApp.Workspace.FileRenamedInProject += FileRenamed;
+ IdeApp.Workbench.ActiveDocumentChanged += ActiveDocChanged;
}
- public void LogActiveDocument (bool transient)
+ public static void LogActiveDocument (bool transient = false)
{
if (switching)
- return;
-
- var point = GetNavPointForActiveDoc (false);
- if (point == null)
- return;
-
+ return;
+
+ var point = GetNavPointForActiveDoc ();
+ if (point != null) {
+ LogNavigationPoint (point, transient);
+ }
+ }
+
+ public static void LogNavigationPoint (NavigationPoint point, bool transient = false)
+ {
+ if (point == null) {
+ throw new ArgumentNullException (nameof (point));
+ }
+
var item = new NavigationHistoryItem (point);
-
+
//if the current node's transient but has been around for a while, consider making it permanent
if (Current == null ||
(currentIsTransient && DateTime.Now.Subtract (Current.Created).TotalMilliseconds > TRANSIENT_TIMEOUT)) {
@@ -142,9 +111,10 @@ namespace MonoDevelop.Ide.Navigation
}
//if the current point's transient, always replace it
- if (currentIsTransient) {
- //collapse down possible extra point in history
- var backOne = history [-1];
+ if (currentIsTransient)
+ {
+ //collapse down possible extra point in history
+ var backOne = history[-1];
if (backOne != null && point.ShouldReplace (backOne.NavigationPoint)) {
// The new node is the same as the last permanent, so we can discard it
history.RemoveCurrent ();
@@ -173,10 +143,10 @@ namespace MonoDevelop.Ide.Navigation
OnHistoryChanged ();
}
-
- NavigationPoint GetNavPointForActiveDoc (bool forClosedHistory)
+
+ static NavigationPoint GetNavPointForActiveDoc ()
{
- return GetNavPointForDoc (documentManager.ActiveDocument, forClosedHistory);
+ return GetNavPointForDoc (documentManager.ActiveDocument, false);
}
NavigationPoint GetNavPointForDoc (Document doc, bool forClosedHistory)
@@ -191,9 +161,10 @@ namespace MonoDevelop.Ide.Navigation
point = navigable.BuildNavigationPoint ();
if (point != null)
return point;
- }
-
- var editBuf = doc.Editor;
+ }
+
+ #pragma warning disable CS0618, CS0612 // Type or member is obsolete
+ var editBuf = doc.Editor;
if (editBuf != null) {
if (forClosedHistory) {
point = new TextFileNavigationPoint (doc.FileName, editBuf.CaretLine, editBuf.CaretColumn);
@@ -202,8 +173,9 @@ namespace MonoDevelop.Ide.Navigation
}
if (point != null)
return point;
- }
-
+ }
+ #pragma warning restore CS0618, CS0612 // Type or member is obsolete
+
return new DocumentNavigationPoint (doc);
}
@@ -330,11 +302,13 @@ namespace MonoDevelop.Ide.Navigation
currentDoc = document;
currentDoc.Closed += HandleCurrentDocClosed;
-
+
+ #pragma warning disable CS0618, CS0612 // Type or member is obsolete
if (currentDoc.Editor != null) {
currentDoc.Editor.TextChanged += BufferTextChanged;
currentDoc.Editor.CaretPositionChanged += BufferCaretPositionChanged;
- }
+ }
+ #pragma warning restore CS0618, CS0612 // Type or member is obsolete
}
void HandleCurrentDocClosed (object sender, EventArgs e)
@@ -346,12 +320,14 @@ namespace MonoDevelop.Ide.Navigation
{
if (currentDoc == null)
return;
-
- currentDoc.Closed -= HandleCurrentDocClosed;
+
+ currentDoc.Closed -= HandleCurrentDocClosed;
+ #pragma warning disable CS0618, CS0612 // Type or member is obsolete
if (currentDoc.Editor != null) {
currentDoc.Editor.TextChanged -= BufferTextChanged;
currentDoc.Editor.CaretPositionChanged -= BufferCaretPositionChanged;
- }
+ }
+ #pragma warning restore CS0618, CS0612 // Type or member is obsolete
currentDoc = null;
}
@@ -368,23 +344,8 @@ namespace MonoDevelop.Ide.Navigation
#endregion
#region Text file line number and snippet updating
-
- void LineCountChanged (object sender, LineCountEventArgs args)
- {
- // MonoDevelop.Projects.Text.ITextFile textFile = (MonoDevelop.Projects.Text.ITextFile) sender;
- }
-
- void CommitCountChanges (object sender, TextFileEventArgs args)
- {
- // MonoDevelop.Projects.Text.ITextFile textFile = (MonoDevelop.Projects.Text.ITextFile) sender;
- }
-
- void ResetCountChanges (object sender, TextFileEventArgs args)
- {
- // MonoDevelop.Projects.Text.ITextFile textFile = (MonoDevelop.Projects.Text.ITextFile) sender;
- }
-
- void FileRenamed (object sender, ProjectFileRenamedEventArgs e)
+
+ static void FileRenamed (object sender, ProjectFileRenamedEventArgs e)
{
bool historyChanged = false, closedHistoryChanged = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
index 6d6af2cd85..e752e25c70 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Navigation/TextFileNavigationPoint.cs
@@ -38,6 +38,7 @@ using System.Linq;
namespace MonoDevelop.Ide.Navigation
{
+ [Obsolete]
public class TextFileNavigationPoint : DocumentNavigationPoint
{
int line;
@@ -45,6 +46,7 @@ namespace MonoDevelop.Ide.Navigation
int offset;
ITextSourceVersion version;
+ TextEditor buffer;
public TextFileNavigationPoint (Document doc, TextEditor buffer)
: base (doc)
@@ -54,17 +56,25 @@ namespace MonoDevelop.Ide.Navigation
offset = buffer.CaretOffset;
line = location.Line;
column = location.Column;
+ this.buffer = buffer;
}
protected override void OnDocumentClosing ()
{
- // text source version becomes invalid on document close.
- var editor = Document.Editor;
- offset = version.MoveOffsetTo (editor.Version, offset);
- var location = editor.CaretLocation;
- line = location.Line;
- column = location.Column;
+ try {
+ // text source version becomes invalid on document close.
+ if (buffer != null) {
+ if (version.BelongsToSameDocumentAs (buffer.Version))
+ offset = version.MoveOffsetTo (buffer.Version, offset);
+ var location = buffer.CaretLocation;
+ line = location.Line;
+ column = location.Column;
+ }
+ } catch (Exception e) {
+ LoggingService.LogInternalError (e);
+ }
version = null;
+ buffer = null;
}
public TextFileNavigationPoint (FilePath file, int line, int column)
@@ -121,8 +131,9 @@ namespace MonoDevelop.Ide.Navigation
} else {
var doc = IdeApp.Workbench.Documents.FirstOrDefault (d => d.Editor == editor);
if (doc != null) {
- version = editor.Version;
- offset = editor.LocationToOffset (line, column);
+ buffer = doc.Editor;
+ version = buffer.Version;
+ offset = buffer.LocationToOffset (line, column);
SetDocument (doc);
}
editor.SetCaretLocation (Math.Max (line, 1), Math.Max (column, 1));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentNavigationService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentNavigationService.cs
new file mode 100644
index 0000000000..8f3cf6a243
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentNavigationService.cs
@@ -0,0 +1,265 @@
+using System;
+using System.Composition;
+using System.Threading;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Host;
+using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.CodeAnalysis.Navigation;
+using Microsoft.CodeAnalysis.Options;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Text;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.TypeSystem;
+
+namespace MonoDevelop.Ide.RoslynServices
+{
+ [ExportWorkspaceServiceFactory (typeof (IDocumentNavigationService), ServiceLayer.Host), Shared]
+ internal sealed class VisualStudioDocumentNavigationServiceFactory : IWorkspaceServiceFactory
+ {
+ private readonly IDocumentNavigationService _singleton;
+
+ [ImportingConstructor]
+ [Obsolete (MefConstruction.ImportingConstructorMessage, error: true)]
+ private VisualStudioDocumentNavigationServiceFactory ()
+ {
+ _singleton = new MonoDevelopDocumentNavigationService ();
+ }
+
+ public IWorkspaceService CreateService (HostWorkspaceServices workspaceServices)
+ {
+ return _singleton;
+ }
+ }
+
+ class MonoDevelopDocumentNavigationService : IDocumentNavigationService
+ {
+ public bool CanNavigateToSpan (Workspace workspace, DocumentId documentId, TextSpan textSpan)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+ var document = workspace.CurrentSolution.GetDocument (documentId);
+
+ if (!IsSecondaryBuffer (workspace, document)) {
+ return true;
+ }
+
+ var text = document.GetTextSynchronously (CancellationToken.None);
+
+ var boundedTextSpan = GetSpanWithinDocumentBounds (textSpan, text.Length);
+ if (boundedTextSpan != textSpan) {
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ return CanMapFromSecondaryBufferToPrimaryBuffer (workspace, document, textSpan);
+ }
+
+ public bool CanNavigateToLineAndOffset (Workspace workspace, DocumentId documentId, int lineNumber, int offset)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+ var document = workspace.CurrentSolution.GetDocument (documentId);
+
+ if (!IsSecondaryBuffer (workspace, document)) {
+ return true;
+ }
+
+ var text = document.GetTextSynchronously (CancellationToken.None);
+ var textSpan = new TextSpan (text.Lines [lineNumber].Start + offset, 0);
+
+ return CanMapFromSecondaryBufferToPrimaryBuffer (workspace, document, textSpan);
+ }
+
+ public bool CanNavigateToPosition (Workspace workspace, DocumentId documentId, int position, int virtualSpace = 0)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+ var document = workspace.CurrentSolution.GetDocument (documentId);
+
+ if (!IsSecondaryBuffer (workspace, document)) {
+ return true;
+ }
+
+ var text = document.GetTextSynchronously (CancellationToken.None);
+
+ var boundedPosition = GetPositionWithinDocumentBounds (position, text.Length);
+ if (boundedPosition != position) {
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ var textSpan = new TextSpan (position+ virtualSpace,0);
+
+ return CanMapFromSecondaryBufferToPrimaryBuffer (workspace, document, textSpan);
+ }
+
+ public bool TryNavigateToSpan (Workspace workspace, DocumentId documentId, TextSpan textSpan, OptionSet options)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+
+ Runtime.AssertMainThread ();
+
+ var document = OpenDocument (workspace, documentId, options);
+ if (document == null) {
+ return false;
+ }
+
+ var text = document.GetTextSynchronously (CancellationToken.None);
+ var textBuffer = text.Container.GetTextBuffer ();
+
+ var boundedTextSpan = GetSpanWithinDocumentBounds (textSpan, text.Length);
+ if (boundedTextSpan != textSpan) {
+ throw new ArgumentOutOfRangeException ();
+ }
+
+ if (IsSecondaryBuffer (workspace, document) &&
+ !TryMapSpanFromSecondaryBufferToPrimaryBuffer (textSpan, workspace, document, out textSpan)) {
+ return false;
+ }
+
+ return NavigateTo (document, textSpan);
+ }
+
+ public bool TryNavigateToLineAndOffset (Workspace workspace, DocumentId documentId, int lineNumber, int offset, OptionSet options)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+
+ Runtime.AssertMainThread ();
+
+ var document = OpenDocument (workspace, documentId, options);
+ if (document == null) {
+ return false;
+ }
+
+ var textSpan = new TextSpan (offset, 0);
+
+ if (IsSecondaryBuffer (workspace, document) &&
+ !TryMapSpanFromSecondaryBufferToPrimaryBuffer (textSpan, workspace, document, out textSpan)) {
+ return false;
+ }
+
+ return NavigateTo (document, textSpan);
+ }
+
+ public bool TryNavigateToPosition (Workspace workspace, DocumentId documentId, int position, int virtualSpace, OptionSet options)
+ {
+ // Navigation should not change the context of linked files and Shared Projects.
+ documentId = workspace.GetDocumentIdInCurrentContext (documentId);
+
+ Runtime.AssertMainThread ();
+
+ var document = OpenDocument (workspace, documentId, options);
+ if (document == null) {
+ return false;
+ }
+
+ var textSpan = new TextSpan (position + virtualSpace, 0);
+
+ if (IsSecondaryBuffer (workspace, document) &&
+ !TryMapSpanFromSecondaryBufferToPrimaryBuffer (textSpan, workspace, document, out textSpan)) {
+ return false;
+ }
+
+ return NavigateTo (document, textSpan);
+ }
+
+ /// <summary>
+ /// It is unclear why, but we are sometimes asked to navigate to a position that is not
+ /// inside the bounds of the associated <see cref="Document"/>. This method returns a
+ /// position that is guaranteed to be inside the <see cref="Document"/> bounds. If the
+ /// returned position is different from the given position, then the worst observable
+ /// behavior is either no navigation or navigation to the end of the document. See the
+ /// following bugs for more details:
+ /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=112211
+ /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=136895
+ /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=224318
+ /// https://devdiv.visualstudio.com/DevDiv/_workitems?id=235409
+ /// </summary>
+ private static int GetPositionWithinDocumentBounds (int position, int documentLength)
+ {
+ return Math.Min (documentLength, Math.Max (position, 0));
+ }
+
+ /// <summary>
+ /// It is unclear why, but we are sometimes asked to navigate to a <see cref="TextSpan"/>
+ /// that is not inside the bounds of the associated <see cref="Document"/>. This method
+ /// returns a span that is guaranteed to be inside the <see cref="Document"/> bounds. If
+ /// the returned span is different from the given span, then the worst observable behavior
+ /// is either no navigation or navigation to the end of the document.
+ /// See https://github.com/dotnet/roslyn/issues/7660 for more details.
+ /// </summary>
+ private static TextSpan GetSpanWithinDocumentBounds (TextSpan span, int documentLength)
+ {
+ return TextSpan.FromBounds (GetPositionWithinDocumentBounds (span.Start, documentLength), GetPositionWithinDocumentBounds (span.End, documentLength));
+ }
+
+ private static Document OpenDocument (Workspace workspace, DocumentId documentId, OptionSet options)
+ {
+ options = options ?? workspace.Options;
+
+ // Always open the document again, even if the document is already open in the
+ // workspace. If a document is already open in a preview tab and it is opened again
+ // in a permanent tab, this allows the document to transition to the new state.
+ if (workspace.CanOpenDocuments) {
+ if (options.GetOption (NavigationOptions.PreferProvisionalTab)) {
+ // If we're just opening the provisional tab, then do not "activate" the document
+ // (i.e. don't give it focus). This way if a user is just arrowing through a set
+ // of FindAllReferences results, they don't have their cursor placed into the document.
+ //TODO: MAC we don't support this kind of opening
+ workspace.OpenDocument (documentId);
+ } else {
+ workspace.OpenDocument (documentId);
+ }
+ }
+
+ if (!workspace.IsDocumentOpen (documentId)) {
+ return null;
+ }
+
+ return workspace.CurrentSolution.GetDocument (documentId);
+ }
+
+ private bool NavigateTo (Document document, TextSpan span)
+ {
+ var proj = ((MonoDevelopWorkspace)document.Project.Solution.Workspace).GetMonoProject (document.Project);
+ var task = IdeApp.Workbench.OpenDocument (new Gui.FileOpenInformation (document.FilePath, proj) {
+ Offset = span.Start
+ });
+ return true;
+ }
+
+ private bool IsSecondaryBuffer (Workspace workspace, Document document)
+ {
+ var containedDocument = MonoDevelopHostDocumentRegistration.FromDocument (document);
+ if (containedDocument == null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static bool TryMapSpanFromSecondaryBufferToPrimaryBuffer (TextSpan spanInSecondaryBuffer, Microsoft.CodeAnalysis.Workspace workspace, Document document, out TextSpan spanInPrimaryBuffer)
+ {
+ spanInPrimaryBuffer = default;
+
+ var containedDocument = MonoDevelopHostDocumentRegistration.FromDocument (document);
+ if (containedDocument == null) {
+ return false;
+ }
+ throw new NotImplementedException ();
+ //var bufferCoordinator = containedDocument.BufferCoordinator;
+
+ //var primary = new VsTextSpan [1];
+ //var hresult = bufferCoordinator.MapSecondaryToPrimarySpan (spanInSecondaryBuffer, primary);
+
+ //spanInPrimaryBuffer = primary [0];
+
+ //return ErrorHandler.Succeeded (hresult);
+ }
+
+ private bool CanMapFromSecondaryBufferToPrimaryBuffer (Workspace workspace, Document document, TextSpan spanInSecondaryBuffer)
+ {
+ return TryMapSpanFromSecondaryBufferToPrimaryBuffer (spanInSecondaryBuffer, workspace, document, out var spanInPrimaryBuffer);
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentTrackingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentTrackingService.cs
index d1c50cc110..854e3fac3e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentTrackingService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopDocumentTrackingService.cs
@@ -25,21 +25,13 @@
// THE SOFTWARE.
using System;
-using System.Collections.Generic;
using System.Collections.Immutable;
using System.Composition;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-using System.Text;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
-using Microsoft.VisualStudio.Text.Editor;
using Roslyn.Utilities;
-using Microsoft.VisualStudio.Text;
-using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Ide.RoslynServices
{
@@ -82,8 +74,8 @@ namespace MonoDevelop.Ide.RoslynServices
void OnActiveDocumentChanged (object sender, Gui.DocumentEventArgs e)
{
+ ActiveDocumentChanged?.Invoke (this, TryGetActiveDocument ());
activeDocument = e.Document;
- ActiveDocumentChanged?.Invoke (this, GetActiveDocument ());
}
public event EventHandler<DocumentId> ActiveDocumentChanged;
@@ -94,7 +86,7 @@ namespace MonoDevelop.Ide.RoslynServices
/// workspace.
/// </summary>
/// <returns>The ID of the active document (if any)</returns>
- public DocumentId GetActiveDocument ()
+ public DocumentId TryGetActiveDocument ()
{
return activeDocument?.DocumentContext?.AnalysisDocument?.Id;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopInfoBarService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopInfoBarService.cs
index ddcf700409..2909a620c7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopInfoBarService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopInfoBarService.cs
@@ -23,8 +23,6 @@
// 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 System;
-using System.Collections.Generic;
using System.Composition;
using System.Linq;
using Microsoft.CodeAnalysis.Editor;
@@ -32,10 +30,8 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.Extensions;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.TestHooks;
-using Microsoft.VisualStudio.Imaging;
using MonoDevelop.Core;
using MonoDevelop.Ide.Gui.Components;
-using Roslyn.Utilities;
namespace MonoDevelop.Ide.RoslynServices
{
@@ -46,7 +42,8 @@ namespace MonoDevelop.Ide.RoslynServices
readonly IAsynchronousOperationListener _listener;
[ImportingConstructor]
- public MonoDevelopInfoBarService (IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListenerProvider listenerProvider)
+ public MonoDevelopInfoBarService (IThreadingContext threadingContext, IForegroundNotificationService foregroundNotificationService, IAsynchronousOperationListenerProvider listenerProvider)
+ : base (threadingContext)
{
_foregroundNotificationService = foregroundNotificationService;
_listener = listenerProvider.GetListener (FeatureAttribute.InfoBar);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopProjectCacheHostServiceFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopProjectCacheHostServiceFactory.cs
index 8b838368d7..62b13dc598 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopProjectCacheHostServiceFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopProjectCacheHostServiceFactory.cs
@@ -125,7 +125,7 @@ namespace MonoDevelop.Ide.RoslynServices
if (documentTrackingService != null) {
documentTrackingService.ActiveDocumentChanged += UpdateCache;
- UpdateCache (null, documentTrackingService.GetActiveDocument ());
+ UpdateCache (null, documentTrackingService.TryGetActiveDocument ());
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopSymbolNavigationService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopSymbolNavigationService.cs
new file mode 100644
index 0000000000..d15817fb5f
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopSymbolNavigationService.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Composition;
+using System.Threading;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.FindUsages;
+using Microsoft.CodeAnalysis.Host;
+using Microsoft.CodeAnalysis.Host.Mef;
+using Microsoft.CodeAnalysis.Navigation;
+using Microsoft.CodeAnalysis.Options;
+using MonoDevelop.Ide.TypeSystem;
+
+namespace MonoDevelop.Ide.RoslynServices
+{
+ [ExportWorkspaceServiceFactory (typeof (ISymbolNavigationService), ServiceLayer.Host), Shared]
+ internal class VisualStudioSymbolNavigationServiceFactory : IWorkspaceServiceFactory
+ {
+ private readonly ISymbolNavigationService _singleton;
+
+ [ImportingConstructor]
+ private VisualStudioSymbolNavigationServiceFactory ()
+ {
+ _singleton = new MonoDevelopSymbolNavigationService ();
+ }
+
+ public IWorkspaceService CreateService (HostWorkspaceServices workspaceServices)
+ {
+ return _singleton;
+ }
+ }
+
+ class MonoDevelopSymbolNavigationService : ISymbolNavigationService
+ {
+ public bool TryNavigateToSymbol (ISymbol symbol, Project project, OptionSet options = null, CancellationToken cancellationToken = default)
+ {
+ IdeApp.ProjectOperations.JumpToDeclaration (symbol, ((MonoDevelopWorkspace)project.Solution.Workspace).GetMonoProject (project));
+ return true;
+ }
+
+ public bool TrySymbolNavigationNotify (ISymbol symbol, Project project, CancellationToken cancellationToken)
+ {
+ IdeApp.ProjectOperations.JumpToDeclaration (symbol, ((MonoDevelopWorkspace)project.Solution.Workspace).GetMonoProject (project));
+ return true;
+ }
+
+ public bool WouldNavigateToSymbol (DefinitionItem definitionItem, Solution solution, CancellationToken cancellationToken, out string filePath, out int lineNumber, out int charOffset)
+ {
+ filePath = null;
+ lineNumber = -1;
+ charOffset = -1;
+ return true;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopTaskSchedulerFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopTaskSchedulerFactory.cs
index 400dd2ebe8..abbd25e1b4 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopTaskSchedulerFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/MonoDevelopTaskSchedulerFactory.cs
@@ -32,65 +32,57 @@ using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.CodeAnalysis.Editor.Implementation.Workspaces;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
-using Microsoft.CodeAnalysis.Utilities;
using Roslyn.Utilities;
using System.Threading;
-using MonoDevelop.Core;
+using Microsoft.VisualStudio.Threading;
namespace MonoDevelop.Ide.RoslynServices
{
[ExportWorkspaceService(typeof(IWorkspaceTaskSchedulerFactory), ServiceLayer.Host), Shared]
class MonoDevelopTaskSchedulerFactory : EditorTaskSchedulerFactory
{
+ readonly IThreadingContext _threadingContext;
+
[ImportingConstructor]
- public MonoDevelopTaskSchedulerFactory (IAsynchronousOperationListenerProvider listenerProvider) : base (listenerProvider)
+ [Obsolete (MefConstruction.ImportingConstructorMessage, error: true)]
+ public MonoDevelopTaskSchedulerFactory (IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider) : base (listenerProvider)
{
+ _threadingContext = threadingContext;
}
public override IWorkspaceTaskScheduler CreateEventingTaskQueue ()
{
- // When we are creating the workspace, we might not actually have established what the UI thread is, since
- // we might be getting created via MEF. So we'll allow the queue to be created now, and once we actually need
- // to queue something we'll then start using the task queue from there.
- // In Visual Studio, we raise these events on the UI thread. At this point we should know
- // exactly which thread that is.
- return new MonoDevelopTaskScheduler (this);
+ return new WorkspaceTaskQueue(this, new JoinableTaskFactoryTaskScheduler(_threadingContext.JoinableTaskFactory));
}
- class MonoDevelopTaskScheduler : IWorkspaceTaskScheduler
+ class JoinableTaskFactoryTaskScheduler : TaskScheduler
{
- readonly Lazy<WorkspaceTaskQueue> _queue;
- readonly WorkspaceTaskSchedulerFactory _factory;
+ readonly JoinableTaskFactory _joinableTaskFactory;
- public MonoDevelopTaskScheduler (WorkspaceTaskSchedulerFactory factory)
+ public JoinableTaskFactoryTaskScheduler (JoinableTaskFactory joinableTaskFactory)
{
- _factory = factory;
- _queue = new Lazy<WorkspaceTaskQueue> (CreateQueue);
+ _joinableTaskFactory = joinableTaskFactory;
}
- WorkspaceTaskQueue CreateQueue ()
- {
- return new WorkspaceTaskQueue (_factory, Runtime.MainTaskScheduler ?? TaskScheduler.Default);
- }
+ public override int MaximumConcurrencyLevel => 1;
- public Task ScheduleTask (Action taskAction, string taskName, CancellationToken cancellationToken = default(CancellationToken))
- {
- return _queue.Value.ScheduleTask (taskAction, taskName, cancellationToken);
- }
+ protected override IEnumerable<Task> GetScheduledTasks () => null;
- public Task<T> ScheduleTask<T> (Func<T> taskFunc, string taskName, CancellationToken cancellationToken = default(CancellationToken))
+ protected override void QueueTask (Task task)
{
- return _queue.Value.ScheduleTask (taskFunc, taskName, cancellationToken);
+ _joinableTaskFactory.RunAsync (async () => {
+ await _joinableTaskFactory.SwitchToMainThreadAsync (alwaysYield: true);
+ TryExecuteTask (task);
+ });
}
- public Task ScheduleTask (Func<Task> taskFunc, string taskName, CancellationToken cancellationToken = default(CancellationToken))
+ protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
{
- return _queue.Value.ScheduleTask (taskFunc, taskName, cancellationToken);
- }
+ if (_joinableTaskFactory.Context.IsOnMainThread) {
+ return TryExecuteTask (task);
+ }
- public Task<T> ScheduleTask<T> (Func<Task<T>> taskFunc, string taskName, CancellationToken cancellationToken = default(CancellationToken))
- {
- return _queue.Value.ScheduleTask (taskFunc, taskName, cancellationToken);
+ return false;
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/RoslynService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/RoslynService.cs
index d4f2396712..73af7704ca 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/RoslynService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.RoslynServices/RoslynService.cs
@@ -23,18 +23,14 @@
// 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 System;
using System.Collections.Generic;
-using System.Diagnostics.Contracts;
using System.Threading;
using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.Internal.Log;
-using Microsoft.CodeAnalysis.Host;
-using Microsoft.CodeAnalysis.Utilities;
using MonoDevelop.Core;
-using MonoDevelop.Ide.RoslynServices.Options;
namespace MonoDevelop.Ide.RoslynServices
{
@@ -64,13 +60,6 @@ namespace MonoDevelop.Ide.RoslynServices
FatalError.NonFatalHandler = exception => LoggingService.LogInternalError ("Roslyn non-fatal exception", exception);
AttachLoggers ();
-
- // Initialize Roslyn foreground thread data.
- ForegroundThreadAffinitizedObject.CurrentForegroundThreadData = new ForegroundThreadData (
- Runtime.MainThread,
- Runtime.MainTaskScheduler,
- ForegroundThreadDataInfo.CreateDefault (ForegroundThreadDataKind.ForcedByPackageInitialize)
- );
}
static void AttachLoggers ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs
index fe62dcecb2..6db815318f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/CodeGenerator.cs
@@ -38,6 +38,7 @@ using MonoDevelop.Ide.Editor;
namespace MonoDevelop.Ide.TypeSystem
{
+ [Obsolete("Use Roslyn APIs")]
public abstract class CodeGenerator
{
static Dictionary<string, MimeTypeExtensionNode> generators = new Dictionary<string, MimeTypeExtensionNode> ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Error.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Error.cs
index ca6a00634b..f50f72487c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Error.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/Error.cs
@@ -1,4 +1,4 @@
-//
+//
// Error.cs
//
// Author:
@@ -32,6 +32,7 @@ namespace MonoDevelop.Ide.TypeSystem
/// <summary>
/// Enum that describes the type of an error.
/// </summary>
+ [Obsolete("Use Visual Studio Editor APIs")]
public enum ErrorType
{
Unknown,
@@ -43,6 +44,7 @@ namespace MonoDevelop.Ide.TypeSystem
/// Descibes an error during parsing.
/// </summary>
[Serializable]
+ [Obsolete("Use Visual Studio Editor APIs")]
public class Error
{
readonly ErrorType errorType;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/FoldingRegion.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/FoldingRegion.cs
index 9619d25455..d9feac4537 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/FoldingRegion.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/FoldingRegion.cs
@@ -29,6 +29,7 @@ using MonoDevelop.Ide.Editor;
namespace MonoDevelop.Ide.TypeSystem
{
[Serializable]
+ [Obsolete ("Use the Microsoft.VisualStudio.Text APIs")]
public class FoldingRegion
{
static string defaultName = "...";
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/IFoldingParser.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/IFoldingParser.cs
index 66ea540bed..3b2798395f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/IFoldingParser.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/IFoldingParser.cs
@@ -1,30 +1,32 @@
-//
-// IFoldingParser.cs
-//
-// Author:
-// Mike Krüger <mkrueger@xamarin.com>
-//
-// Copyright (c) 2015 Xamarin Inc. (http://xamarin.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.
-
-
+//
+// IFoldingParser.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.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 System;
+
namespace MonoDevelop.Ide.TypeSystem
{
/// <summary>
@@ -34,6 +36,7 @@ namespace MonoDevelop.Ide.TypeSystem
/// This is useful for opening a document the first time to have some folding regions as start that are folded by default.
/// Otherwise an irritating screen update will occur.
/// </summary>
+ [Obsolete("Use Visual Studio Editor APIs")]
public interface IFoldingParser
{
ParsedDocument Parse (string fileName, string content);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MiscellaneousFilesWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MiscellaneousFilesWorkspace.cs
new file mode 100644
index 0000000000..7e3cecfdc0
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MiscellaneousFilesWorkspace.cs
@@ -0,0 +1,282 @@
+// Copyright (c) Microsoft
+//
+// 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 System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
+using Microsoft.CodeAnalysis.Text;
+using Microsoft.VisualStudio.Composition;
+using Microsoft.VisualStudio.Text;
+using MonoDevelop.Ide.Composition;
+
+namespace MonoDevelop.Ide.TypeSystem
+{
+ /// <summary>
+ /// Tracks open .cs documents not claimed by any primary workspace. Standalone files
+ /// and open documents that haven't been added to the workspace yet during solution load.
+ /// </summary>
+ /// <remarks>
+ /// Scenarios:
+ /// * Document opening:
+ /// - not part of any workspace yet
+ /// - already part of a different (primary) workspace
+ /// * Open document workspace registration changed:
+ /// - another workspace opens and claims our document
+ /// - another workspace closes and releases our document
+ /// - we didn't know we lost the document, need to re-sync
+ /// - we knew we lost the document
+ /// * Document closing
+ /// - it was in our workspace
+ /// - it was not in our workspace
+ /// </remarks>
+ [Export]
+ class MiscellaneousFilesWorkspace : Workspace
+ {
+ ConcurrentDictionary<WorkspaceRegistration, OpenDocumentInfo> openDocuments = new ConcurrentDictionary<WorkspaceRegistration, OpenDocumentInfo> ();
+
+ ProjectId defaultProjectId;
+ const string DefaultProjectName = "MiscellaneousProject";
+
+ [ImportingConstructor]
+ public MiscellaneousFilesWorkspace ()
+ : base (CompositionManager.Instance.HostServices, WorkspaceKind.MiscellaneousFiles)
+ {
+ defaultProjectId = ProjectId.CreateNewId (DefaultProjectName);
+
+ var compilationOptions = new CSharpCompilationOptions (OutputKind.ConsoleApplication);
+
+ var projectInfo = ProjectInfo.Create (
+ defaultProjectId,
+ VersionStamp.Create (),
+ DefaultProjectName,
+ DefaultProjectName,
+ LanguageNames.CSharp,
+ compilationOptions: compilationOptions,
+ parseOptions: CSharpParseOptions.Default.WithLanguageVersion (LanguageVersion.Latest),
+ metadataReferences: DefaultReferences).WithHasAllInformation (false);
+ OnProjectAdded (projectInfo);
+ }
+
+ class OpenDocumentInfo
+ {
+ public DocumentId DocumentId;
+ public SourceTextContainer SourceTextContainer;
+ public string FilePath;
+ }
+
+ /// <summary>
+ /// This should be called when a new document is opened in the IDE.
+ /// </summary>
+ public void OnDocumentOpened (string filePath, ITextBuffer buffer)
+ {
+ var textContainer = buffer?.AsTextContainer ();
+ if (!IsSupportedDocument (filePath) || textContainer == null) {
+ return;
+ }
+
+ var workspaceRegistration = GetWorkspaceRegistration (textContainer);
+ workspaceRegistration.WorkspaceChanged += Registration_WorkspaceChanged;
+
+ var openDocumentInfo = new OpenDocumentInfo {
+ SourceTextContainer = textContainer,
+ FilePath = filePath
+ };
+ openDocuments[workspaceRegistration] = openDocumentInfo;
+
+ if (workspaceRegistration.Workspace != null) {
+ return;
+ }
+
+ AddDocument (workspaceRegistration, openDocumentInfo);
+ }
+
+ /// <summary>
+ /// This is called by Roslyn when a SourceTextContainer's document is added or removed from a workspace
+ /// </summary>
+ /// <param name="sender">The associated <see cref="WorkspaceRegistration"/> object.</param>
+ void Registration_WorkspaceChanged (object sender, EventArgs e)
+ {
+ var workspaceRegistration = (WorkspaceRegistration)sender;
+
+ openDocuments.TryGetValue (workspaceRegistration, out var openDocumentInfo);
+
+ if (workspaceRegistration.Workspace == null) {
+ // The workspace was taken from us and released and we have only asynchronously found out now.
+ // We already have the file open in our workspace, but the global mapping of source text container
+ // to the workspace that owns it needs to be updated once more.
+ if (openDocumentInfo.DocumentId != null) {
+ RegisterText (openDocumentInfo.SourceTextContainer);
+ } else {
+ // properly claim by adding and opening a new document
+ AddDocument (workspaceRegistration, openDocumentInfo);
+ }
+ } else if (workspaceRegistration.Workspace != this) {
+ // another workspace has claimed the document, remove it from our workspace
+ RemoveDocument (openDocumentInfo);
+ }
+ }
+
+ /// <summary>
+ /// This should be called when an open document in the IDE is closed.
+ /// </summary>
+ public void OnDocumentClosed (string filePath, ITextBuffer buffer)
+ {
+ var textContainer = buffer?.AsTextContainer ();
+ if (!IsSupportedDocument (filePath) || textContainer == null) {
+ return;
+ }
+
+ var workspaceRegistration = GetWorkspaceRegistration (textContainer);
+ workspaceRegistration.WorkspaceChanged -= Registration_WorkspaceChanged;
+
+ if (openDocuments.TryRemove (workspaceRegistration, out var openDocumentInfo)) {
+ RemoveDocument (openDocumentInfo);
+ }
+ }
+
+ /// <summary>
+ /// Create a new DocumentId and a new Document, add that to the workspace and open in the text container
+ /// </summary>
+ /// <param name="registration"></param>
+ /// <param name="openDocumentInfo"></param>
+ void AddDocument (WorkspaceRegistration registration, OpenDocumentInfo openDocumentInfo)
+ {
+ var filePath = openDocumentInfo.FilePath;
+ var sourceTextContainer = openDocumentInfo.SourceTextContainer;
+
+ var documentId = DocumentId.CreateNewId (defaultProjectId, filePath);
+ openDocumentInfo.DocumentId = documentId;
+
+ var documentInfo = DocumentInfo.Create (
+ documentId,
+ Path.GetFileName (filePath),
+ sourceCodeKind: GetSourceCodeKind (filePath),
+ filePath: filePath,
+ loader: TextLoader.From (sourceTextContainer, VersionStamp.Create ()));
+
+ OnDocumentAdded (documentInfo);
+ OnDocumentOpened (documentId, sourceTextContainer);
+ }
+
+ /// <summary>
+ /// If the DocumentId is currently part of our workspace, remove this document
+ /// from our workspace.
+ /// </summary>
+ void RemoveDocument (OpenDocumentInfo openDocumentInfo)
+ {
+ var documentId = openDocumentInfo.DocumentId;
+ if (documentId != null) {
+ OnDocumentClosed (documentId, EmptyTextLoader.Instance);
+ OnDocumentRemoved (documentId);
+ openDocumentInfo.DocumentId = null;
+ }
+ }
+
+ static SourceCodeKind GetSourceCodeKind (string filePath)
+ {
+ var sourceCodeKind = SourceCodeKind.Regular;
+ if (filePath.EndsWith (".csx", StringComparison.OrdinalIgnoreCase)) {
+ sourceCodeKind = SourceCodeKind.Script;
+ }
+
+ return sourceCodeKind;
+ }
+
+ bool IsSupportedDocument (string filePath)
+ {
+ return filePath != null && (
+ filePath.EndsWith (".cs", StringComparison.OrdinalIgnoreCase) ||
+ filePath.EndsWith (".csx", StringComparison.OrdinalIgnoreCase));
+ }
+
+ IEnumerable<MetadataReference> defaultReferences;
+ IEnumerable<MetadataReference> DefaultReferences {
+ get {
+ if (defaultReferences == null) {
+ defaultReferences = new[]
+ {
+ typeof(object).Assembly
+ }.Select (CreateReferenceFromAssembly).ToArray ();
+ }
+
+ return defaultReferences;
+ }
+ }
+
+ MetadataReference CreateReferenceFromAssembly (Assembly assembly)
+ {
+ var filePath = assembly.Location;
+ var reference = MetadataReference.CreateFromFile (filePath);
+ return reference;
+ }
+
+ public override bool CanApplyChange (ApplyChangesKind feature)
+ {
+ if (feature == ApplyChangesKind.ChangeDocument) {
+ return true;
+ }
+
+ return base.CanApplyChange (feature);
+ }
+
+ protected override void ApplyDocumentTextChanged (DocumentId id, SourceText text)
+ {
+ var openDocument = openDocuments.FirstOrDefault (doc => doc.Value.DocumentId == id);
+ if (openDocument.Value != null) {
+ var textBuffer = openDocument.Value.SourceTextContainer.GetTextBuffer ();
+ SetText (textBuffer, text.ToString ());
+ }
+ }
+
+ static void SetText (ITextBuffer textBuffer, string content)
+ {
+ content = content ?? "";
+
+ using (var edit = textBuffer.CreateEdit (EditOptions.DefaultMinimalChange, reiteratedVersionNumber: null, editTag: 1)) {
+ edit.Replace (0, textBuffer.CurrentSnapshot.Length, content);
+ edit.Apply ();
+ }
+ }
+
+ class EmptyTextLoader : TextLoader
+ {
+ public static EmptyTextLoader Instance = new EmptyTextLoader ();
+
+ SourceText emptySourceText = SourceText.From (string.Empty);
+
+ private EmptyTextLoader ()
+ {
+ }
+
+ public override Task<TextAndVersion> LoadTextAndVersionAsync (Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
+ {
+ return Task.FromResult (TextAndVersion.Create (emptySourceText, VersionStamp.Default));
+ }
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopMetadataReferenceManager.FileKey.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopMetadataReferenceManager.FileKey.cs
new file mode 100644
index 0000000000..22bb9e52e9
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopMetadataReferenceManager.FileKey.cs
@@ -0,0 +1,69 @@
+// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using Roslyn.Utilities;
+
+namespace MonoDevelop.Ide.TypeSystem
+{
+ partial class MonoDevelopMetadataReferenceManager
+ {
+ internal struct FileKey : IEquatable<FileKey>
+ {
+ /// <summary>
+ /// Full case-insensitive path.
+ /// </summary>
+ public readonly string FullPath;
+
+ /// <summary>
+ /// Last write time (UTC).
+ /// </summary>
+ public readonly DateTime Timestamp;
+
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="fullPath">Full path.</param>
+ /// <param name="timestamp">Last write time (UTC).</param>
+ public FileKey (string fullPath, DateTime timestamp)
+ {
+ Debug.Assert (PathUtilities.IsAbsolute (fullPath));
+ Debug.Assert (timestamp.Kind == DateTimeKind.Utc);
+
+ FullPath = fullPath;
+ Timestamp = timestamp;
+ }
+
+ /// <exception cref="IOException"/>
+ public static FileKey Create (string fullPath)
+ {
+ return new FileKey (fullPath, FileUtilities.GetFileTimeStamp (fullPath));
+ }
+
+ public override int GetHashCode ()
+ {
+ return Hash.Combine (
+ StringComparer.OrdinalIgnoreCase.GetHashCode (this.FullPath),
+ this.Timestamp.GetHashCode ());
+ }
+
+ public override bool Equals (object obj)
+ {
+ return obj is FileKey && Equals ((FileKey)obj);
+ }
+
+ public override string ToString ()
+ {
+ return string.Format ("'{0}'@{1}", FullPath, Timestamp);
+ }
+
+ public bool Equals (FileKey other)
+ {
+ return
+ this.Timestamp == other.Timestamp &&
+ string.Equals (this.FullPath, other.FullPath, StringComparison.OrdinalIgnoreCase);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceText.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceText.cs
index f1c9d55043..dbd10fa5bb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceText.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopSourceText.cs
@@ -42,6 +42,7 @@ using System.Collections.Immutable;
namespace MonoDevelop.Ide.TypeSystem
{
+ [Obsolete]
abstract class SnapshotSourceText : SourceText
{
protected abstract ITextSnapshot Snapshot { get; }
@@ -104,6 +105,7 @@ namespace MonoDevelop.Ide.TypeSystem
#endregion
}
+ [Obsolete]
sealed class MonoDevelopSourceText : SourceText
{
readonly ITextSource doc;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
index 258c10ea79..5065ea25ee 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopTextLoader.cs
@@ -35,6 +35,7 @@ using System;
namespace MonoDevelop.Ide.TypeSystem
{
+ [Obsolete]
class MonoDevelopTextLoader : TextLoader
{
readonly string fileName;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.OpenDocumentsData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.OpenDocumentsData.cs
index 64c48e149e..c86079c589 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.OpenDocumentsData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.OpenDocumentsData.cs
@@ -37,13 +37,13 @@ namespace MonoDevelop.Ide.TypeSystem
{
internal class OpenDocumentsData
{
- readonly Dictionary<DocumentId, (SourceTextContainer Container, TextEditor Editor, DocumentContext Context)> openDocuments =
- new Dictionary<DocumentId, (SourceTextContainer, TextEditor, DocumentContext)> ();
+ readonly Dictionary<DocumentId, (SourceTextContainer Container, DocumentContext Context)> openDocuments =
+ new Dictionary<DocumentId, (SourceTextContainer, DocumentContext)> ();
- internal void Add (DocumentId documentId, SourceTextContainer container, TextEditor editor, DocumentContext context)
+ internal void Add (DocumentId documentId, SourceTextContainer container, DocumentContext context)
{
lock (openDocuments) {
- openDocuments.Add (documentId, (container, editor, context));
+ openDocuments.Add (documentId, (container, context));
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs
index ee817de06b..b0a37fe68c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectSystemHandler.cs
@@ -1,4 +1,4 @@
-//
+//
// MonoDevelopWorkspace.ProjectSystemHandler.cs
//
// Author:
@@ -34,6 +34,7 @@ using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Host;
+using Microsoft.CodeAnalysis.Text;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor.Projection;
using MonoDevelop.Projects;
@@ -176,7 +177,9 @@ namespace MonoDevelop.Ide.TypeSystem
foreach (var proj in mdProjects) {
if (token.IsCancellationRequested)
return null;
- if (proj is MonoDevelop.Projects.DotNetProject netProj && !netProj.SupportsRoslyn)
+ if (!(proj is DotNetProject netProj))
+ continue;
+ if (!netProj.SupportsRoslyn)
continue;
var tp = LoadProject (proj, token, null).ContinueWith (t => {
if (!t.IsCanceled)
@@ -275,15 +278,7 @@ namespace MonoDevelop.Ide.TypeSystem
lock (addLock) {
if (!added) {
added = true;
- workspace.OnSolutionAdded (solutionInfo);
- var service = (MonoDevelopPersistentStorageLocationService)workspace.Services.GetService<IPersistentStorageLocationService> ();
- service.SetupSolution (workspace);
- lock (workspace.generatedFiles) {
- foreach (var generatedFile in workspace.generatedFiles) {
- if (!workspace.IsDocumentOpen (generatedFile.Key.Id))
- workspace.OnDocumentOpened (generatedFile.Key.Id, generatedFile.Value);
- }
- }
+ OnSolutionOpened (workspace, solutionInfo);
}
}
// Check for modified projects here after the solution has been added to the workspace
@@ -296,6 +291,47 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ void OnSolutionOpened (MonoDevelopWorkspace workspace, SolutionInfo solutionInfo)
+ {
+ workspace.OnSolutionAdded (solutionInfo);
+
+ var service = (MonoDevelopPersistentStorageLocationService)workspace.Services.GetService<IPersistentStorageLocationService> ();
+ service.SetupSolution (workspace);
+
+ AssignOpenDocumentsToWorkspace (workspace);
+ OpenGeneratedFiles (workspace);
+ }
+
+ internal static void AssignOpenDocumentsToWorkspace (MonoDevelopWorkspace workspace, bool newEditorOnly = false)
+ {
+ if (!IdeApp.IsInitialized)
+ return;
+
+ foreach (var openDocument in IdeApp.Workbench.Documents) {
+ if (newEditorOnly && openDocument.Editor != null) {
+ continue;
+ }
+ var filePath = openDocument.FileName;
+ var solution = workspace.CurrentSolution;
+ var documentIds = solution.GetDocumentIdsWithFilePath (filePath);
+ foreach (var documentId in documentIds) {
+ if (!workspace.IsDocumentOpen (documentId)) {
+ workspace.InformDocumentOpen (documentId, openDocument.TextBuffer.AsTextContainer (), openDocument);
+ }
+ }
+ }
+ }
+
+ static void OpenGeneratedFiles (MonoDevelopWorkspace workspace)
+ {
+ lock (workspace.generatedFiles) {
+ foreach (var generatedFile in workspace.generatedFiles) {
+ if (!workspace.IsDocumentOpen (generatedFile.Key.Id))
+ workspace.OnDocumentOpened (generatedFile.Key.Id, generatedFile.Value);
+ }
+ }
+ }
+
static bool CanGenerateAnalysisContextForNonCompileable (MonoDevelop.Projects.Project p, MonoDevelop.Projects.ProjectFile f)
{
var mimeType = IdeServices.DesktopService.GetMimeTypeForUri (f.FilePath);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectionData.cs
index c76b2ad572..17915dc7e1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.ProjectionData.cs
@@ -34,6 +34,7 @@ namespace MonoDevelop.Ide.TypeSystem
{
public partial class MonoDevelopWorkspace
{
+ [Obsolete]
internal class ProjectionData
{
readonly object projectionListUpdateLock = new object ();
@@ -116,6 +117,7 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ [Obsolete]
internal class ProjectionEntry : IDisposable
{
public MonoDevelop.Projects.ProjectFile File;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
index f2a19e6fe0..948667bb78 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -71,6 +71,11 @@ namespace MonoDevelop.Ide.TypeSystem
// by the compilations being freed out of memory due to only being weakly referenced, and recomputing them on
// a case by case basis.
BackgroundCompiler backgroundCompiler;
+
+ // Background parser is an optimized task queue for the roslyn use-case, where a parse that's already in-progress
+ // is not canceled, but used later on to help incremental parsing.
+ readonly BackgroundParser backgroundParser;
+
internal readonly WorkspaceId Id;
CancellationTokenSource src = new CancellationTokenSource ();
@@ -114,7 +119,7 @@ namespace MonoDevelop.Ide.TypeSystem
ProjectMap = new ProjectDataMap (this);
ProjectHandler = new ProjectSystemHandler (this, ProjectMap, Projections);
manager = new Lazy<MonoDevelopMetadataReferenceManager> (() => Services.GetService<MonoDevelopMetadataReferenceManager> ());
- metadataHandler = new Lazy<MetadataReferenceHandler> (() => new MetadataReferenceHandler (MetadataReferenceManager, ProjectMap));
+ metadataHandler = new Lazy<MetadataReferenceHandler> (() => new MetadataReferenceHandler (MetadataReferenceManager, ProjectMap));
}
internal async Task Initialize ()
@@ -126,6 +131,8 @@ namespace MonoDevelop.Ide.TypeSystem
});
backgroundCompiler = new BackgroundCompiler (this);
+ backgroundParser = new BackgroundParser (this);
+ backgroundParser.Start ();
var cacheService = Services.GetService<IWorkspaceCacheService> ();
if (cacheService != null)
@@ -429,18 +436,17 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- internal void InformDocumentOpen (DocumentId documentId, TextEditor editor, DocumentContext context)
+ internal void InformDocumentOpen (DocumentId documentId, SourceTextContainer sourceTextContainer, DocumentContext context)
{
- var document = InternalInformDocumentOpen (documentId, editor, context);
+ var document = InternalInformDocumentOpen (documentId, sourceTextContainer, context, true);
if (document as Document != null) {
foreach (var linkedDoc in ((Document)document).GetLinkedDocumentIds ()) {
- InternalInformDocumentOpen (linkedDoc, editor, context);
+ InternalInformDocumentOpen (linkedDoc, sourceTextContainer, context, false);
}
}
- OnDocumentContextUpdated (documentId);
}
- TextDocument InternalInformDocumentOpen (DocumentId documentId, TextEditor editor, DocumentContext context)
+ TextDocument InternalInformDocumentOpen (DocumentId documentId, SourceTextContainer sourceTextContainer, DocumentContext context, bool isCurrentContext)
{
var project = this.CurrentSolution.GetProject (documentId.ProjectId);
if (project == null)
@@ -449,12 +455,11 @@ namespace MonoDevelop.Ide.TypeSystem
if (document == null || OpenDocuments.Contains (documentId)) {
return document;
}
- var textContainer = editor.TextView.TextBuffer.AsTextContainer ();
- OpenDocuments.Add (documentId, textContainer, editor, context);
+ OpenDocuments.Add (documentId, sourceTextContainer, context);
if (document is Document) {
- OnDocumentOpened (documentId, textContainer);
+ OnDocumentOpened (documentId, sourceTextContainer, isCurrentContext);
} else {
- OnAdditionalDocumentOpened (documentId, textContainer);
+ OnAdditionalDocumentOpened (documentId, sourceTextContainer, isCurrentContext);
}
return document;
}
@@ -464,7 +469,9 @@ namespace MonoDevelop.Ide.TypeSystem
protected override void OnDocumentClosing (DocumentId documentId)
{
base.OnDocumentClosing (documentId);
- OpenDocuments.Remove (documentId);
+ OpenDocuments.Remove (documentId);
+
+ backgroundParser.CancelParse (documentId);
}
// internal override bool CanChangeActiveContextDocument {
@@ -485,8 +492,6 @@ namespace MonoDevelop.Ide.TypeSystem
return;
var loader = new MonoDevelopTextLoader (filePath);
var document = this.GetDocument (analysisDocument);
- // FIXME: Is this really needed?
- OpenDocuments.Remove (analysisDocument);
if (document == null) {
var ad = this.GetAdditionalDocument (analysisDocument);
@@ -503,11 +508,34 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- public override void CloseDocument (DocumentId documentId)
- {
+ internal static void UpdateText (SourceText newText, Microsoft.VisualStudio.Text.ITextBuffer buffer, Microsoft.VisualStudio.Text.EditOptions options)
+ {
+ using (var edit = buffer.CreateEdit (options, reiteratedVersionNumber: null, editTag: null)) {
+ var oldSnapshot = buffer.CurrentSnapshot;
+ var oldText = oldSnapshot.AsText ();
+ var changes = newText.GetTextChanges (oldText);
+ //if (Microsoft.CodeAnalysis.Workspace.TryGetWorkspace(oldText.Container, out var workspace))
+ //{
+ // var undoService = workspace.Services.GetService<ISourceTextUndoService>();
+ // undoService.BeginUndoTransaction(oldSnapshot);
+ //}
+
+ foreach (var change in changes) {
+ edit.Replace (change.Span.Start, change.Span.Length, change.NewText);
+ }
+
+ edit.Apply ();
+ }
}
- //FIXME: this should NOT be async. our implementation is doing some very expensive things like formatting that it shouldn't need to do.
+ protected override void OnDocumentTextChanged (Document document)
+ {
+ base.OnDocumentTextChanged (document);
+
+ backgroundParser.Parse (document);
+ }
+
+ //FIXME: this should NOT be async. our implementation is doing some very expensive things like formatting that it shouldn't need to do.
protected override void ApplyDocumentTextChanged (DocumentId id, SourceText text)
{
lock (projectModifyLock)
@@ -525,7 +553,14 @@ namespace MonoDevelop.Ide.TypeSystem
hostDocument.UpdateText (text);
return;
}
-
+ if (IsDocumentOpen (id)) {
+ var textBuffer = (await document.GetTextAsync (CancellationToken.None)).Container.TryGetTextBuffer ();
+
+ if (textBuffer != null) {
+ UpdateText (text, textBuffer, Microsoft.VisualStudio.Text.EditOptions.DefaultMinimalChange);
+ return;
+ }
+ }
var (projection, filePath) = Projections.Get (document.FilePath);
var data = TextFileProvider.Instance.GetTextEditorData (filePath, out bool isOpen);
// Guard against already done changes in linked files.
@@ -1183,6 +1218,7 @@ namespace MonoDevelop.Ide.TypeSystem
// correct openDocument ids - they may change due to project reload.
OpenDocuments.CorrectDocumentIds (project, t.Result);
OnProjectReloaded (t.Result);
+ ProjectSystemHandler.AssignOpenDocumentsToWorkspace (this, newEditorOnly: true);
}
} catch (Exception e) {
LoggingService.LogError ("Error while reloading project " + project.Name, e);
@@ -1197,6 +1233,11 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ internal override void SetDocumentContext (DocumentId documentId)
+ {
+ base.OnDocumentContextUpdated (documentId);
+ }
+
#endregion
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs
index 1636ff62d1..a2ca7bcecd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/ParsedDocument.cs
@@ -36,6 +36,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.TypeSystem
{
[Flags]
+ [Obsolete ("Not supported in new editor")]
public enum ParsedDocumentFlags
{
None = 0,
@@ -52,6 +53,7 @@ namespace MonoDevelop.Ide.TypeSystem
HasCustomCompletionExtension = 4
}
+ [Obsolete ("Not supported in new editor")]
public abstract class ParsedDocument
{
DateTime lastWriteTimeUtc = DateTime.UtcNow;
@@ -106,13 +108,6 @@ namespace MonoDevelop.Ide.TypeSystem
{
return (await GetErrorsAsync (cancellationToken).ConfigureAwait (false)).Any (e => e.ErrorType == ErrorType.Error);
}
-
- [Obsolete ("Use the HasErrorsAsync method for cancellation and async support.")]
- public bool HasErrors {
- get {
- return GetErrorsAsync ().Result.Any (e => e.ErrorType == ErrorType.Error);
- }
- }
/// <summary>
/// Gets or sets the language ast used by specific language backends.
@@ -121,13 +116,6 @@ namespace MonoDevelop.Ide.TypeSystem
get;
set;
}
-
-
- [Obsolete("Do not use this system anymore. Use the analysisDocument.GetSemanticModelAsync () instead.")]
- public T GetAst<T> () where T : class
- {
- return Ast as T;
- }
public ParsedDocument ()
{
@@ -138,7 +126,8 @@ namespace MonoDevelop.Ide.TypeSystem
this.fileName = fileName;
}
}
-
+
+ [Obsolete]
public class DefaultParsedDocument : ParsedDocument
{
public DefaultParsedDocument (string fileName) : base (fileName)
@@ -215,6 +204,7 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ [Obsolete ("Old editor")]
public static class FoldingUtilities
{
static bool IncompleteOrSingleLine (DomRegion region)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
index 609f2f990d..d39f535166 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/StockIcons.cs
@@ -38,7 +38,7 @@ namespace MonoDevelop.Ide.TypeSystem
return "md-" + GetAccess (symbol.DeclaredAccessibility) + GetGlobal (symbol) + GetSource (symbol);
}
- internal static string GetAccess (Accessibility accessibility)
+ internal static string GetAccess (Microsoft.CodeAnalysis.Accessibility accessibility)
{
switch (accessibility) {
case Microsoft.CodeAnalysis.Accessibility.NotApplicable:
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
index 0fbbc8ec02..b22f633bc6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
@@ -37,6 +37,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.TypeSystem
{
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public sealed class ParseOptions
{
string buildAction;
@@ -62,7 +63,9 @@ namespace MonoDevelop.Ide.TypeSystem
}
[Flags]
- public enum DisabledProjectionFeatures {
+ [Obsolete ("Use the Visual Studio Editor APIs")]
+ public enum DisabledProjectionFeatures
+ {
None = 0,
Completion = 1 << 0,
SemanticHighlighting = 1 << 1,
@@ -71,7 +74,8 @@ namespace MonoDevelop.Ide.TypeSystem
All = Completion | SemanticHighlighting | Tooltips
}
- public class ParsedDocumentProjection
+ [Obsolete ("Use the Visual Studio Editor APIs")]
+ public class ParsedDocumentProjection
{
public ParsedDocument ParsedDocument { get; private set; }
@@ -92,6 +96,7 @@ namespace MonoDevelop.Ide.TypeSystem
/// a given file. This is required for adding information to the type system service to make the file contents available
/// for type lookup (code completion, resolving etc.).
/// </summary>
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public abstract class TypeSystemParser
{
/// <summary>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
index 3124ad9a0d..bc3c1014fa 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
@@ -34,6 +34,7 @@ using Microsoft.CodeAnalysis;
namespace MonoDevelop.Ide.TypeSystem
{
+ [Obsolete ("Use the Visual Studio Editor APIs")]
class TypeSystemParserNode : TypeExtensionNode
{
const string ApiDefinitionBuildAction = "ObjcBindingApiDefinition";
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
index cf888d20a3..f5c5477c4a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
@@ -1,4 +1,4 @@
-//
+//
// IdeApp.TypeSystemService.cs
//
// Author:
@@ -54,8 +54,8 @@ namespace MonoDevelop.Ide.TypeSystem
RootWorkspace rootWorkspace;
CompositionManager compositionManager;
+ [Obsolete]
IEnumerable<TypeSystemParserNode> parsers;
- string[] filesSkippedInParseThread = new string[0];
public Microsoft.CodeAnalysis.SyntaxAnnotation InsertionModeAnnotation { get; } = new Microsoft.CodeAnalysis.SyntaxAnnotation();
@@ -65,6 +65,9 @@ namespace MonoDevelop.Ide.TypeSystem
internal MonoDevelopRuleSetManager RuleSetManager { get; } = new MonoDevelopRuleSetManager ();
+ static MiscellaneousFilesWorkspace miscellaneousFilesWorkspace;
+
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal IEnumerable<TypeSystemParserNode> Parsers {
get {
return parsers;
@@ -78,21 +81,29 @@ namespace MonoDevelop.Ide.TypeSystem
{
IntitializeTrackedProjectHandling ();
- serviceProvider.WhenServiceInitialized<DocumentManager> (s => documentManager = s);
+ serviceProvider.WhenServiceInitialized<DocumentManager> (s => {
+ documentManager = s;
+ miscellaneousFilesWorkspace = Composition.CompositionManager.GetExportedValue<MiscellaneousFilesWorkspace> ();
+ documentManager.DocumentOpened += OnDocumentOpened;
+ documentManager.DocumentClosed += OnDocumentClosed;
+ });
serviceProvider.WhenServiceInitialized<RootWorkspace> (s => {
rootWorkspace = s;
rootWorkspace.ActiveConfigurationChanged += HandleActiveConfigurationChanged;
});
RoslynServices.RoslynService.Initialize ();
- CleanupCache ();
- parsers = AddinManager.GetExtensionNodes<TypeSystemParserNode> ("/MonoDevelop/TypeSystem/Parser");
+ CleanupCache ();
+
+ #pragma warning disable CS0618, 612 // Type or member is obsolete
+ parsers = AddinManager.GetExtensionNodes<TypeSystemParserNode> ("/MonoDevelop/TypeSystem/Parser");
bool initialLoad = true;
AddinManager.AddExtensionNodeHandler ("/MonoDevelop/TypeSystem/Parser", delegate (object sender, ExtensionNodeEventArgs args) {
//refresh entire list to respect insertbefore/insertafter ordering
if (!initialLoad)
parsers = AddinManager.GetExtensionNodes<TypeSystemParserNode> ("/MonoDevelop/TypeSystem/Parser");
});
+ #pragma warning restore CS0618, 612 // Type or member is obsolete
initialLoad = false;
try {
@@ -115,6 +126,10 @@ namespace MonoDevelop.Ide.TypeSystem
FileService.FileChanged -= FileService_FileChanged;
if (rootWorkspace != null)
rootWorkspace.ActiveConfigurationChanged -= HandleActiveConfigurationChanged;
+ if (documentManager != null) {
+ documentManager.DocumentOpened -= OnDocumentOpened;
+ documentManager.DocumentClosed -= OnDocumentClosed;
+ }
FinalizeTrackedProjectHandling ();
return Task.CompletedTask;
}
@@ -159,18 +174,6 @@ namespace MonoDevelop.Ide.TypeSystem
});
}
- public void RemoveSkippedFile (FilePath fileName)
- {
- filesSkippedInParseThread = filesSkippedInParseThread.Where (f => f != fileName).ToArray ();
- }
-
- public void AddSkippedFile (FilePath fileName)
- {
- if (filesSkippedInParseThread.Any (f => f == fileName))
- return;
- filesSkippedInParseThread = filesSkippedInParseThread.Concat (new string [] { fileName }).ToArray ();
- }
-
internal async Task<MonoDevelopWorkspace> CreateEmptyWorkspace ()
{
var ws = new MonoDevelopWorkspace (compositionManager.HostServices, null, this);
@@ -178,12 +181,14 @@ namespace MonoDevelop.Ide.TypeSystem
return ws;
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public TypeSystemParser GetParser (string mimeType, string buildAction = BuildAction.Compile)
{
var n = GetTypeSystemParserNode (mimeType, buildAction);
return n != null ? n.Parser : null;
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal TypeSystemParserNode GetTypeSystemParserNode (string mimeType, string buildAction)
{
foreach (var mt in desktopService.GetMimeTypeInheritanceChain (mimeType)) {
@@ -194,6 +199,7 @@ namespace MonoDevelop.Ide.TypeSystem
return null;
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public Task<ParsedDocument> ParseFile (Project project, string fileName, CancellationToken cancellationToken = default(CancellationToken))
{
StringTextSource text;
@@ -209,6 +215,7 @@ namespace MonoDevelop.Ide.TypeSystem
return ParseFile (project, fileName, desktopService.GetMimeTypeForUri (fileName), text, cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public Task<ParsedDocument> ParseFile (ParseOptions options, string mimeType, CancellationToken cancellationToken = default(CancellationToken))
{
if (options == null)
@@ -234,6 +241,7 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal bool CanParseProjections (Project project, string mimeType, string fileName)
{
var projectFile = project.GetProjectFile (fileName);
@@ -245,21 +253,25 @@ namespace MonoDevelop.Ide.TypeSystem
return parser.CanGenerateProjection (mimeType, projectFile.BuildAction, project.SupportedLanguages);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public Task<ParsedDocument> ParseFile (Project project, string fileName, string mimeType, ITextSource content, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseFile (new ParseOptions { FileName = fileName, Project = project, Content = content }, mimeType, cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public Task<ParsedDocument> ParseFile (Project project, string fileName, string mimeType, TextReader content, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseFile (project, fileName, mimeType, new StringTextSource (content.ReadToEnd ()), cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
public Task<ParsedDocument> ParseFile (Project project, IReadonlyTextDocument data, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseFile (project, data.FileName, data.MimeType, data, cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal async Task<ParsedDocumentProjection> ParseProjection (ParseOptions options, string mimeType, CancellationToken cancellationToken = default(CancellationToken))
{
if (options == null)
@@ -313,16 +325,19 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal Task<ParsedDocumentProjection> ParseProjection (Project project, string fileName, string mimeType, ITextSource content, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseProjection (new ParseOptions { FileName = fileName, Project = project, Content = content }, mimeType, cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal Task<ParsedDocumentProjection> ParseProjection (Project project, string fileName, string mimeType, TextReader content, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseProjection (project, fileName, mimeType, new StringTextSource (content.ReadToEnd ()), cancellationToken);
}
+ [Obsolete ("Use the Visual Studio Editor APIs")]
internal Task<ParsedDocumentProjection> ParseProjection (Project project, IReadonlyTextDocument data, CancellationToken cancellationToken = default(CancellationToken))
{
return ParseProjection (project, data.FileName, data.MimeType, data, cancellationToken);
@@ -703,29 +718,29 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
- internal void InformDocumentOpen (Microsoft.CodeAnalysis.DocumentId analysisDocument, TextEditor editor, DocumentContext context)
+ internal void InformDocumentOpen (Microsoft.CodeAnalysis.DocumentId analysisDocument, SourceTextContainer sourceTextContainer, DocumentContext context)
{
foreach (var w in workspaces) {
if (w.Contains (analysisDocument.ProjectId)) {
- w.InformDocumentOpen (analysisDocument, editor, context);
+ w.InformDocumentOpen (analysisDocument, sourceTextContainer, context);
return;
}
}
if (!gotDocumentRequestError) {
gotDocumentRequestError = true;
- LoggingService.LogWarning ("Can't open requested document : " + analysisDocument + ":" + editor.FileName);
+ LoggingService.LogWarning ("Can't open requested document : " + analysisDocument);
}
}
- internal void InformDocumentOpen (Microsoft.CodeAnalysis.Workspace ws, Microsoft.CodeAnalysis.DocumentId analysisDocument, TextEditor editor, DocumentContext context)
+ internal void InformDocumentOpen (Microsoft.CodeAnalysis.Workspace ws, Microsoft.CodeAnalysis.DocumentId analysisDocument, SourceTextContainer sourceTextContainer, DocumentContext context)
{
if (ws == null)
throw new ArgumentNullException (nameof (ws));
if (analysisDocument == null)
throw new ArgumentNullException (nameof (analysisDocument));
- if (editor == null)
- throw new ArgumentNullException (nameof (editor));
- ((MonoDevelopWorkspace)ws).InformDocumentOpen (analysisDocument, editor, context);
+ if (sourceTextContainer == null)
+ throw new ArgumentNullException (nameof (sourceTextContainer));
+ ((MonoDevelopWorkspace)ws).InformDocumentOpen (analysisDocument, sourceTextContainer, context);
}
static bool gotDocumentRequestError = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs
index b69853d603..8b07b1cd4f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService_WorkspaceHandling.cs
@@ -1,4 +1,4 @@
-//
+//
// IdeApp.TypeSystemService.cs
//
// Author:
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.Text;
using MonoDevelop.Core;
using System.Collections.Generic;
using System.Threading;
@@ -36,6 +37,7 @@ using System.Linq;
using System.Collections.Immutable;
using System.Collections.Concurrent;
using System.ComponentModel;
+using Microsoft.VisualStudio.Text;
namespace MonoDevelop.Ide.TypeSystem
{
@@ -257,6 +259,106 @@ namespace MonoDevelop.Ide.TypeSystem
}
}
+ void OnDocumentOpened (object sender, Gui.DocumentEventArgs e)
+ {
+ var filePath = e.Document.FileName;
+ var textBuffer = e.Document.GetContent<ITextBuffer> ();
+ if (textBuffer == null || filePath == null) {
+ return;
+ }
+
+ // First offer the document to the primary workspace and see if it's owned by it.
+ // This is the common case, so avoid adding the document to the miscellaneous workspace
+ // unnecessarily, as it will be immediately removed anyway.
+ TryOpenDocumentInWorkspace (e, filePath, textBuffer);
+
+ // Only use misc workspace with the new editor; old editor has its own
+ if (e.Document.Editor == null) {
+ // If the primary workspace didn't claim the document notify the miscellaneous workspace
+ miscellaneousFilesWorkspace.OnDocumentOpened (filePath, textBuffer);
+ }
+ }
+
+ private void TryOpenDocumentInWorkspace (Gui.DocumentEventArgs e, FilePath filePath, ITextBuffer textBuffer)
+ {
+ var project = e.Document.Project;
+ if (project == null || !project.IsCompileable (filePath)) {
+ return;
+ }
+
+ var workspace = GetWorkspace (project.ParentSolution);
+ if (workspace == emptyWorkspace) {
+ return;
+ }
+
+ var projectId = workspace.GetProjectId (project);
+
+ var documentIds = workspace.CurrentSolution.GetDocumentIdsWithFilePath (filePath);
+ var bestDoc = documentIds.FirstOrDefault ();
+ if (documentIds.Length > 1) {
+ foreach (var documentId in documentIds) {
+ // projectId == null, when opening document from Solution pad, for file in shared project
+ if (projectId == null) {
+ var p = workspace.GetMonoProject (documentId.ProjectId);
+ if (p == null)
+ continue;
+ var solConf = p.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ if (solConf == null || !solConf.BuildEnabledForItem (p))
+ continue;
+ if (p == p.ParentSolution.StartupItem) {
+ workspace.InformDocumentOpen (documentId, textBuffer.AsTextContainer (), e.Document);
+ return;
+ }
+ bestDoc = documentId;
+ } else if (documentId.ProjectId == projectId) {
+ workspace.InformDocumentOpen (documentId, textBuffer.AsTextContainer (), e.Document);
+ return;
+ }
+ }
+ }
+
+ if (bestDoc != null) {
+ workspace.InformDocumentOpen (bestDoc, textBuffer.AsTextContainer (), e.Document);
+ }
+ }
+
+ void OnDocumentClosed (object sender, Gui.DocumentEventArgs e)
+ {
+ var filePath = e.Document.FileName;
+ var project = e.Document.Project;
+ if (project == null || filePath == null || !project.IsCompileable (filePath)) {
+ return;
+ }
+
+ var textBuffer = e.Document.GetContent<ITextBuffer> ();
+ if (textBuffer == null) {
+ return;
+ }
+
+ // Only use misc workspace with the new editor; old editor has its own
+ if (e.Document.Editor == null) {
+ // In the common case the primary workspace will own the document, so shut down
+ // miscellaneous workspace first to avoid adding and then immediately removing
+ // the document to the miscellaneous workspace
+ miscellaneousFilesWorkspace.OnDocumentClosed (filePath, textBuffer);
+ }
+
+ TryCloseDocumentInWorkspace (filePath, project);
+ }
+
+ private void TryCloseDocumentInWorkspace (FilePath filePath, MonoDevelop.Projects.Project project)
+ {
+ var workspace = GetWorkspace (project.ParentSolution);
+ if (workspace == emptyWorkspace) {
+ return;
+ }
+
+ var documentIds = workspace.CurrentSolution.GetDocumentIdsWithFilePath (filePath);
+ foreach (var documentId in documentIds) {
+ workspace.InformDocumentClose (documentId, filePath);
+ }
+ }
+
public Microsoft.CodeAnalysis.Project GetCodeAnalysisProject (MonoDevelop.Projects.Project project)
{
if (project == null)
@@ -282,14 +384,16 @@ namespace MonoDevelop.Ide.TypeSystem
//We assume that since we have projectId and project is not found in solution
//project is being loaded(waiting MSBuild to return list of source files)
var taskSource = new TaskCompletionSource<Microsoft.CodeAnalysis.Project> ();
+ var registration = cancellationToken.Register (() => taskSource.TrySetCanceled ());
EventHandler<WorkspaceChangeEventArgs> del = (s, e) => {
if (e.Kind == WorkspaceChangeKind.SolutionAdded || e.Kind == WorkspaceChangeKind.SolutionReloaded) {
proj = workspace.CurrentSolution.GetProject (projectId);
- if (proj != null)
- taskSource.SetResult (proj);
+ if (proj != null) {
+ registration.Dispose ();
+ taskSource.TrySetResult (proj);
+ }
}
};
- cancellationToken.Register (taskSource.SetCanceled);
workspace.WorkspaceChanged += del;
try {
proj = await taskSource.Task;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs
index 813285b378..826fcc0a25 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Updater/AddinsUpdateHandler.cs
@@ -98,7 +98,7 @@ namespace MonoDevelop.Ide.Updater
{
if (args.Button == Xwt.PointerButton.Left) {
HideAlert ();
- AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
+ AddinManagerWindow.Run (IdeApp.Workbench.RootWindow.Visible ? IdeApp.Workbench.RootWindow : null);
}
}
@@ -113,7 +113,7 @@ namespace MonoDevelop.Ide.Updater
}
HideAlert ();
- AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
+ AddinManagerWindow.Run (IdeApp.Workbench.RootWindow.Visible ? IdeApp.Workbench.RootWindow : null);
}
public static void HideAlert ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomeWindowProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomeWindowProvider.cs
index ffe880beb9..32ffa1fed5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomeWindowProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/IWelcomeWindowProvider.cs
@@ -51,8 +51,9 @@ namespace MonoDevelop.Ide.WelcomePage
[TypeExtensionPoint]
public interface IWelcomeWindowProvider
{
- Task<Window> CreateWindow ();
- void ShowWindow (Window window, WelcomeWindowShowOptions options);
- void HideWindow (Window window);
+ Task ShowWindow (WelcomeWindowShowOptions options);
+ void HideWindow ();
+ bool IsWindowVisible { get; }
+ Window WindowInstance { get; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageCommands.cs
index d365140109..071ef4790f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageCommands.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageCommands.cs
@@ -47,8 +47,7 @@ namespace MonoDevelop.Ide.WelcomePage
protected override void Update (CommandInfo info)
{
info.Text = WelcomePageService.HasWindowImplementation ? GettextCatalog.GetString ("Start Window") : GettextCatalog.GetString ("Welcome Page");
- info.Enabled = (WelcomePageService.HasWindowImplementation && !WelcomePageService.WelcomeWindowVisible)
- || (!WelcomePageService.HasWindowImplementation && !WelcomePageService.WelcomePageVisible);
+ info.Enabled = WelcomePageService.HasWindowImplementation || (!WelcomePageService.HasWindowImplementation && !WelcomePageService.WelcomePageVisible);
base.Update (info);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFeedItem.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFeedItem.cs
index bbb40db9a5..c6bcf176cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFeedItem.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFeedItem.cs
@@ -25,19 +25,17 @@
// THE SOFTWARE.
using System;
-using Gtk;
-using MonoDevelop.Core;
-using System.Xml.Linq;
+using System.Text;
using System.Text.RegularExpressions;
+using System.Xml.Linq;
+using Gtk;
using MonoDevelop.Components;
using MonoDevelop.Components.AtkCocoaHelper;
-using System.Text;
-
-using System.Runtime.InteropServices;
+using MonoDevelop.Core;
namespace MonoDevelop.Ide.WelcomePage
{
- class WelcomePageFeedItem : Gtk.EventBox
+ class WelcomePageFeedItem : EventBox
{
static string linkUnderlinedFormat;
static string linkFormat;
@@ -255,7 +253,7 @@ namespace MonoDevelop.Ide.WelcomePage
}
}
- public new string Title {
+ public string Title {
get {
return text;
}
@@ -265,7 +263,7 @@ namespace MonoDevelop.Ide.WelcomePage
}
}
- public new string Subtitle {
+ public string Subtitle {
get {
return subtitle;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFirstRun.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFirstRun.cs
index e55c9eb896..3ff9c85e71 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFirstRun.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageFirstRun.cs
@@ -148,19 +148,6 @@ namespace MonoDevelop.Ide.WelcomePage
void RenderPreview (Cairo.Context context, Gdk.Point position, double opacity)
{
if (brandedIcon != null) {
- /* if (previewSurface == null) {
- previewSurface = new SurfaceWrapper (context, brandedIcon);
- }
- double scale = PreviewSize / previewSurface.Width;
-
- context.Save ();
- context.Translate (position.X, position.Y);
- context.Scale (scale * IconScale, scale * IconScale);
- context.SetSourceSurface (previewSurface.Surface, -previewSurface.Width / 2, -previewSurface.Height / 2);
- context.PaintWithAlpha (opacity);
- context.Restore ();
- */
-
double scale = PreviewSize / brandedIcon.Width;
context.Save ();
context.Translate (position.X, position.Y);
@@ -258,7 +245,6 @@ namespace MonoDevelop.Ide.WelcomePage
SurfaceWrapper titleSurface;
SurfaceWrapper textSurface;
SurfaceWrapper buttonSurface;
- SurfaceWrapper previewSurface;
protected override void OnDestroyed ()
{
@@ -271,8 +257,6 @@ namespace MonoDevelop.Ide.WelcomePage
textSurface.Dispose ();
if (buttonSurface != null)
buttonSurface.Dispose ();
- if (previewSurface != null)
- previewSurface.Dispose ();
base.OnDestroyed ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageService.cs
index 8913334cd3..c1fed8a9a6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.WelcomePage/WelcomePageService.cs
@@ -38,7 +38,15 @@ namespace MonoDevelop.Ide.WelcomePage
static bool visible;
static WelcomePageFrame welcomePage;
static IWelcomeWindowProvider welcomeWindowProvider;
- static Window welcomeWindow;
+ static IWelcomeWindowProvider WelcomeWindowProvider {
+ get {
+ if (welcomeWindowProvider == null) {
+ welcomeWindowProvider = AddinManager.GetExtensionObjects<IWelcomeWindowProvider> ().FirstOrDefault ();
+ }
+
+ return welcomeWindowProvider;
+ }
+ }
public static event EventHandler WelcomePageShown;
public static event EventHandler WelcomePageHidden;
@@ -70,11 +78,11 @@ namespace MonoDevelop.Ide.WelcomePage
public static bool WelcomePageVisible => visible;
- public static bool WelcomeWindowVisible => welcomeWindow != null && visible;
+ public static bool WelcomeWindowVisible => WelcomeWindowProvider?.IsWindowVisible ?? false;
- public static Window WelcomeWindow => welcomeWindow;
+ public static Window WelcomeWindow => WelcomeWindowProvider?.WindowInstance;
- public static bool HasWindowImplementation => AddinManager.GetExtensionObjects<IWelcomeWindowProvider> ().Any ();
+ public static bool HasWindowImplementation => WelcomeWindowProvider != null;
public static async void ShowWelcomePageOrWindow (WelcomeWindowShowOptions options = null)
{
@@ -90,8 +98,8 @@ namespace MonoDevelop.Ide.WelcomePage
public static void HideWelcomePageOrWindow ()
{
- if (HasWindowImplementation && welcomeWindowProvider != null && welcomeWindow != null) {
- welcomeWindowProvider.HideWindow (welcomeWindow);
+ if (WelcomeWindowProvider != null) {
+ WelcomeWindowProvider.HideWindow ();
} else {
HideWelcomePage (true);
}
@@ -127,19 +135,11 @@ namespace MonoDevelop.Ide.WelcomePage
public static async Task<bool> ShowWelcomeWindow (WelcomeWindowShowOptions options)
{
- if (welcomeWindowProvider == null) {
- welcomeWindowProvider = AddinManager.GetExtensionObjects<IWelcomeWindowProvider> ().FirstOrDefault ();
- if (welcomeWindowProvider == null)
- return false;
- }
-
- if (welcomeWindow == null) {
- welcomeWindow = await welcomeWindowProvider.CreateWindow ();
- if (welcomeWindow == null)
- return false;
+ if (WelcomeWindowProvider == null) {
+ return false;
}
- welcomeWindowProvider.ShowWindow (welcomeWindow, options);
+ await WelcomeWindowProvider.ShowWindow (options);
visible = true;
return true;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index a2c04dbf6f..896f8f32ba 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -1,8 +1,9 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <Import Project="..\..\..\external\vs-editor-core\src\RoslynIntegration\RoslynIntegration.projitems" Label="Shared Mac"
+ Condition="Exists('..\..\..\external\vs-editor-core\src\RoslynIntegration\RoslynIntegration.projitems') And ('$(Configuration)' == 'DebugMac' OR '$(Configuration)' == 'ReleaseMac')" />
<Import Project="..\..\..\MonoDevelop.props" />
- <Import Project="$(ReferencesRoslyn)" />
- <Import Project="$(ReferencesVSEditor)" />
<Import Project="$(ReferencesGtk)" />
+ <Import Project="$(ReferencesVSEditor)" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -22,80 +23,18 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin32|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin32|AnyCPU' " />
<ItemGroup>
- <Reference Include="ICSharpCode.SharpZipLib">
- <HintPath>..\..\..\packages\JetBrains.SharpZipLib.Stripped.0.87.20170615.10\lib\net40\ICSharpCode.SharpZipLib.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Abstractions">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Abstractions.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Abstractions.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Core">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Core.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Core.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Core.Contracts">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Core.Contracts.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Core.Contracts.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Edge">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Edge.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Edge.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Orchestrator.RunnableProjects.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Orchestrator.RunnableProjects.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.TemplateEngine.Utils">
- <HintPath>..\..\..\packages\Microsoft.TemplateEngine.Utils.1.0.0-beta3-20171117-314\lib\net45\Microsoft.TemplateEngine.Utils.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Composition, Version=15.6.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <HintPath>..\..\..\packages\Microsoft.VisualStudio.Composition.15.6.36\lib\net45\Microsoft.VisualStudio.Composition.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <HintPath>..\..\..\packages\Microsoft.VisualStudio.Threading.15.8.209\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.VisualStudio.Validation, Version=15.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <HintPath>..\..\..\packages\Microsoft.VisualStudio.Validation.15.3.32\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
- <Private>False</Private>
- </Reference>
<Reference Include="PresentationCore" Condition=" '$(Configuration)' == 'DebugWin32' Or '$(Configuration)' == 'ReleaseWin32' " />
<Reference Include="PresentationFramework" Condition=" '$(Configuration)' == 'DebugWin32' Or '$(Configuration)' == 'ReleaseWin32' " />
<Reference Include="System" />
- <Reference Include="System.Collections.Immutable">
- <HintPath>..\..\..\packages\System.Collections.Immutable.1.5.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
- </Reference>
<Reference Include="System.ComponentModel.Composition" />
- <Reference Include="System.Composition.AttributedModel">
- <HintPath>..\..\..\packages\System.Composition.AttributedModel.1.0.31\lib\netstandard1.0\System.Composition.AttributedModel.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.Convention">
- <HintPath>..\..\..\packages\Microsoft.Composition.1.0.31\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.Hosting">
- <HintPath>..\..\..\packages\System.Composition.Hosting.1.0.31\lib\netstandard1.0\System.Composition.Hosting.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.Runtime">
- <HintPath>..\..\..\packages\System.Composition.Runtime.1.0.31\lib\netstandard1.0\System.Composition.Runtime.dll</HintPath>
- </Reference>
- <Reference Include="System.Composition.TypedParts">
- <HintPath>..\..\..\packages\System.Composition.TypedParts.1.0.31\lib\netstandard1.0\System.Composition.TypedParts.dll</HintPath>
- </Reference>
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
- <Reference Include="System.IO.Compression">
- <HintPath>..\..\..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
- </Reference>
- <Reference Include="System.Reflection.Metadata">
- <HintPath>..\..\..\packages\System.Reflection.Metadata.1.6.0\lib\netstandard1.1\System.Reflection.Metadata.dll</HintPath>
- </Reference>
+ <Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Threading.Tasks.Dataflow, Version=4.6.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
- <HintPath>..\..\..\packages\System.Threading.Tasks.Dataflow.4.7.0\lib\netstandard1.0\System.Threading.Tasks.Dataflow.dll</HintPath>
- <Private>True</Private>
- </Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows" Condition=" '$(Configuration)' == 'DebugWin32' Or '$(Configuration)' == 'ReleaseWin32' " />
@@ -108,10 +47,6 @@
<Reference Include="Xamarin.Mac" Condition=" '$(Configuration)' == 'DebugMac' Or '$(Configuration)' == 'ReleaseMac' ">
<HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
</Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
<!-- when building with xbuild on Unix, $(MSBuildToolsPath) is like `$prefix/lib/mono/xbuild/*/bin`
when building with msbuild on Unix, $(MSBuildToolsPath) is like `$prefix/lib/mono/msbuild/*/bin`
Prefer referencing msbuild 15.* assemblies over 14.1 . At runtime, we use correct one anyway
@@ -128,14 +63,26 @@
<HintPath>$(MSBuildToolsPath)\Microsoft.Build.Utilities.Core.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="Microsoft.VisualStudio.CodingConventions">
- <HintPath>..\..\..\build\bin\Microsoft.VisualStudio.CodingConventions.dll</HintPath>
- <Private>False</Private>
- </Reference>
- <Reference Include="YamlDotNet">
- <HintPath>..\..\..\packages\YamlDotNet.Signed.5.2.1\lib\net45\YamlDotNet.dll</HintPath>
- </Reference>
- <Reference Include="System.Net.Http" />
+ <PackageReference Include="Microsoft.TemplateEngine.Edge" Version="$(NuGetVersionMicrosoftTemplateEngine)" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(NuGetVersionMicrosoftTemplateEngine)" PrivateAssets="runtime" />
+ <PackageReference Include="Microsoft.VisualStudio.CodingConventions" Version="1.1.20180503.2" PrivateAssets="runtime" />
+ <PackageReference Include="YamlDotNet.Signed" Version="5.2.1" />
+ <IncludeCopyLocal Include="ICSharpCode.NRefactory.Cecil.dll" />
+ <IncludeCopyLocal Include="ICSharpCode.NRefactory.CSharp.dll" />
+ <IncludeCopyLocal Include="ICSharpCode.NRefactory.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Abstractions.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Core.Contracts.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Core.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Edge.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects.dll" />
+ <IncludeCopyLocal Include="Microsoft.TemplateEngine.Utils.dll" />
+ <IncludeCopyLocal Include="Mono.Addins.Gui.dll" />
+ <IncludeCopyLocal Include="Mono.Debugging.dll" />
+ <IncludeCopyLocal Include="Xamarin.Mac.dll" />
+ <IncludeCopyLocal Include="Xwt.dll" />
+ <IncludeCopyLocal Include="Xwt.Gtk.dll" />
+ <IncludeCopyLocal Include="Xwt.XamMac.dll" />
+ <IncludeCopyLocal Include="YamlDotNet.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MonoDevelop.Core\MonoDevelop.Core.csproj">
@@ -3072,6 +3019,7 @@
<EmbeddedResource Include="icons\code-actions\lightbulb-screwdriver-16~sel%402x.png" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="MonoDevelop.Components.Commands\ICustomCommandTarget.cs" />
<Compile Include="MonoDevelop.Ide.Commands\CustomStringTagProvider.cs" />
<Compile Include="MonoDevelop.Ide.Commands\EditCommands.cs" />
<Compile Include="MonoDevelop.Ide.Commands\FileCommands.cs" />
@@ -3084,15 +3032,19 @@
<Compile Include="MonoDevelop.Ide.Composition\CommonEditorAssetServiceFactory.cs" />
<Compile Include="MonoDevelop.Ide.Composition\CompositionManager.cs" />
<Compile Include="MonoDevelop.Ide.Composition\EditorExperimentationServiceInternal.cs" />
- <Compile Include="MonoDevelop.Ide.Composition\InlineRenameService.cs" />
+ <Compile Include="MonoDevelop.Ide.Composition\EditorWaitIndicator.cs" />
+ <Compile Include="MonoDevelop.Ide.Composition\ExtensionSelector.cs" />
<Compile Include="MonoDevelop.Ide.Composition\JoinableTaskContextHost.cs" />
+ <Compile Include="MonoDevelop.Ide.Composition\ObscuringTipManager.cs" />
+ <!--<Compile Include="MonoDevelop.Ide.Composition\PeekResultFactory.cs" />-->
<Compile Include="MonoDevelop.Ide.Composition\PlatformCatalog.cs" />
<Compile Include="MonoDevelop.Ide.Composition\PlatformExtensions.cs" />
<Compile Include="MonoDevelop.Ide.Composition\PreviewFactoryService.cs" />
<Compile Include="MonoDevelop.Ide.Composition\RoslynWaitIndicator.cs" />
- <Compile Include="MonoDevelop.Ide.Composition\StreamingFindUsagesPresenter.cs" />
<Compile Include="MonoDevelop.Ide.Composition\SuggestedActionCategoryRegistryService.cs" />
- <Compile Include="MonoDevelop.Ide.Editor\ITextEditorFactoryService.cs" />
+ <Compile Include="MonoDevelop.Ide.TypeSystem\MiscellaneousFilesWorkspace.cs" />
+ <Compile Include="MonoDevelop.Ide\MimeTypeCatalog.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor\ITextEditorInitializationService.cs" />
<Compile Include="MonoDevelop.Ide.Gui\DisplayBindingService.cs" />
<Compile Include="MonoDevelop.Ide.Gui\BackgroundProgressMonitor.cs" />
<Compile Include="MonoDevelop.Ide.Gui\StatusProgressMonitor.cs" />
@@ -4216,14 +4168,12 @@
<Compile Include="MonoDevelop.Ide.Desktop\ThermalMonitor.cs" />
<Compile Include="MonoDevelop.Ide\PlatformThermalStatusEventArgs.cs" />
<Compile Include="MonoDevelop.Ide.TypeSystem\MonoDevelopFrameworkAssemblyPathResolver.cs" />
+ <Compile Include="MonoDevelop.Ide.RoslynServices\MonoDevelopDocumentNavigationService.cs" />
+ <Compile Include="MonoDevelop.Ide.RoslynServices\MonoDevelopSymbolNavigationService.cs" />
+ <Compile Include="MonoDevelop.Ide.TypeSystem\MonoDevelopMetadataReferenceManager.FileKey.cs" />
+ <Compile Include="MonoDevelop.Ide.WelcomePage\IWelcomeWindowProvider.cs" />
<Compile Include="MonoDevelop.Ide.RoslynServices\RoslynLogger.cs" />
<Compile Include="MonoDevelop.Ide.RoslynServices\RoslynFileLogger.cs" />
- <Compile Include="MonoDevelop.Components\Mac\KeyCodes.cs" />
- <Compile Include="MonoDevelop.Ide.WelcomePage\IWelcomeWindowProvider.cs" />
- <Compile Include="MonoDevelop.Components\Mac\NativeViewHelper.cs" />
- <Compile Include="MonoDevelop.Components\Mac\NSStackViewExtensions.cs" />
- <Compile Include="MonoDevelop.Components\Mac\NSLabel.cs" />
- <Compile Include="MonoDevelop.Components\Mac\NSLine.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Documents\DocumentController.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Documents\DocumentControllerRole.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Documents\DocumentModel.cs" />
@@ -4277,12 +4227,23 @@
<Compile Include="MonoDevelop.Ide.Extensions\StartupInfo.cs" />
<Compile Include="MonoDevelop.Ide\IdeServices.cs" />
<Compile Include="MonoDevelop.Ide.Tasks\TaskSeverity.cs" />
+ <Compile Include="MonoDevelop.Ide.Composition\VisualStudioMefHostServices.cs" />
<Compile Include="MonoDevelop.Ide.Projects\NewSolutionRunConfigurationDialog.cs" />
<Compile Include="MonoDevelop.Ide.TypeSystem\HackyWorkspaceFilesCache.cs" />
+ <Compile Include="..\..\..\external\vs-editor-core\src\Editor\Text\Impl\BaseViewImpl\VacuousTextDataModel.cs" Link="DeleteAfterWebToolsFixesDep\VacuousTextDataModel.cs" />
+ <Compile Include="..\..\..\external\vs-editor-core\src\Editor\Text\Util\TextUIUtil\VacuousTextViewModel.cs" Link="DeleteAfterWebToolsFixesDep\VacuousTextViewModel.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor\EditorPreferences.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Dialogs\NewFolderDialog.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Pads.ProjectPad\IProjectPadNodeSelector.cs" />
<Compile Include="MonoDevelop.Components.PropertyGrid\IPropertyGrid.cs" />
</ItemGroup>
+ <ItemGroup Condition="'$(Configuration)' == 'DebugMac' OR '$(Configuration)' == 'ReleaseMac'">
+ <Compile Include="MonoDevelop.Components\Mac\KeyCodes.cs" />
+ <Compile Include="MonoDevelop.Components\Mac\NativeViewHelper.cs" />
+ <Compile Include="MonoDevelop.Components\Mac\NSStackViewExtensions.cs" />
+ <Compile Include="MonoDevelop.Components\Mac\NSLabel.cs" />
+ <Compile Include="MonoDevelop.Components\Mac\NSLine.cs" />
+ </ItemGroup>
<ItemGroup>
<Data Include="options\DefaultEditingLayout.xml" />
<Data Include="options\MonoDevelopProperties.xml" />
@@ -4292,7 +4253,6 @@
<None Include="MonoDevelop.Ide.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
- <None Include="packages.config" />
<None Include="MonoDevelop.Ide.Editor.Highlighting\syntaxes\FSharp\F#Comments.tmPreferences" />
<None Include="MonoDevelop.Ide.Editor.Highlighting\syntaxes\AppleStrings\AppleStrings.sublime-syntax" />
<None Include="MonoDevelop.Ide.Editor.Highlighting\VSCodeImport\make\OSSREADME.json" />
@@ -4359,6 +4319,8 @@
<InternalsVisibleTo Include="MonoDevelop.Refactoring.Tests" />
<InternalsVisibleTo Include="MonoDevelop.SourceEditor" />
<InternalsVisibleTo Include="MonoDevelop.SourceEditor2" />
+ <InternalsVisibleTo Include="MonoDevelop.TextEditor" />
+ <InternalsVisibleTo Include="MonoDevelop.TextEditor.Wpf" />
<InternalsVisibleTo Include="MonoDevelop.TextEditor.Tests" />
<InternalsVisibleTo Include="MonoDevelop.UnitTesting" />
<InternalsVisibleTo Include="MonoDevelop.VBNetBinding" />
@@ -4376,11 +4338,6 @@
<InternalsVisibleTo Include="Xamarin.OSXEditor" />
<InternalsVisibleTo Include="Xamarin.Sketches" />
</ItemGroup>
- <ItemGroup>
- <Folder Include="icons\code-actions\" />
- <Folder Include="MonoDevelop.Ide.Gui.Documents\" />
- <Folder Include="MonoDevelop.Ide.Gui.Shell\" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
<Copy SourceFiles="@(Data)" DestinationFolder="..\..\..\build\data\%(Data.RelativeDir)" SkipUnchangedFiles="true" />
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
index 48a2efebf2..d4af636a05 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
@@ -26,13 +26,16 @@
using System;
using System.Collections.Generic;
-using Mono.Addins;
-using MonoDevelop.Ide.Desktop;
-using MonoDevelop.Core;
using System.IO;
+using System.Threading.Tasks;
+using Microsoft.VisualStudio.Utilities;
+using Mono.Addins;
using MonoDevelop.Components;
using MonoDevelop.Components.MainToolbar;
using System.Threading.Tasks;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Desktop;
+using MonoDevelop.Ide.Fonts;
namespace MonoDevelop.Ide
{
@@ -159,19 +162,23 @@ namespace MonoDevelop.Ide
PlatformService.OpenFolder (folderPath, selectFiles);
}
- public string GetMimeTypeForRoslynLanguage (string language)
- {
- return PlatformService.GetMimeTypeForRoslynLanguage (language);
- }
+ public string GetMimeTypeForRoslynLanguage (string roslynLanguage)
+ => MimeTypeCatalog.Instance.GetMimeTypeForRoslynLanguage (roslynLanguage);
- public IEnumerable<string> GetMimeTypeInheritanceChainForRoslynLanguage (string language)
- {
- var mime = GetMimeTypeForRoslynLanguage (language);
- if (mime == null) {
- return null;
- }
- return GetMimeTypeInheritanceChain (mime);
- }
+ public IEnumerable<string> GetMimeTypeInheritanceChainForRoslynLanguage (string roslynLanguage)
+ => MimeTypeCatalog.Instance.GetMimeTypeInheritanceChainForRoslynLanguage (roslynLanguage);
+
+ public string GetRoslynLanguageForMimeType (string mimeType)
+ => MimeTypeCatalog.Instance.GetRoslynLanguageForMimeType (mimeType);
+
+ public string GetMimeTypeForContentType (IContentType contentType)
+ => MimeTypeCatalog.Instance.GetMimeTypeForContentType (contentType);
+
+ public IEnumerable<string> GetMimeTypeInheritanceChainForContentType (IContentType contentType)
+ => MimeTypeCatalog.Instance.GetMimeTypeInheritanceChainForContentType (contentType);
+
+ public IContentType GetContentTypeForMimeType (string mimeType)
+ => MimeTypeCatalog.Instance.GetContentTypeForMimeType (mimeType);
public string GetMimeTypeForUri (string uri)
{
@@ -185,7 +192,7 @@ namespace MonoDevelop.Ide
public bool GetMimeTypeIsText (string mimeType)
{
- return PlatformService.GetMimeTypeIsText (mimeType);
+ return MimeTypeCatalog.Instance.GetMimeTypeIsText (mimeType);
}
public bool GetFileIsText (string file, string mimeType = null)
@@ -230,12 +237,12 @@ namespace MonoDevelop.Ide
public bool GetMimeTypeIsSubtype (string subMimeType, string baseMimeType)
{
- return PlatformService.GetMimeTypeIsSubtype (subMimeType, baseMimeType);
+ return MimeTypeCatalog.Instance.GetMimeTypeIsSubtype (subMimeType, baseMimeType);
}
public IEnumerable<string> GetMimeTypeInheritanceChain (string mimeType)
{
- return PlatformService.GetMimeTypeInheritanceChain (mimeType);
+ return MimeTypeCatalog.Instance.GetMimeTypeInheritanceChain (mimeType);
}
public IEnumerable<string> GetMimeTypeInheritanceChainForFile (string filename)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
index b09ed7619e..b61a5ca2b2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs
@@ -418,7 +418,7 @@ namespace MonoDevelop.Ide
}
} else if (file.FileName.HasExtension ("mpack")) {
var service = new SetupService (AddinManager.Registry);
- AddinManagerWindow.RunToInstallFile (Workbench.RootWindow,
+ AddinManagerWindow.RunToInstallFile (Workbench.RootWindow.Visible ? Workbench.RootWindow : null,
service,
file.FileName.FullPath);
} else {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
index d2990eed1b..5984eb5d87 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdePreferences.cs
@@ -1,4 +1,4 @@
-// IdePreferences.cs
+// IdePreferences.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -75,8 +75,12 @@ namespace MonoDevelop.Ide
public class IdePreferences
{
+ readonly Lazy<EditorPreferences> editor;
+ internal EditorPreferences Editor { get => editor.Value; }
+
internal IdePreferences ()
{
+ editor = new Lazy<EditorPreferences> (() => new EditorPreferences ());
}
internal RoslynPreferences Roslyn => TypeSystemService.Preferences;
@@ -129,11 +133,6 @@ namespace MonoDevelop.Ide
public readonly ConfigurationProperty<bool> IncludeKeywordsInCompletionList = ConfigurationProperty.Create ("IncludeKeywordsInCompletionList", true);
public readonly ConfigurationProperty<bool> IncludeCodeSnippetsInCompletionList = ConfigurationProperty.Create ("IncludeCodeSnippetsInCompletionList", true);
- [Obsolete ("Unused use CompletionOptionsHideAdvancedMembers")]
- public readonly ConfigurationProperty<bool> FilterCompletionListByEditorBrowsable = ConfigurationProperty.Create ("FilterCompletionListByEditorBrowsable", true);
- [Obsolete ("Unused use CompletionOptionsHideAdvancedMembers")]
- public readonly ConfigurationProperty<bool> IncludeEditorBrowsableAdvancedMembers = ConfigurationProperty.Create ("IncludeEditorBrowsableAdvancedMembers", true);
-
public readonly ConfigurationProperty<bool> CompletionOptionsHideAdvancedMembers = ConfigurationProperty.Create ("CompletionOptionsHideAdvancedMembers", true);
public Theme UserInterfaceTheme {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
index 82c899249e..d8627ecd80 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
@@ -27,19 +27,18 @@
using System;
using System.Collections.Generic;
-using Mono.Addins;
using System.IO;
-using MonoDevelop.Ide.Extensions;
-using MonoDevelop.Core;
-using MonoDevelop.Components;
-using System.Text;
using System.Linq;
+using System.Text;
+using Gdk;
+using Gtk;
+using Microsoft.VisualStudio.Core.Imaging;
+using Mono.Addins;
+using MonoDevelop.Components;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Extensions;
using MonoDevelop.Ide.Gui.Components;
-using System.Threading.Tasks;
-using System.Net;
using Xwt.Backends;
-using Gtk;
-using Gdk;
namespace MonoDevelop.Ide
{
@@ -64,6 +63,7 @@ namespace MonoDevelop.Ide
// Dictionary of extension nodes by stock icon id. It holds nodes that have not yet been loaded
static Dictionary<string, List<StockIconCodon>> iconStock = new Dictionary<string, List<StockIconCodon>> ();
+ static Dictionary<ImageId, string> imageIdToStockId = new Dictionary<ImageId, string> ();
static Gtk.Requisition[] iconSizes = new Gtk.Requisition[7];
@@ -75,8 +75,13 @@ namespace MonoDevelop.Ide
StockIconCodon iconCodon = (StockIconCodon)args.ExtensionNode;
switch (args.Change) {
case ExtensionChange.Add:
- if (!iconStock.ContainsKey (iconCodon.StockId))
- iconStock[iconCodon.StockId] = new List<StockIconCodon> ();
+ if (!iconStock.ContainsKey (iconCodon.StockId)) {
+ iconStock [iconCodon.StockId] = new List<StockIconCodon> ();
+
+ foreach (var imageId in iconCodon.GetImageIds ()) {
+ imageIdToStockId[imageId] = iconCodon.StockId;
+ }
+ }
iconStock[iconCodon.StockId].Add (iconCodon);
break;
}
@@ -169,6 +174,36 @@ namespace MonoDevelop.Ide
return GetIcon (name).WithSize (size);
}
+ public static bool TryGetImage (ImageId imageId, out Xwt.Drawing.Image image) => TryGetImage (imageId, true, out image, out _);
+
+ public static bool TryGetImage (ImageId imageId, bool generateDefaultIcon, out Xwt.Drawing.Image image) => TryGetImage (imageId, generateDefaultIcon, out image, out _);
+
+ public static bool TryGetImage (ImageId imageId, bool generateDefaultIcon, out Xwt.Drawing.Image image, out string name)
+ {
+ var success = true;
+ if (!imageIdToStockId.TryGetValue (imageId, out name)) {
+ success = false;
+ if (!generateDefaultIcon) {
+ image = null;
+ return success;
+ }
+ name = "gtk-missing-image";
+ }
+ image = GetIcon (name);
+ return success;
+ }
+
+ public static void AddImage (ImageId imageId, Xwt.Drawing.Image icon)
+ {
+ if (Guid.Empty == imageId.Guid)
+ throw new ArgumentException (nameof (imageId));
+ if (icon == null)
+ throw new ArgumentNullException (nameof (icon));
+ var iconId = $"{imageId.Guid};{imageId.Id}";
+ imageIdToStockId.Add (imageId, iconId);
+ AddIcon (iconId, icon);
+ }
+
public static void AddIcon (string iconId, Xwt.Drawing.Image icon)
{
if (iconId == null)
@@ -183,6 +218,11 @@ namespace MonoDevelop.Ide
return icons.ContainsKey (iconId);
}
+ public static bool HasImage (ImageId imageId)
+ {
+ return imageIdToStockId.TryGetValue (imageId, out var iconId) && HasIcon (iconId);
+ }
+
public static Xwt.Drawing.Image GetIcon (string name)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
index a2eaa03a89..4bd2a7e6c5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs
@@ -330,11 +330,11 @@ namespace MonoDevelop.Ide
if (dialog.TransientFor != null)
parent = dialog.TransientFor;
else
- parent = RootWindow;
+ parent = DesktopService.GetFocusedTopLevelWindow ();
}
//TODO: use native parenting API for native windows
- if (parent.nativeWidget is Gtk.Window) {
+ if (parent?.nativeWidget is Gtk.Window) {
dialog.TransientFor = parent;
dialog.DestroyWithParent = true;
}
@@ -348,13 +348,18 @@ namespace MonoDevelop.Ide
Runtime.RunInMainThread (() => {
// If there is a native NSWindow model window running, we need
// to show the new dialog over that window.
- if (NSApplication.SharedApplication.ModalWindow != null || (parent.nativeWidget is NSWindow && dialog.Modal)) {
- EventHandler shownHandler = null;
- shownHandler = (s,e) => {
+ if (NSApplication.SharedApplication.ModalWindow != null || parent?.nativeWidget is NSWindow) {
+ if (dialog.Modal) {
+ EventHandler shownHandler = null;
+ shownHandler = (s, e) => {
+ ShowCustomModalDialog (dialog, parent);
+ dialog.Shown -= shownHandler;
+ };
+ dialog.Shown += shownHandler;
+ } else {
+ // If parent is a native NSWindow, run the dialog modally anyway
ShowCustomModalDialog (dialog, parent);
- dialog.Shown -= shownHandler;
- };
- dialog.Shown += shownHandler;
+ }
} else {
PlaceDialog (dialog, parent);
}
@@ -428,8 +433,8 @@ namespace MonoDevelop.Ide
if (nsParent == null || !nsParent.IsVisible) {
nsChild.Center ();
} else {
- int x = (int) Math.Max (0, nsParent.Frame.Left + (nsParent.Frame.Width - nsChild.Frame.Width) / 2);
- int y = (int) Math.Max (0, nsParent.Frame.Top + (nsParent.Frame.Height - nsChild.Frame.Height) / 2);
+ int x = (int) (nsParent.Frame.Left + (nsParent.Frame.Width - nsChild.Frame.Width) / 2);
+ int y = (int) (nsParent.Frame.Top + (nsParent.Frame.Height - nsChild.Frame.Height) / 2);
nsChild.SetFrameOrigin (new CoreGraphics.CGPoint (x, y));
}
@@ -449,13 +454,25 @@ namespace MonoDevelop.Ide
gtkChild.Move (x, y);
#if MAC
} else if (nsParent != null) {
+ x = (int) (nsParent.Frame.Left + (nsParent.Frame.Width - w) / 2);
+ y = (int) (nsParent.Frame.Top + (nsParent.Frame.Height - h) / 2);
nsChild = GtkMacInterop.GetNSWindow (gtkChild);
- x = (int) Math.Max (0, nsParent.Frame.Left + (nsParent.Frame.Width - w) / 2);
- y = (int) Math.Max (0, nsParent.Frame.Top + (nsParent.Frame.Height - h) / 2);
- nsChild.SetFrameOrigin (new CoreGraphics.CGPoint (x, y));
+ if (nsChild != null) {
+ nsChild.SetFrameOrigin (new CoreGraphics.CGPoint (x, y));
+ } else {
+ gtkChild.Move (x, y);
+ }
#endif
} else {
+#if MAC
+ // There is no parent, so just center the dialog
+ nsChild = GtkMacInterop.GetNSWindow (gtkChild);
+ if (nsChild != null) {
+ nsChild.Center ();
+ }
+#else
gtkChild.SetPosition (Gtk.WindowPosition.Center);
+#endif
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MimeTypeCatalog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MimeTypeCatalog.cs
new file mode 100644
index 0000000000..f788ad6a8a
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MimeTypeCatalog.cs
@@ -0,0 +1,207 @@
+//
+// Copyright (C) Microsoft Corp.
+// Copyright (C) 2007 Novell, Inc (http://www.novell.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 System;
+using System.Collections.Generic;
+using Microsoft.VisualStudio.Platform;
+using Microsoft.VisualStudio.Utilities;
+using Mono.Addins;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Extensions;
+
+namespace MonoDevelop.Ide
+{
+ class MimeTypeCatalog
+ {
+ public static MimeTypeCatalog Instance { get; } = new MimeTypeCatalog ();
+
+ readonly MimeTypeNode textPlainNode = new MimeTypeNode (TextPlain, null, GettextCatalog.GetString ("Text document"), null, true, "text");
+ readonly MimeTypeNode xmlNode = new MimeTypeNode (ApplicationXml, null, GettextCatalog.GetString ("XML document"), null, true, null);
+ List<MimeTypeNode> mimeTypeNodes = new List<MimeTypeNode> ();
+
+ MimeTypeCatalog ()
+ {
+ if (AddinManager.IsInitialized) {
+ AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Core/MimeTypes", delegate (object sender, ExtensionNodeEventArgs args) {
+ var newList = new List<MimeTypeNode> (mimeTypeNodes);
+ var mimeTypeNode = (MimeTypeNode)args.ExtensionNode;
+ switch (args.Change) {
+ case ExtensionChange.Add:
+ // initialize child nodes.
+ mimeTypeNode.ChildNodes.GetEnumerator ();
+ newList.Add (mimeTypeNode);
+ break;
+ case ExtensionChange.Remove:
+ newList.Remove (mimeTypeNode);
+ break;
+ }
+ mimeTypeNodes = newList;
+ });
+ }
+ }
+
+ public const string TextPlain = "text/plain";
+ public const string ApplicationXml = "application/xml";
+ public const string OctetStream = "application/octet-stream";
+
+ public MimeTypeNode FindMimeType (string type)
+ {
+ foreach (MimeTypeNode mt in mimeTypeNodes) {
+ if (mt.Id == type)
+ return mt;
+ }
+ return null;
+ }
+
+ public MimeTypeNode FindMimeTypeForFile (string fileName)
+ {
+ foreach (MimeTypeNode mt in mimeTypeNodes) {
+ if (mt.SupportsFile (fileName))
+ return mt;
+ }
+ return null;
+ }
+
+ public bool GetMimeTypeIsText (string mimeType)
+ {
+ return GetMimeTypeIsSubtype (mimeType, "text/plain");
+ }
+
+ public bool GetMimeTypeIsSubtype (string subMimeType, string baseMimeType)
+ {
+ foreach (string mt in GetMimeTypeInheritanceChain (subMimeType))
+ if (mt == baseMimeType)
+ return true;
+ return false;
+ }
+
+ public IEnumerable<string> GetMimeTypeInheritanceChain (string mimeType)
+ {
+ yield return mimeType;
+
+ while (mimeType != null && mimeType != TextPlain && mimeType != OctetStream) {
+ MimeTypeNode mt = FindMimeType (mimeType);
+ if (mt != null && !string.IsNullOrEmpty (mt.BaseType))
+ mimeType = mt.BaseType;
+ else {
+ if (mimeType.EndsWith ("+xml", StringComparison.Ordinal))
+ mimeType = ApplicationXml;
+ else if (mimeType.StartsWith ("text/", StringComparison.Ordinal))
+ mimeType = TextPlain;
+ else
+ break;
+ }
+ yield return mimeType;
+ }
+ }
+
+ IEnumerable<string> GetMimeTypeInheritanceChain (MimeTypeNode node)
+ {
+ if (node == null) {
+ yield break;
+ }
+ foreach (var mt in GetMimeTypeNodeInheritanceChain (node)) {
+ yield return mt.Id;
+ }
+ }
+
+ IEnumerable<MimeTypeNode> GetMimeTypeNodeInheritanceChain (MimeTypeNode node)
+ {
+ while (node != null) {
+ yield return node;
+
+ if (node.Id == OctetStream || node.Id == TextPlain) {
+ yield break;
+ }
+
+ if (string.IsNullOrEmpty (node.BaseType)) {
+ if (node.Id.EndsWith ("+xml", StringComparison.Ordinal)) {
+ yield return xmlNode;
+ yield return textPlainNode;
+ }
+ if (node.Id.StartsWith ("text/", StringComparison.Ordinal)) {
+ yield return textPlainNode;
+ }
+ yield break;
+ }
+
+ node = FindMimeType (node.BaseType);
+ }
+ }
+
+ MimeTypeNode GetMimeTypeNodeForRoslynLanguage (string roslynLanguage)
+ {
+ foreach (var mt in mimeTypeNodes) {
+ if (mt.RoslynName == roslynLanguage)
+ return mt;
+ }
+ return null;
+ }
+
+ public string GetMimeTypeForRoslynLanguage (string roslynLanguage)
+ => GetMimeTypeNodeForRoslynLanguage (roslynLanguage)?.Id;
+
+ public IEnumerable<string> GetMimeTypeInheritanceChainForRoslynLanguage (string roslynLanguage)
+ => GetMimeTypeInheritanceChain (GetMimeTypeForRoslynLanguage (roslynLanguage));
+
+ public string GetRoslynLanguageForMimeType (string mimeType)
+ {
+ var node = FindMimeType (mimeType);
+ foreach (var mt in GetMimeTypeNodeInheritanceChain (node)) {
+ if (node.RoslynName != null) {
+ return node.RoslynName;
+ }
+ }
+ return null;
+ }
+
+ MimeTypeNode GetMimeTypeNodeForContentType (string contentType)
+ {
+ foreach (var mt in mimeTypeNodes) {
+ if (mt.ContentType == contentType)
+ return mt;
+ }
+ return null;
+ }
+
+ public string GetMimeTypeForContentType (IContentType contentType)
+ => GetMimeTypeNodeForContentType (contentType.TypeName)?.Id;
+
+ public IEnumerable<string> GetMimeTypeInheritanceChainForContentType (IContentType contentType)
+ => GetMimeTypeInheritanceChain (GetMimeTypeNodeForContentType (contentType.TypeName));
+
+ public IContentType GetContentTypeForMimeType (string mimeType)
+ {
+ if (mimeType != null) {
+ var node = FindMimeType (mimeType);
+ foreach (var mt in GetMimeTypeNodeInheritanceChain (node)) {
+ if (node.ContentType != null) {
+ return PlatformCatalog.Instance.ContentTypeRegistryService.GetContentType (node.ContentType);
+ }
+ }
+ }
+ return null;
+ }
+ }
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
index 0ef02f8ac4..a3a48740ad 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
@@ -219,6 +219,7 @@ namespace MonoDevelop.Ide
return false;
}
+ [Obsolete]
static MonoDevelop.Ide.FindInFiles.SearchResult GetJumpTypePartSearchResult (Microsoft.CodeAnalysis.ISymbol part, Microsoft.CodeAnalysis.Location location)
{
var provider = new MonoDevelop.Ide.FindInFiles.FileProvider (location.SourceTree.FilePath);
@@ -2603,6 +2604,7 @@ namespace MonoDevelop.Ide
}
}
+ [Obsolete("Use VS Editor APIs")]
public class TextFileProvider : ITextFileProvider
{
static TextFileProvider instance = new TextFileProvider ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
index d050833c22..483787fdab 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
@@ -655,6 +655,7 @@ namespace MonoDevelop.Ide
internal async Task<bool> OpenWorkspaceItemInternal (FilePath file, bool closeCurrent, bool loadPreferences, OpenWorkspaceItemMetadata metadata, ProgressMonitor loadMonitor)
{
+ IdeApp.Workbench.RootWindow.Show ();
var item = GetAllItems<WorkspaceItem> ().FirstOrDefault (w => w.FileName == file.FullPath);
if (item != null) {
CurrentSelectedWorkspaceItem = item;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs
index 4f8ff5739d..f19833f94c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Services.cs
@@ -80,6 +80,9 @@ namespace MonoDevelop.Ide
public static Counter ProjectsLoaded = InstrumentationService.CreateTimerCounter ("Projects loaded", "Parser Service");
}
+ public static Counter NewEditorEnabled = InstrumentationService.CreateCounter ("New Editor Enabled", "Text Editor", id: "NewTextEditor.Enabled");
+ public static Counter NewEditorDisabled = InstrumentationService.CreateCounter ("New Editor Disabled", "Text Editor", id: "NewTextEditor.Disabled");
+
public static string[] CounterReport ()
{
string[] reports = new string[15];
diff --git a/main/src/core/MonoDevelop.Ide/packages.config b/main/src/core/MonoDevelop.Ide/packages.config
deleted file mode 100644
index 8ad3f35933..0000000000
--- a/main/src/core/MonoDevelop.Ide/packages.config
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.TemplateEngine.Abstractions" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Microsoft.TemplateEngine.Core" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Microsoft.TemplateEngine.Core.Contracts" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Microsoft.TemplateEngine.Edge" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Microsoft.TemplateEngine.Utils" version="1.0.0-beta3-20171117-314" targetFramework="net461" />
- <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net45" />
- <package id="JetBrains.SharpZipLib.Stripped" version="0.87.20170615.10" targetFramework="net461" />
- <package id="System.Collections.Immutable" version="1.5.0" targetFramework="net45" />
- <package id="System.Composition" version="1.0.31" targetFramework="net45" />
- <package id="System.IO.Compression" version="4.3.0" targetFramework="net461" />
- <package id="System.Threading.Tasks.DataFlow" version="4.7.0" targetFramework="net45" />
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
- <package id="YamlDotNet.Signed" version="5.2.1" targetFramework="net471" />
-</packages> \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/Makefile.am b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
index bf1e4515bb..06253b6d99 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
@@ -44,10 +44,6 @@
<HintPath>$(MSBuild_OSS_BinDir)Microsoft.Build.Utilities.Core.dll</HintPath>
<Private>False</Private>
</Reference>
- <Reference Include="System.ValueTuple">
- <HintPath>..\..\..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll</HintPath>
- <Private>False</Private>
- </Reference>
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' OR '$(Configuration)' == 'Release' ">
<None Include="app.config">
@@ -85,8 +81,5 @@
<Link>MonoDevelop.Core.Execution\RemoteProcessServer.cs</Link>
</Compile>
</ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildResolver/MonoDevelop.MSBuildResolver.csproj b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildResolver/MonoDevelop.MSBuildResolver.csproj
index eb12a9687f..fc84e7ef59 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildResolver/MonoDevelop.MSBuildResolver.csproj
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildResolver/MonoDevelop.MSBuildResolver.csproj
@@ -6,6 +6,7 @@
<ProjectGuid>{BD432AE0-B262-4F63-A695-7B86D11B644F}</ProjectGuid>
<!-- this is loaded by MSBuild, so framework should match MSBuild -->
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <TargetFrameworkVersion Condition="'$(VisualStudioVersion)'=='16.0'">v4.7.2</TargetFrameworkVersion>
<MSBuild_OSS_BinDir Condition="'$(OS)' == 'Windows_NT'">$(MSBuildToolsPath)\</MSBuild_OSS_BinDir>
<!-- when building with xbuild on Unix, $(MSBuildToolsPath) is like `$prefix/lib/mono/xbuild/*/bin`
when building with msbuild on Unix, $(MSBuildToolsPath) is like `$prefix/lib/mono/msbuild/*/bin`
@@ -19,8 +20,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin32|AnyCPU' " />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWin32|AnyCPU' " />
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWin32|AnyCPU' " />
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild/Main.cs b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild/Main.cs
index 5d3524ffc4..91de5d0bed 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild/Main.cs
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.Projects.MSBuild/Main.cs
@@ -47,6 +47,10 @@ namespace MonoDevelop.Projects.MSBuild
// This is required for MSBuild to properly load the .exe.config configuration file for this executable.
Environment.SetEnvironmentVariable ("MSBUILD_EXE_PATH", typeof(MainClass).Assembly.Location);
+ // Disable VBCSCompiler until it is reliable on mono. Currently leaves orphaned processes for VB projects taking up 100% CPU.
+ // https://github.com/mono/mono/issues/11939
+ Environment.SetEnvironmentVariable ("UseSharedCompilation", bool.FalseString);
+
RemoteProcessServer server = new RemoteProcessServer ();
server.Connect (args, new AssemblyResolver (server));
}
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/packages.config b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/packages.config
deleted file mode 100644
index f0c788e020..0000000000
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="System.ValueTuple" version="4.4.0" targetFramework="net471" />
-</packages>
diff --git a/main/src/core/MonoDevelop.Startup/Makefile.am b/main/src/core/MonoDevelop.Startup/Makefile.am
deleted file mode 100644
index 71cf1aec64..0000000000
--- a/main/src/core/MonoDevelop.Startup/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-EXTRA_DIST += \
- app.manifest
diff --git a/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj b/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj
index e162fb60cb..06babcc9f7 100644
--- a/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj
+++ b/main/src/core/MonoDevelop.Startup/MonoDevelop.Startup.csproj
@@ -48,6 +48,7 @@
<Project>{42D1CE65-A14B-4218-B787-58AD7AA68513}</Project>
<Name>Mono.Addins.CecilReflector</Name>
</ProjectReference>
+ <IncludeCopyLocal Include="Mono.Addins.CecilReflector.dll" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
diff --git a/main/src/core/MonoDevelop.Startup/app.config b/main/src/core/MonoDevelop.Startup/app.config
index 2744d6fdba..5da9788457 100644
--- a/main/src/core/MonoDevelop.Startup/app.config
+++ b/main/src/core/MonoDevelop.Startup/app.config
@@ -1,255 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
- <runtime>
- <!-- DO NOT TRUST CORECLR PACKAGE VERSIONS. LOOK AT THE ASSEMBLY VERSION OF THE ASSEMBLY, NOT THE PACKAGE VERSION -->
- <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
- <dependentAssembly>
- <assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-0.86.0.518" newVersion="1.0.6375.31400" />
- <bindingRedirect oldVersion="2.84.0.0-4.84.0.0" newVersion="1.0.6375.31400" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="2.0.0.0-4.4.3.0" newVersion="4.4.3.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="FSharp.Compiler.Service" publicKeyToken="e33b67d3bb5581e4" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-23.0.1.0" newVersion="23.0.1.0" />
- </dependentAssembly>
-
- <dependentAssembly>
- <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Composition.AttributedModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Diagnostics.FileVersionInfo" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.Elfie" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Composition.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.6.1.0" newVersion="4.6.1.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Threading.Thread" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Composition.TypedParts" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Composition.Hosting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.EditorFeatures" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.EditorFeatures.Text" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces.Desktop" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic.Features" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-2.10.0.0" newVersion="2.10.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.Diagnostics.Tracing.EventSource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.1.28.0" newVersion="1.1.28.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.CoreUtility" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.Text.Data" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.Text.Logic" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.Text.UI" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.8.0.0" newVersion="15.8.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.VisualStudio.Validation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.3.0.0" newVersion="15.3.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Commands" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Common" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Configuration" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Credentials" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.DependencyResolver.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Frameworks" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Indexing" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.LibraryModel" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.PackageManagement" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Packaging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Packaging.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.ProjectModel" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Protocol" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Resolver" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="NuGet.Versioning" publicKeyToken="31bf3856ad364e35" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.8.0.6" newVersion="4.8.0.6" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="1.4.3.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="SQLitePCLRaw.batteries_v2" publicKeyToken="8226ea5df37bcae9" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.1.12.351" newVersion="1.1.12.351" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="SQLitePCLRaw.core" publicKeyToken="1488e028ca7ab535" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-1.1.12.351" newVersion="1.1.12.351" />
- </dependentAssembly>
- <dependentAssembly>
- <assemblyIdentity name="YamlDotNet" publicKeyToken="ec19458f3c15af5e" culture="neutral" />
- <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
- </dependentAssembly>
- </assemblyBinding>
- </runtime>
+ <runtime>
+ <!-- DO NOT TRUST CORECLR PACKAGE VERSIONS. LOOK AT THE ASSEMBLY VERSION OF THE ASSEMBLY, NOT THE PACKAGE VERSION -->
+ <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false" />
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly><assemblyIdentity name="FSharp.Compiler.Service" publicKeyToken="e33b67d3bb5581e4" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-25.0.1.0" newVersion="25.0.1.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="2.0.0.0-4.4.3.0" newVersion="4.5.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.84.0.0" newVersion="1.1.0.145" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.Build.Framework" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.Build" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-15.1.0.0" newVersion="15.1.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.CSharp.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.CSharp" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.EditorFeatures.Text" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.EditorFeatures" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.Features" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic.Features" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.VisualBasic" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis.Workspaces" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.CodeAnalysis" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.Diagnostics.Tracing.EventSource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.1.28.0" newVersion="1.1.28.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.CoreUtility" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Language.Intellisense" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Language" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Text.Data" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Text.Logic" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Text.UI" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Threading" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-15.8.0.0" newVersion="15.8.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.VisualStudio.Validation" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-15.3.0.0" newVersion="15.3.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Microsoft.Web.XmlTransform" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Mono.Cairo" publicKeyToken="0738eb9f132ed756" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Mono.Cecil.Mdb" culture="neutral" publicKeyToken="50cebf1cceb9d05e" /><bindingRedirect oldVersion="0.0.0.0-0.10.1.0" newVersion="0.10.1.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Mono.Cecil" culture="neutral" publicKeyToken="50cebf1cceb9d05e" /><bindingRedirect oldVersion="0.0.0.0-0.10.1.0" newVersion="0.10.1.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="mscorlib" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Commands" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Common" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Configuration" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Credentials" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.DependencyResolver.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Frameworks" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Indexing" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.LibraryModel" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.PackageManagement" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Packaging.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Packaging" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.ProjectModel" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Protocol" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Resolver" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="NuGet.Versioning" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.8.2.0" newVersion="4.8.2.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="SQLitePCLRaw.batteries_v2" culture="neutral" publicKeyToken="8226ea5df37bcae9" /><bindingRedirect oldVersion="0.0.0.0-1.1.12.351" newVersion="1.1.12.351" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="SQLitePCLRaw.core" culture="neutral" publicKeyToken="1488e028ca7ab535" /><bindingRedirect oldVersion="0.0.0.0-1.1.12.351" newVersion="1.1.12.351" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="StreamJsonRpc" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-1.5.0.0" newVersion="1.5.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Composition.AttributedModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Composition.Hosting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Composition.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Composition.TypedParts" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.0.31.0" newVersion="1.0.31.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Configuration" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Drawing" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.2.29.0" newVersion="4.2.29.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="1.4.3.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Runtime.Remoting" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.ValueTuple" culture="neutral" publicKeyToken="cc7b13ffcd2ddd51" /><bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System.Xml" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="System" culture="neutral" publicKeyToken="b77a5c561934e089" /><bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly>
+ <dependentAssembly><assemblyIdentity name="YamlDotNet" publicKeyToken="ec19458f3c15af5e" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" /></dependentAssembly>
+ </assemblyBinding>
+ </runtime>
</configuration>
diff --git a/main/src/core/MonoDevelop.Startup/packages.config b/main/src/core/MonoDevelop.Startup/packages.config
deleted file mode 100644
index 5e81482871..0000000000
--- a/main/src/core/MonoDevelop.Startup/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="LargeAddressAware" version="1.0.1" />
-</packages> \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.TextEditor.Tests/Makefile.am b/main/src/core/MonoDevelop.TextEditor.Tests/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/core/MonoDevelop.TextEditor.Tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/MiscActionsTest.cs b/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/MiscActionsTest.cs
index 0069fe500b..9d8a9459d9 100644
--- a/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/MiscActionsTest.cs
+++ b/main/src/core/MonoDevelop.TextEditor.Tests/Mono.TextEditor.Tests.DefaultEditActions/MiscActionsTest.cs
@@ -292,6 +292,20 @@ ffffffffff");
1234567890");
MiscActions.MoveBlockUp (data);
}
+
+ /// <summary>
+ /// Fixes VSTS Bug 801783: Auto indenting is shifting by one space back #279
+ /// </summary>
+ [Test]
+ public void TestVSTS801783 ()
+ {
+ TextEditorData data = new Mono.TextEditor.TextEditorData ();
+ data.IndentationTracker = new SmartIndentModeTests.TestIndentTracker (" ");
+ data.Document.Text = "HelloWorld!";
+ data.Caret.Location = new DocumentLocation (1, "Hello".Length);
+ MiscActions.InsertNewLine (data);
+ Assert.AreEqual (4, data.Caret.Column);
+ }
}
}
diff --git a/main/src/tools/Makefile.am b/main/src/tools/Makefile.am
deleted file mode 100644
index d6645b2da0..0000000000
--- a/main/src/tools/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = mdhost mdtool mdmonitor
diff --git a/main/src/tools/mdhost/Makefile.am b/main/src/tools/mdhost/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/tools/mdhost/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/tools/mdmonitor/Makefile.am b/main/src/tools/mdmonitor/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/tools/mdmonitor/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include
diff --git a/main/src/tools/mdmonitor/TimeLineView.cs b/main/src/tools/mdmonitor/TimeLineView.cs
index d345819c7d..7c9982554e 100644
--- a/main/src/tools/mdmonitor/TimeLineView.cs
+++ b/main/src/tools/mdmonitor/TimeLineView.cs
@@ -31,7 +31,6 @@ using System.Collections.Generic;
using MonoDevelop.Core.Instrumentation;
using MonoDevelop.Components;
using System.Linq;
-using Mono.TextEditor;
namespace Mono.Instrumentation.Monitor
{
diff --git a/main/src/tools/mdtool/Makefile.am b/main/src/tools/mdtool/Makefile.am
deleted file mode 100644
index c9cc87438f..0000000000
--- a/main/src/tools/mdtool/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-include $(top_srcdir)/xbuild.include