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

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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/addins
parentea8b962d5ed27ad8dd52594124d35eb0bea4b714 (diff)
parent228695e2dc646fb2ad812c06bebfe33ca9f69601 (diff)
Merge branch 'new-service-model' into new-doc-model
Diffstat (limited to 'main/src/addins')
-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
464 files changed, 15311 insertions, 4802 deletions
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>