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:
-rw-r--r--main/Main.sln21
m---------main/external/NRefactory60
m---------main/external/debugger-libs0
m---------main/external/xwt0
-rw-r--r--main/src/addins/AspNet/MonoDevelop.AspNet.csproj16
-rw-r--r--main/src/addins/AspNet/Razor/Dom/RazorCodeFragment.cs2
-rw-r--r--main/src/addins/AspNet/Razor/RazorCSharpFormatter.cs15
-rw-r--r--main/src/addins/AspNet/Razor/RazorCSharpParser.cs2
-rw-r--r--main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj28
-rw-r--r--main/src/addins/AspNet/Tests/Razor/RazorParserTests.cs107
-rw-r--r--main/src/addins/AspNet/Tests/packages.config8
-rw-r--r--main/src/addins/AspNet/packages.config8
-rw-r--r--main/src/addins/CBinding/CBinding.csproj4
-rw-r--r--main/src/addins/CBinding/packages.config2
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.addin.xml13
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj20
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs27
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ProtocolMemberContextHandler.cs11
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs37
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs8
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml2
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs4
-rw-r--r--main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs35
-rw-r--r--main/src/addins/CSharpBinding/packages.config8
-rw-r--r--main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj4
-rw-r--r--main/src/addins/ChangeLogAddIn/packages.config2
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs17
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs22
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SearchBar.cs9
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/SelectorView.cs2
-rw-r--r--main/src/addins/MacPlatform/MainToolbar/StatusBar.cs4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/DomMethodNodeBuilder.cs4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ProjectNodeBuilder.cs4
-rw-r--r--main/src/addins/MonoDevelop.AssemblyBrowser/packages.config2
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs50
-rw-r--r--main/src/addins/MonoDevelop.Debugger/packages.config8
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj4
-rw-r--r--main/src/addins/MonoDevelop.DesignerSupport/packages.config2
-rw-r--r--main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj8
-rw-r--r--main/src/addins/MonoDevelop.DocFood/packages.config4
-rw-r--r--main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj4
-rw-r--r--main/src/addins/MonoDevelop.Gettext/packages.config2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs2
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs4
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj12
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/packages.config6
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/AnalyzersFromAssembly.cs2
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj26
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs25
-rw-r--r--main/src/addins/MonoDevelop.Refactoring/packages.config8
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs28
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj4
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs48
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/packages.config2
-rw-r--r--main/src/addins/NUnit/MonoDevelop.NUnit.csproj4
-rw-r--r--main/src/addins/NUnit/packages.config2
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj4
-rw-r--r--main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config2
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj4
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config2
-rw-r--r--main/src/addins/Xml/Formatting/XmlFormatter.cs13
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Document/LineSplitter.cs2
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs111
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs2
-rw-r--r--main/src/core/Mono.Texteditor/SyntaxModes/CSharpSyntaxMode.xml17
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs15
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj4
-rw-r--r--main/src/core/MonoDevelop.Core/packages.config2
-rw-r--r--main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileEntry.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs123
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs130
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/IAdvancedCodeFormatter.cs78
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCodon.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateListDataProvider.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/EditTemplateDialog.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs63
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs92
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs51
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs111
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/AmbientColor.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ChunkStyle.cs23
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorDescriptionAttribute.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs24
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/IStreamProvider.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxModeService.cs30
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs18
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs43
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs41
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSegment.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs30
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs26
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs166
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorType.cs39
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsPanelNode.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/MemberCollector.cs236
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/ReferencesFinder.cs323
-rwxr-xr-xmain/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchCollector.cs272
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs17
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs24
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs3
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs141
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemOutputTrackingNode.cs (renamed from main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/ICodeFormatter.cs)69
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs30
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs37
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj25
-rw-r--r--main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.CodeTemplates.EditTemplateDialog.cs2
-rw-r--r--main/tests/UnitTests/MonoDevelop.Ide.Editor/Commands/CodeCommentTests.cs23
-rw-r--r--main/tests/UnitTests/MonoDevelop.Ide.Editor/TextEditorProjectionTests.cs244
-rw-r--r--main/tests/UnitTests/UnitTests.csproj8
-rw-r--r--main/tests/UnitTests/packages.config6
136 files changed, 1883 insertions, 1705 deletions
diff --git a/main/Main.sln b/main/Main.sln
index d1b05518e1..5a5cdf1be3 100644
--- a/main/Main.sln
+++ b/main/Main.sln
@@ -273,7 +273,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NRefactory6", "NRefactory6"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory6.CSharp", "external\NRefactory6\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory6.CSharp.csproj", "{7E891659-45F3-42B5-B940-A728780CCAE9}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory6.CSharp.Refactoring", "external\NRefactory6\ICSharpCode.NRefactory.CSharp.Refactoring\ICSharpCode.NRefactory6.CSharp.Refactoring.csproj", "{C465A5DC-AD28-49A2-89C0-F81838814A7E}"
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ICSharpCode.NRefactory6.Shared", "external\NRefactory6\ICSharpCode.NRefactory6.Shared\ICSharpCode.NRefactory6.Shared.shproj", "{5AD3093F-F79D-4014-B197-27D09492C3E3}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NR6Pack", "external\NRefactory6\NR6Pack\NR6Pack.csproj", "{C465A5DC-AD28-49A2-89C0-F81838814A7E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuiUnit_NET_4_5", "external\guiunit\src\framework\GuiUnit_NET_4_5.csproj", "{D12F0F7B-8DE3-43EC-BA49-41052D065A9B}"
EndProject
@@ -949,6 +951,8 @@ Global
{7E891659-45F3-42B5-B940-A728780CCAE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.Debug|x86.ActiveCfg = Debug|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.Debug|x86.Build.0 = Debug|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.DebugGnome|Any CPU.ActiveCfg = Debug|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.DebugGnome|Any CPU.Build.0 = Debug|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
@@ -957,6 +961,12 @@ Global
{7E891659-45F3-42B5-B940-A728780CCAE9}.Release|Any CPU.Build.0 = Release|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.Release|x86.ActiveCfg = Release|Any CPU
{7E891659-45F3-42B5-B940-A728780CCAE9}.Release|x86.Build.0 = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseGnome|Any CPU.ActiveCfg = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseGnome|Any CPU.Build.0 = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseWin32|Any CPU.ActiveCfg = Release|Any CPU
+ {7E891659-45F3-42B5-B940-A728780CCAE9}.ReleaseWin32|Any CPU.Build.0 = Release|Any CPU
{7FCDB0D9-AA7D-44E4-BE74-55312B432389}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7FCDB0D9-AA7D-44E4-BE74-55312B432389}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7FCDB0D9-AA7D-44E4-BE74-55312B432389}.DebugGnome|Any CPU.ActiveCfg = Debug|Any CPU
@@ -1542,6 +1552,8 @@ Global
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Debug|x86.ActiveCfg = Debug|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Debug|x86.Build.0 = Debug|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.DebugGnome|Any CPU.ActiveCfg = Debug|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.DebugGnome|Any CPU.Build.0 = Debug|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
@@ -1550,6 +1562,12 @@ Global
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Release|Any CPU.Build.0 = Release|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Release|x86.ActiveCfg = Release|Any CPU
{C465A5DC-AD28-49A2-89C0-F81838814A7E}.Release|x86.Build.0 = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseGnome|Any CPU.ActiveCfg = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseGnome|Any CPU.Build.0 = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseMac|Any CPU.Build.0 = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseWin32|Any CPU.ActiveCfg = Release|Any CPU
+ {C465A5DC-AD28-49A2-89C0-F81838814A7E}.ReleaseWin32|Any CPU.Build.0 = Release|Any CPU
{C4B0275C-37D3-43F2-927D-ABF556600804}.Debug|Any CPU.ActiveCfg = Debug|x86
{C4B0275C-37D3-43F2-927D-ABF556600804}.DebugGnome|Any CPU.ActiveCfg = Debug|x86
{C4B0275C-37D3-43F2-927D-ABF556600804}.DebugMac|Any CPU.ActiveCfg = Debug|x86
@@ -2067,6 +2085,7 @@ Global
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {2D711139-8765-4929-BC7A-AA2DEE6F615D}
{2A705FC6-1A9E-4941-9E47-254D79F2D9D5} = {2D711139-8765-4929-BC7A-AA2DEE6F615D}
{7E891659-45F3-42B5-B940-A728780CCAE9} = {840E8B8D-929C-4CB2-9D23-2702FF01269A}
+ {5AD3093F-F79D-4014-B197-27D09492C3E3} = {840E8B8D-929C-4CB2-9D23-2702FF01269A}
{C465A5DC-AD28-49A2-89C0-F81838814A7E} = {840E8B8D-929C-4CB2-9D23-2702FF01269A}
{BFE8691A-D323-4622-9021-7B8B27F81599} = {5D3F7E65-E55B-45CA-A83B-D1E10040281E}
{8A04FF99-5DFE-4E3D-A24F-72A621C8DDC6} = {5D3F7E65-E55B-45CA-A83B-D1E10040281E}
diff --git a/main/external/NRefactory6 b/main/external/NRefactory6
-Subproject 832934f2cb1c8dbeeb4e8a8c1b0cb4d61e44983
+Subproject af75ad63a48d1f3d1755501ffcf03a5e7a9153b
diff --git a/main/external/debugger-libs b/main/external/debugger-libs
-Subproject 0643ac92574b84e90ef439b0c1c054e4d9bdcc8
+Subproject 6f5f33a3e943decc7f2149980d643fae93e6104
diff --git a/main/external/xwt b/main/external/xwt
-Subproject 98fc856d5d99cb353f664dd186891eec43dc112
+Subproject fecebb226779d764ec22646c1895791e2c53ab4
diff --git a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
index 1a401a0b93..3574f4f74d 100644
--- a/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
+++ b/main/src/addins/AspNet/MonoDevelop.AspNet.csproj
@@ -176,35 +176,35 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/AspNet/Razor/Dom/RazorCodeFragment.cs b/main/src/addins/AspNet/Razor/Dom/RazorCodeFragment.cs
index c4327c1364..6387e36ba3 100644
--- a/main/src/addins/AspNet/Razor/Dom/RazorCodeFragment.cs
+++ b/main/src/addins/AspNet/Razor/Dom/RazorCodeFragment.cs
@@ -69,7 +69,7 @@ namespace MonoDevelop.AspNet.Razor.Dom
public bool FindFirstBracket (DocumentLocation currentLocation)
{
- if (Document.LineCount < Region.BeginLine)
+ if (Document == null || Document.LineCount < Region.BeginLine)
return false;
int firstBracketPosition = Document.GetTextBetween (Region.Begin, currentLocation).IndexOf ('{');
diff --git a/main/src/addins/AspNet/Razor/RazorCSharpFormatter.cs b/main/src/addins/AspNet/Razor/RazorCSharpFormatter.cs
index 795cdd670f..1887795ede 100644
--- a/main/src/addins/AspNet/Razor/RazorCSharpFormatter.cs
+++ b/main/src/addins/AspNet/Razor/RazorCSharpFormatter.cs
@@ -31,24 +31,23 @@ using MonoDevelop.Projects.Policies;
namespace MonoDevelop.AspNet.Razor
{
- public class RazorCSharpFormatter : AbstractAdvancedFormatter
+ public class RazorCSharpFormatter : AbstractCodeFormatter
{
public override bool SupportsOnTheFlyFormatting { get { return true; } }
public override bool SupportsCorrectingIndent { get { return true; } }
- public override void CorrectIndenting (PolicyContainer policyParent,
- IEnumerable<string> mimeTypeChain, TextEditor data, int line)
+ protected override void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
{
}
- public override string FormatText (PolicyContainer policyParent,
- IEnumerable<string> mimeTypeChain, string input, int startOffset, int endOffset)
+ protected override Core.Text.ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, Core.Text.ITextSource input, int startOffset, int endOffset)
{
- return null;
- }
+ return input.CreateSnapshot (startOffset, endOffset - startOffset);
+ }
- public override void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
+ protected override void OnTheFlyFormatImplementation (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
{
}
+
}
}
diff --git a/main/src/addins/AspNet/Razor/RazorCSharpParser.cs b/main/src/addins/AspNet/Razor/RazorCSharpParser.cs
index 32aeff2bd8..3f18f54fb2 100644
--- a/main/src/addins/AspNet/Razor/RazorCSharpParser.cs
+++ b/main/src/addins/AspNet/Razor/RazorCSharpParser.cs
@@ -87,7 +87,7 @@ namespace MonoDevelop.AspNet.Razor
{
currentDocument = openDocuments.FirstOrDefault (d => d != null && d.FileName == parseOptions.FileName);
// We need document and project to be loaded to correctly initialize Razor Host.
- this.project = project as DotNetProject;
+ this.project = parseOptions.Project as DotNetProject;
if (currentDocument == null && !TryAddDocument (parseOptions.FileName))
return System.Threading.Tasks.Task.FromResult((ParsedDocument)new RazorCSharpParsedDocument (parseOptions.FileName, new RazorCSharpPageInfo ()));
diff --git a/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj b/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
index ab4a23ff4f..647ef79704 100644
--- a/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
+++ b/main/src/addins/AspNet/Tests/MonoDevelop.AspNet.Tests.csproj
@@ -38,6 +38,30 @@
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
+ <Reference Include="System.Collections.Immutable">
+ <HintPath>..\..\..\..\packages\System.Collections.Immutable.1.1.33-beta\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.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis">
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.Desktop">
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.CSharp">
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
+ <Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <Private>False</Private>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Razor\Dom\RazorCodeBlockParsingTests.cs" />
@@ -56,6 +80,7 @@
<Compile Include="Html\HtmlParsingTests.cs" />
<Compile Include="Html\HtmlImplicitClosingTests.cs" />
<Compile Include="Razor\Dom\RazorDocumentTrackerTests.cs" />
+ <Compile Include="Razor\RazorParserTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@@ -123,4 +148,7 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
</Project>
diff --git a/main/src/addins/AspNet/Tests/Razor/RazorParserTests.cs b/main/src/addins/AspNet/Tests/Razor/RazorParserTests.cs
new file mode 100644
index 0000000000..de2f2e2e6d
--- /dev/null
+++ b/main/src/addins/AspNet/Tests/Razor/RazorParserTests.cs
@@ -0,0 +1,107 @@
+//
+// RazorParserTests.cs
+//
+// Author:
+// Matt Ward <matt.ward@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Linq;
+using System.Threading;
+using Microsoft.CodeAnalysis.CSharp.Syntax;
+using MonoDevelop.AspNet.Projects;
+using MonoDevelop.AspNet.Razor;
+using MonoDevelop.Core.Text;
+using MonoDevelop.CSharpBinding;
+using MonoDevelop.CSharpBinding.Tests;
+using MonoDevelop.Ide.TypeSystem;
+using MonoDevelop.Projects;
+using NUnit.Framework;
+using UnitTests;
+
+namespace MonoDevelop.AspNet.Tests.Razor
+{
+ [TestFixture]
+ public class RazorParserTests : TestBase
+ {
+ Solution solution;
+
+ [TearDown]
+ public override void TearDown ()
+ {
+ TypeSystemServiceTestExtensions.UnloadSolution (solution);
+ base.TearDown ();
+ }
+
+ [Test]
+ public void PreprocessedFileUsesPreprocessorRazorHost ()
+ {
+ var document = Parse ("@{ }", isPreprocessed: true);
+ var method = document.PageInfo.CSharpSyntaxTree
+ .GetRoot ()
+ .DescendantNodes ()
+ .OfType <MethodDeclarationSyntax> ()
+ .FirstOrDefault (m => m.Identifier.ValueText == "Generate");
+
+ Assert.IsNotNull (method);
+ }
+
+ RazorCSharpParsedDocument Parse (string text, bool isPreprocessed)
+ {
+ var project = new AspNetAppProject ("C#");
+
+ project.FileName = UnitTests.TestBase.GetTempFile (".csproj");
+ string file = UnitTests.TestBase.GetTempFile (".cshtml");
+ ProjectFile projectFile = project.AddFile (file);
+ if (isPreprocessed)
+ projectFile.Generator = "RazorTemplatePreprocessor";
+
+ var sev = new TestViewContent ();
+ sev.Project = project;
+ sev.ContentName = file;
+ sev.Text = text;
+
+ var tww = new TestWorkbenchWindow ();
+ tww.ViewContent = sev;
+
+ var doc = new TestDocument (tww);
+ doc.Editor.FileName = sev.ContentName;
+ doc.UpdateProject (project);
+
+ solution = new MonoDevelop.Projects.Solution ();
+ solution.DefaultSolutionFolder.AddItem (project);
+ solution.AddConfiguration ("", true);
+ TypeSystemServiceTestExtensions.LoadSolution (solution);
+
+ var parser = new RazorTestingParser {
+ Doc = doc
+ };
+ var options = new ParseOptions {
+ Project = project,
+ FileName = file,
+ Content = new StringTextSource (text)
+ };
+ return (RazorCSharpParsedDocument)parser.Parse (options, default(CancellationToken)).Result;
+ }
+ }
+}
+
diff --git a/main/src/addins/AspNet/Tests/packages.config b/main/src/addins/AspNet/Tests/packages.config
new file mode 100644
index 0000000000..47685422f8
--- /dev/null
+++ b/main/src/addins/AspNet/Tests/packages.config
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
+ <package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
+</packages> \ No newline at end of file
diff --git a/main/src/addins/AspNet/packages.config b/main/src/addins/AspNet/packages.config
index 2f10116845..db6fa29120 100644
--- a/main/src/addins/AspNet/packages.config
+++ b/main/src/addins/AspNet/packages.config
@@ -4,10 +4,10 @@
<package id="Microsoft.AspNet.Razor" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.2" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
diff --git a/main/src/addins/CBinding/CBinding.csproj b/main/src/addins/CBinding/CBinding.csproj
index 16f88e6e3c..371d77dfbc 100644
--- a/main/src/addins/CBinding/CBinding.csproj
+++ b/main/src/addins/CBinding/CBinding.csproj
@@ -70,11 +70,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/CBinding/packages.config b/main/src/addins/CBinding/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/CBinding/packages.config
+++ b/main/src/addins/CBinding/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
index 75051ed00f..a7b7e18a19 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
+++ b/main/src/addins/CSharpBinding/CSharpBinding.addin.xml
@@ -1,5 +1,12 @@
<ExtensionModel>
-
+
+ <!-- Extension Points -->
+ <ExtensionPoint path = "/MonoDevelop/CSharp/Completion/ContextHandler">
+ <ExtensionNode name="Class"/>
+ </ExtensionPoint>
+
+ <!-- Extensions -->
+
<ConditionType id="MSBuildTargetIsAvailable" type="MonoDevelop.Projects.Formats.MSBuild.TargetsAvailableCondition" />
<Extension path = "/MonoDevelop/Ide/Commands">
@@ -271,4 +278,8 @@
<!-- <CommandItem id = "MonoDevelop.Refactoring.RefactoryCommands.Resolve" insertbefore="MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations"/>-->
</Extension>
+ <Extension path = "/MonoDevelop/CSharp/Completion/ContextHandler">
+ <Class class="MonoDevelop.CSharp.Completion.ProtocolMemberContextHandler" />
+ </Extension>
+
</ExtensionModel> \ No newline at end of file
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index dafb0044c6..5fd898142f 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -126,9 +126,9 @@
<Name>ICSharpCode.NRefactory6.CSharp</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp.Refactoring\ICSharpCode.NRefactory6.CSharp.Refactoring.csproj">
+ <ProjectReference Include="..\..\..\external\NRefactory6\NR6Pack\NR6Pack.csproj">
<Project>{C465A5DC-AD28-49A2-89C0-F81838814A7E}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp.Refactoring</Name>
+ <Name>NR6Pack</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
@@ -163,35 +163,35 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Composition.AttributedModel">
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
index aff44879f8..e0d1fef7d0 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs
@@ -54,6 +54,7 @@ using MonoDevelop.Refactoring;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using MonoDevelop.Ide;
+using Mono.Addins;
namespace MonoDevelop.CSharp.Completion
{
@@ -75,6 +76,8 @@ namespace MonoDevelop.CSharp.Completion
SyntaxTree unit;
static readonly SyntaxTree emptyUnit = CSharpSyntaxTree.ParseText ("");
+ List<CompletionContextHandler> additionalContextHandlers = new List<CompletionContextHandler> ();
+
SyntaxTree Unit {
get {
return unit ?? emptyUnit;
@@ -151,6 +154,14 @@ namespace MonoDevelop.CSharp.Completion
public CSharpCompletionTextEditorExtension ()
{
+ foreach (var node in AddinManager.GetExtensionNodes<InstanceExtensionNode> ("/MonoDevelop/CSharp/Completion/ContextHandler")) {
+ var handler = (CompletionContextHandler)node.CreateInstance ();
+ var extHandler = handler as IExtensionContextHandler;
+ if (extHandler != null) {
+ extHandler.Init (this);
+ }
+ additionalContextHandlers.Add (handler);
+ }
}
bool addEventHandlersInInitialization = true;
@@ -168,10 +179,6 @@ namespace MonoDevelop.CSharp.Completion
protected override void Initialize ()
{
base.Initialize ();
-// DocumentContext.DocumentParsed += HandleDocumentParsed;
- additionalContextHandlers = new [] {
- new ProtocolMemberContextHandler (this)
- };
var parsedDocument = DocumentContext.ParsedDocument;
if (parsedDocument != null) {
@@ -364,8 +371,6 @@ namespace MonoDevelop.CSharp.Completion
}
}
- IEnumerable<CompletionContextHandler> additionalContextHandlers;
-
Task<ICompletionDataList> InternalHandleCodeCompletion (CodeCompletionContext completionContext, char completionChar, bool ctrlSpace, int triggerWordLength, CancellationToken token)
{
if (Editor.EditMode != MonoDevelop.Ide.Editor.EditMode.Edit)
@@ -1238,8 +1243,8 @@ namespace MonoDevelop.CSharp.Completion
cpos = Editor.CaretOffset;
wlen = 0;
}
- currentCompletionContext = CompletionWidget.CreateCodeCompletionContext (cpos);
- currentCompletionContext.TriggerWordLength = wlen;
+ CurrentCompletionContext = CompletionWidget.CreateCodeCompletionContext (cpos);
+ CurrentCompletionContext.TriggerWordLength = wlen;
var list = new CSharpCompletionDataList ();
list.TriggerWordLength = wlen;
@@ -1248,11 +1253,11 @@ namespace MonoDevelop.CSharp.Completion
AddImportCompletionData (list, semanticModel, offset);
- completionList = CodeCompletionCommand (currentCompletionContext);
+ completionList = CodeCompletionCommand (CurrentCompletionContext);
if (completionList != null)
- CompletionWindowManager.ShowWindow (this, (char)0, completionList, CompletionWidget, currentCompletionContext);
+ CompletionWindowManager.ShowWindow (this, (char)0, completionList, CompletionWidget, CurrentCompletionContext);
else
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ProtocolMemberContextHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ProtocolMemberContextHandler.cs
index 5aa77d4301..f460fa2c18 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ProtocolMemberContextHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/ProtocolMemberContextHandler.cs
@@ -33,12 +33,17 @@ using System.Linq;
using Mono.Addins.Description;
namespace MonoDevelop.CSharp.Completion
-{
- class ProtocolMemberContextHandler : OverrideContextHandler
+{
+ interface IExtensionContextHandler
+ {
+ void Init (CSharpCompletionTextEditorExtension extension);
+ }
+
+ class ProtocolMemberContextHandler : OverrideContextHandler, IExtensionContextHandler
{
CSharpCompletionTextEditorExtension extension;
- public ProtocolMemberContextHandler (CSharpCompletionTextEditorExtension extension)
+ void IExtensionContextHandler.Init (CSharpCompletionTextEditorExtension extension)
{
this.extension = extension;
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
index 65120bbf3b..a79f74c8d6 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs
@@ -41,10 +41,11 @@ using Microsoft.CodeAnalysis.Formatting;
using MonoDevelop.Ide.TypeSystem;
using ICSharpCode.NRefactory6.CSharp;
using MonoDevelop.Ide;
+using MonoDevelop.Core.Text;
namespace MonoDevelop.CSharp.Formatting
{
- class CSharpFormatter : AbstractAdvancedFormatter
+ class CSharpFormatter : AbstractCodeFormatter
{
static internal readonly string MimeType = "text/x-csharp";
@@ -52,63 +53,59 @@ namespace MonoDevelop.CSharp.Formatting
public override bool SupportsCorrectingIndent { get { return true; } }
- public override void CorrectIndenting (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- TextEditor data, int line)
+ protected override void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
{
- var lineSegment = data.GetLine (line);
+ var lineSegment = editor.GetLine (line);
if (lineSegment == null)
return;
try {
- var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
- var textpolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
+ var policy = policyParent.Get<CSharpFormattingPolicy> (MimeType);
+ var textpolicy = policyParent.Get<TextStylePolicy> (MimeType);
var tracker = new CSharpIndentEngine (policy.CreateOptions (textpolicy));
tracker.Update (IdeApp.Workbench.ActiveDocument.Editor, lineSegment.Offset);
for (int i = lineSegment.Offset; i < lineSegment.Offset + lineSegment.Length; i++) {
- tracker.Push (data.GetCharAt (i));
+ tracker.Push (editor.GetCharAt (i));
}
- string curIndent = lineSegment.GetIndentation (data);
+ string curIndent = lineSegment.GetIndentation (editor);
int nlwsp = curIndent.Length;
- if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && data.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
+ if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && editor.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
// Possibly replace the indent
string newIndent = tracker.ThisLineIndent;
if (newIndent != curIndent)
- data.ReplaceText (lineSegment.Offset, nlwsp, newIndent);
+ editor.ReplaceText (lineSegment.Offset, nlwsp, newIndent);
}
} catch (Exception e) {
LoggingService.LogError ("Error while indenting", e);
}
}
- public override void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
+ protected override void OnTheFlyFormatImplementation (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
{
OnTheFlyFormatter.Format (editor, context, startOffset, endOffset);
}
-
- public static string FormatText (CSharpFormattingPolicy policy, TextStylePolicy textPolicy, string mimeType, string input, int startOffset, int endOffset)
+ public static string FormatText (CSharpFormattingPolicy policy, TextStylePolicy textPolicy, string input, int startOffset, int endOffset)
{
- var inputTree = CSharpSyntaxTree.ParseText (SourceText.From (input));
+ var inputTree = CSharpSyntaxTree.ParseText (input);
var root = inputTree.GetRoot ();
var doc = Formatter.Format (root, new TextSpan (startOffset, endOffset - startOffset), TypeSystemService.Workspace, policy.CreateOptions (textPolicy));
var result = doc.ToFullString ();
if (textPolicy.GetEolMarker () != "\r\n")
result = result.Replace ("\r", "");
-
return result.Substring (startOffset, endOffset + result.Length - input.Length - startOffset);
}
- public override string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, string input, int startOffset, int endOffset)
+ protected override ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, ITextSource input, int startOffset, int endOffset)
{
- var policy = policyParent.Get<CSharpFormattingPolicy> (mimeTypeChain);
- var textPolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
-
- return FormatText (policy, textPolicy, mimeTypeChain.First (), input, startOffset, endOffset);
+ var policy = policyParent.Get<CSharpFormattingPolicy> (mimeType);
+ var textPolicy = policyParent.Get<TextStylePolicy> (mimeType);
+ return new StringTextSource (FormatText (policy, textPolicy, input.Text, startOffset, endOffset));
}
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
index 9b84859194..08de38d26e 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicy.cs
@@ -70,7 +70,6 @@ namespace MonoDevelop.CSharp.Formatting
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent, LanguageNames.CSharp, FormattingOptions.IndentStyle.Smart);
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize, LanguageNames.CSharp, policy.TabWidth);
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs, LanguageNames.CSharp, !policy.TabsToSpaces);
- result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabOnlyForIndentation, LanguageNames.CSharp, !policy.TabsToSpaces);
}
return result;
}
@@ -84,7 +83,6 @@ namespace MonoDevelop.CSharp.Formatting
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.SmartIndent, LanguageNames.CSharp, FormattingOptions.IndentStyle.Smart);
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.TabSize, LanguageNames.CSharp, policy.TabSize);
result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabs, LanguageNames.CSharp, !policy.TabsToSpaces);
- result = result.WithChangedOption (Microsoft.CodeAnalysis.Formatting.FormattingOptions.UseTabOnlyForIndentation, LanguageNames.CSharp, !policy.TabsToSpaces);
}
return result;
}
@@ -217,12 +215,12 @@ namespace MonoDevelop.CSharp.Formatting
}
[ItemProperty]
- public bool NewLinesForBracesInObjectInitializers {
+ public bool NewLinesForBracesInObjectCollectionArrayInitializers {
get {
- return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectInitializers);
+ return options.GetOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectCollectionArrayInitializers);
}
set {
- options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectInitializers, value);
+ options = options.WithChangedOption (Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions.NewLinesForBracesInObjectCollectionArrayInitializers, value);
}
}
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
index 3a892fa547..6c6462854f 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingPolicyPanelWidget.cs
@@ -90,7 +90,7 @@ namespace Example {
{
texteditor.Options = DefaultSourceEditorOptions.Instance.WithTextStyle (textStylePolicy);
- texteditor.Text = CSharpFormatter.FormatText (policy, textStylePolicy, CSharpFormatter.MimeType, example, 0, example.Length);
+ texteditor.Text = CSharpFormatter.FormatText (policy, textStylePolicy, example, 0, example.Length);
}
void HandleButtonEditClicked (object sender, EventArgs e)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
index 7f08f7dae2..095f28aef2 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormattingProfileDialog.cs
@@ -255,7 +255,7 @@ namespace MonoDevelop.CSharp.Formatting
B = 2
};
}");
- AddOption (newLineOptions, category, "NewLinesForBracesInObjectInitializers", GettextCatalog.GetString ("Place open brace on new line for object initializers"), @"void Example()
+ AddOption (newLineOptions, category, "NewLinesForBracesInObjectCollectionArrayInitializers", GettextCatalog.GetString ("Place open brace on new line for object initializers"), @"void Example()
{
new MyObject
{
@@ -651,7 +651,7 @@ namespace MonoDevelop.CSharp.Formatting
var types = DesktopService.GetMimeTypeInheritanceChain (MonoDevelop.CSharp.Formatting.CSharpFormatter.MimeType);
var textPolicy = MonoDevelop.Projects.Policies.PolicyService.GetDefaultPolicy<TextStylePolicy> (types);
- texteditor.Text = CSharpFormatter.FormatText (profile, textPolicy, CSharpFormatter.MimeType, text, 0, text.Length);
+ texteditor.Text = CSharpFormatter.FormatText (profile, textPolicy, text, 0, text.Length);
}
static PropertyInfo GetProperty (TreeModel model, TreeIter iter)
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
index f346f57e49..f5d6d29f23 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/AllmanCSharpPolicy.xml
@@ -37,7 +37,7 @@ THE SOFTWARE.
<NewLinesForBracesInAnonymousMethods>True</NewLinesForBracesInAnonymousMethods>
<NewLinesForBracesInControlBlocks>True</NewLinesForBracesInControlBlocks>
<NewLinesForBracesInAnonymousTypes>True</NewLinesForBracesInAnonymousTypes>
- <NewLinesForBracesInObjectInitializers>True</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInObjectCollectionArrayInitializers>True</NewLinesForBracesInObjectCollectionArrayInitializers>
<NewLinesForBracesInLambdaExpressionBody>True</NewLinesForBracesInLambdaExpressionBody>
<NewLineForElse>True</NewLineForElse>
<NewLineForCatch>True</NewLineForCatch>
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
index 92cb6cd61e..52d041226a 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/KRCSharpPolicy.xml
@@ -37,7 +37,7 @@ THE SOFTWARE.
<NewLinesForBracesInAnonymousMethods>False</NewLinesForBracesInAnonymousMethods>
<NewLinesForBracesInControlBlocks>False</NewLinesForBracesInControlBlocks>
<NewLinesForBracesInAnonymousTypes>False</NewLinesForBracesInAnonymousTypes>
- <NewLinesForBracesInObjectInitializers>False</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInObjectCollectionArrayInitializers>False</NewLinesForBracesInObjectCollectionArrayInitializers>
<NewLinesForBracesInLambdaExpressionBody>False</NewLinesForBracesInLambdaExpressionBody>
<NewLineForElse>False</NewLineForElse>
<NewLineForCatch>False</NewLineForCatch>
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
index 1a9b87ab52..56b22b1ce4 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/policies/MonoCSharpPolicy.xml
@@ -37,7 +37,7 @@ THE SOFTWARE.
<NewLinesForBracesInAnonymousMethods>False</NewLinesForBracesInAnonymousMethods>
<NewLinesForBracesInControlBlocks>False</NewLinesForBracesInControlBlocks>
<NewLinesForBracesInAnonymousTypes>False</NewLinesForBracesInAnonymousTypes>
- <NewLinesForBracesInObjectInitializers>False</NewLinesForBracesInObjectInitializers>
+ <NewLinesForBracesInObjectCollectionArrayInitializers>False</NewLinesForBracesInObjectCollectionArrayInitializers>
<NewLinesForBracesInLambdaExpressionBody>False</NewLinesForBracesInLambdaExpressionBody>
<NewLineForElse>False</NewLineForElse>
<NewLineForCatch>False</NewLineForCatch>
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
index b5bdc242fb..4db1bdd671 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Project/CSharpCompilerParameters.cs
@@ -36,6 +36,7 @@ using System.Linq;
using MonoDevelop.Projects.Formats.MSBuild;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
+using Microsoft.CodeAnalysis.CSharp;
namespace MonoDevelop.CSharp.Project
{
@@ -129,6 +130,7 @@ namespace MonoDevelop.CSharp.Project
UnsafeCode,
null,
null,
+ ImmutableArray<byte>.Empty,
null,
Microsoft.CodeAnalysis.Platform.AnyCpu,
ReportDiagnostic.Default,
@@ -180,7 +182,7 @@ namespace MonoDevelop.CSharp.Project
public override IEnumerable<string> GetDefineSymbols ()
{
- return definesymbols.Split (';', ',', ' ', '\t').Where (s => !string.IsNullOrWhiteSpace (s));
+ return definesymbols.Split (';', ',', ' ', '\t').Where (s => SyntaxFacts.IsValidIdentifier (s) && !string.IsNullOrWhiteSpace (s));
}
[Obsolete]
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
index 4b702126e5..3f9916581c 100644
--- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
+++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Refactoring/FindReferencesHandler.cs
@@ -25,6 +25,7 @@
// THE SOFTWARE.
using System;
+using System.Linq;
using System.Threading;
using MonoDevelop.Components.Commands;
using MonoDevelop.Core;
@@ -44,7 +45,10 @@ namespace MonoDevelop.CSharp.Refactoring
public static void FindRefs (ISymbol symbol)
{
var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
- var solution = TypeSystemService.Workspace.CurrentSolution;
+ var workspace = TypeSystemService.Workspace as MonoDevelopWorkspace;
+ if (workspace == null)
+ return;
+ var solution = workspace.CurrentSolution;
ThreadPool.QueueUserWorkItem (delegate {
try {
foreach (var loc in symbol.Locations) {
@@ -53,10 +57,19 @@ namespace MonoDevelop.CSharp.Refactoring
var sr = new SearchResult (new FileProvider (loc.SourceTree.FilePath), loc.SourceSpan.Start, loc.SourceSpan.Length);
monitor.ReportResult (sr);
}
-
+
foreach (var mref in SymbolFinder.FindReferencesAsync (symbol, solution).Result) {
foreach (var loc in mref.Locations) {
- var sr = new SearchResult (new FileProvider (loc.Document.FilePath), loc.Location.SourceSpan.Start, loc.Location.SourceSpan.Length);
+ var fileName = loc.Document.FilePath;
+ var offset = loc.Location.SourceSpan.Start;
+ string projectedName;
+ int projectedOffset;
+ if (workspace.TryGetOriginalFileFromProjection (fileName, offset, out projectedName, out projectedOffset)) {
+ fileName = projectedName;
+ offset = projectedOffset;
+ }
+
+ var sr = new SearchResult (new FileProvider (fileName), offset, loc.Location.SourceSpan.Length);
monitor.ReportResult (sr);
}
}
@@ -101,7 +114,10 @@ namespace MonoDevelop.CSharp.Refactoring
public static void FindRefs (ISymbol obj, Compilation compilation)
{
var monitor = IdeApp.Workbench.ProgressMonitors.GetSearchProgressMonitor (true, true);
- var solution = TypeSystemService.Workspace.CurrentSolution;
+ var workspace = TypeSystemService.Workspace as MonoDevelopWorkspace;
+ if (workspace == null)
+ return;
+ var solution = workspace.CurrentSolution;
ThreadPool.QueueUserWorkItem (delegate {
try {
foreach (var simSym in SymbolFinder.FindSimilarSymbols (obj, compilation)) {
@@ -112,7 +128,16 @@ namespace MonoDevelop.CSharp.Refactoring
foreach (var mref in SymbolFinder.FindReferencesAsync (simSym, solution).Result) {
foreach (var loc in mref.Locations) {
- var sr = new SearchResult (new FileProvider (loc.Document.FilePath), loc.Location.SourceSpan.Start, loc.Location.SourceSpan.Length);
+ var fileName = loc.Document.FilePath;
+ var offset = loc.Location.SourceSpan.Start;
+ string projectedName;
+ int projectedOffset;
+ if (workspace.TryGetOriginalFileFromProjection (fileName, offset, out projectedName, out projectedOffset)) {
+ fileName = projectedName;
+ offset = projectedOffset;
+ }
+
+ var sr = new SearchResult (new FileProvider (fileName), offset, loc.Location.SourceSpan.Length);
monitor.ReportResult (sr);
}
}
diff --git a/main/src/addins/CSharpBinding/packages.config b/main/src/addins/CSharpBinding/packages.config
index 40b4864e8f..0d5434746f 100644
--- a/main/src/addins/CSharpBinding/packages.config
+++ b/main/src/addins/CSharpBinding/packages.config
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj
index 673c410fe2..f96e950782 100644
--- a/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj
+++ b/main/src/addins/ChangeLogAddIn/ChangeLogAddIn.csproj
@@ -111,11 +111,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/ChangeLogAddIn/packages.config b/main/src/addins/ChangeLogAddIn/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/ChangeLogAddIn/packages.config
+++ b/main/src/addins/ChangeLogAddIn/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs b/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
index 0616288466..2ee1fcf81c 100644
--- a/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/CenteringSpace.cs
@@ -27,6 +27,7 @@ using System;
using AppKit;
using CoreGraphics;
using Foundation;
+using MonoDevelop.Ide;
namespace MonoDevelop.MacIntegration.MainToolbar
{
@@ -41,7 +42,14 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public override void ViewDidMoveToWindow ()
{
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => toolbarItem.UpdateWidth ());
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif =>
+ DispatchService.GuiDispatch (toolbarItem.UpdateWidth));
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.WillEnterFullScreenNotification, notif =>
+ CenteringSpaceToolbarItem.WindowFullscreening = true);
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidEnterFullScreenNotification, notif => {
+ CenteringSpaceToolbarItem.WindowFullscreening = false;
+ DispatchService.GuiDispatch (toolbarItem.UpdateWidth);
+ });
base.ViewDidMoveToWindow ();
}
}
@@ -49,6 +57,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
[Register]
class CenteringSpaceToolbarItem : NSToolbarItem
{
+ internal static bool WindowFullscreening;
public CenteringSpaceToolbarItem ()
{
Initialize ();
@@ -75,6 +84,12 @@ namespace MonoDevelop.MacIntegration.MainToolbar
public override CGSize MinSize {
get {
+ // Do NOT let this calculate any values while the window is fullscreening.
+ // Everything changes, and the size might end up with bogus values and cause a native crash
+ // that is totally unrelated. See BXC 29261.
+ if (WindowFullscreening)
+ return base.MinSize;
+
NSToolbarItem[] items = Toolbar.Items;
int index = Array.IndexOf (items, this);
diff --git a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
index 7aef34e322..1f39b598c1 100644
--- a/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/MainToolbar.cs
@@ -32,6 +32,7 @@ using MonoDevelop.Core;
using AppKit;
using CoreGraphics;
using Foundation;
+using MonoDevelop.Ide;
namespace MonoDevelop.MacIntegration.MainToolbar
{
@@ -74,9 +75,14 @@ namespace MonoDevelop.MacIntegration.MainToolbar
get { return (SearchBar)widget.Items[searchEntryIdx + buttonBarCount].View; }
}
+ // TODO: Remove this when XamMac 2.2 goes stable.
+ static HashSet<object> viewCache = new HashSet<object> ();
+ static HashSet<ButtonBar> buttonBarCache = new HashSet<ButtonBar> ();
+
NSToolbarItem CreateRunToolbarItem ()
{
var button = new RunButton ();
+ viewCache.Add (button);
button.Activated += (o, e) => {
if (RunButtonClicked != null)
RunButtonClicked (o, e);
@@ -93,6 +99,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
NSToolbarItem CreateSelectorToolbarItem ()
{
var selector = new SelectorView ();
+ viewCache.Add (selector);
var item = new NSToolbarItem (SelectorId) {
View = selector,
MinSize = new CGSize (150, 25),
@@ -118,6 +125,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
NSToolbarItem CreateButtonBarToolbarItem ()
{
var bar = new ButtonBar (barItems);
+ buttonBarCache.Add (bar);
// By default, Cocoa doesn't want to duplicate items in the toolbar.
// Use different Ids to prevent this and not have to subclass.
var item = new NSToolbarItem (ButtonBarId + buttonBarCount) {
@@ -160,6 +168,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
NSToolbarItem CreateSearchBarToolbarItem ()
{
var bar = new SearchBar ();
+ viewCache.Add (bar);
var menuBar = new SearchBar {
Frame = new CGRect (0, 0, 180, bar.FittingSize.Height),
};
@@ -178,6 +187,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
NSToolbarItem CreateStatusBarToolbarItem ()
{
var bar = new StatusBar ();
+ viewCache.Add (bar);
var item = new NSToolbarItem (StatusBarId) {
View = bar,
// Place some temporary values in there.
@@ -185,7 +195,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
MaxSize = new CGSize (360, 22),
};
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notif => DispatchService.GuiDispatch (() => {
// Skip updates with a null Window. Only crashes on Mavericks.
// The View gets updated once again when the window resize finishes.
if (bar.Window == null)
@@ -196,13 +206,15 @@ namespace MonoDevelop.MacIntegration.MainToolbar
item.MinSize = new CGSize ((nfloat)Math.Max (280, minSize), 22);
item.MaxSize = new CGSize ((nfloat)Math.Min (700, maxSize), 22);
bar.RepositionStatusLayers ();
- });
+ }));
return item;
}
NSToolbarItem CreateCenteringSpaceItem ()
{
- return new CenteringSpaceToolbarItem (CenteringSpaceId);
+ var item = new CenteringSpaceToolbarItem (CenteringSpaceId);
+ viewCache.Add (item.View);
+ return item;
}
public MainToolbar (Gtk.Window window)
@@ -239,6 +251,9 @@ namespace MonoDevelop.MacIntegration.MainToolbar
widget.InsertItem (StatusBarId, statusBarIdx = ++total);
widget.InsertItem (NSToolbar.NSToolbarFlexibleSpaceItemIdentifier, ++total);
widget.InsertItem (SearchBarId, searchEntryIdx = ++total);
+
+ // NSButton -> NSToolbarItemViewer -> _NSToolbarClipView -> NSToolbarView -> NSToolbarClippedItemsIndicator
+ viewCache.Add (runButton.Superview.Superview.Superview);
}
#region IMainToolbarView implementation
@@ -281,6 +296,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
List<IButtonBarButton> barItems = new List<IButtonBarButton> ();
public void RebuildToolbar (IEnumerable<IButtonBarButton> buttons)
{
+ buttonBarCache.Clear ();
while (buttonBarCount > 0) {
widget.RemoveItem (buttonBarStartIdx);
--buttonBarCount;
diff --git a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
index 1e002048c9..c9e5326d69 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SearchBar.cs
@@ -28,6 +28,7 @@ using AppKit;
using Foundation;
using Gtk;
using MonoDevelop.Components.Mac;
+using MonoDevelop.Ide;
namespace MonoDevelop.MacIntegration.MainToolbar
{
@@ -57,16 +58,16 @@ namespace MonoDevelop.MacIntegration.MainToolbar
void Initialize ()
{
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResignKeyNotification, notification => {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResignKeyNotification, notification => DispatchService.GuiDispatch (() => {
if (notification.Object == Window)
if (LostFocus != null)
LostFocus (this, null);
- });
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notification => {
+ }));
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidResizeNotification, notification => DispatchService.GuiDispatch (() => {
if (notification.Object == Window)
if (LostFocus != null)
LostFocus (this, null);
- });
+ }));
}
static Xwt.ModifierKeys TranslateMask (NSEventModifierMask mask)
diff --git a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
index 99db372328..f61007805d 100644
--- a/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/SelectorView.cs
@@ -211,7 +211,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
base.ViewDidMoveToWindow ();
NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification,
- notification => RealignTexts () );
+ notification => DispatchService.GuiDispatch (RealignTexts));
RealignTexts ();
}
diff --git a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
index 985fb540ef..0248473cfd 100644
--- a/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
+++ b/main/src/addins/MacPlatform/MainToolbar/StatusBar.cs
@@ -197,7 +197,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
TaskService.Errors.TasksAdded += updateHandler;
TaskService.Errors.TasksRemoved += updateHandler;
- NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification, delegate {
+ NSNotificationCenter.DefaultCenter.AddObserver (NSWindow.DidChangeBackingPropertiesNotification, notif => DispatchService.GuiDispatch (() => {
if (Window == null)
return;
@@ -210,7 +210,7 @@ namespace MonoDevelop.MacIntegration.MainToolbar
buildResultIcon.SetImage (buildImageId, Window.BackingScaleFactor);
buildResultText.ContentsScale = Window.BackingScaleFactor;
}
- });
+ }));
AddSubview (imageView);
AddSubview (textField);
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
index 59ea407e2e..cf4b9204ba 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser.csproj
@@ -72,11 +72,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="monodoc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
index f560573715..7d10f088c8 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/AssemblyBrowserWidget.cs
@@ -204,7 +204,7 @@ namespace MonoDevelop.AssemblyBrowser
TreeView.ShadowType = ShadowType.None;
TreeView.BorderWidth = 1;
TreeView.ShowBorderLine = false;
- TreeView.Zoom = 1.0;
+ //TreeView.Zoom = 1.0;
treeViewPlaceholder.Add (TreeView);
@@ -1482,7 +1482,7 @@ namespace MonoDevelop.AssemblyBrowser
builder.Selected = builder.Expanded = selectReference;
}
- MonoDevelop.Components.RoundedFrame popupWidgetFrame;
+ //MonoDevelop.Components.RoundedFrame popupWidgetFrame;
#region NavigationHistory
Stack<ITreeNavigator> navigationBackwardHistory = new Stack<ITreeNavigator> ();
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/DomMethodNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/DomMethodNodeBuilder.cs
index 2fb905e139..d3086c55fd 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/DomMethodNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/DomMethodNodeBuilder.cs
@@ -198,8 +198,8 @@ namespace MonoDevelop.AssemblyBrowser
internal static string GetAttributes (IEnumerable<IAttribute> attributes)
{
- StringBuilder result = new StringBuilder ();
- var ambience = new CSharpAmbience ();
+ var result = new StringBuilder ();
+ //var ambience = new CSharpAmbience ();
foreach (var attr in attributes) {
if (result.Length > 0)
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ProjectNodeBuilder.cs b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ProjectNodeBuilder.cs
index ba69c55f8a..9e9b83ea90 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ProjectNodeBuilder.cs
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/MonoDevelop.AssemblyBrowser/TreeNodes/ProjectNodeBuilder.cs
@@ -74,7 +74,7 @@ namespace MonoDevelop.AssemblyBrowser
public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
{
- var project = (Project)dataObject;
+ //var project = (Project)dataObject;
// TODO: Roslyn port.
// var ctx = TypeSystemService.GetProjectContext (project);
// if (ctx == null)
@@ -98,7 +98,7 @@ namespace MonoDevelop.AssemblyBrowser
public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
{
- var project = (Project)dataObject;
+ //var project = (Project)dataObject;
// TODO: Roslyn port.
//var ctx = TypeSystemService.GetProjectContext (project);
//if (ctx == null)
diff --git a/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config b/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config
+++ b/main/src/addins/MonoDevelop.AssemblyBrowser/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
index 4cb96364ed..37d155aa0f 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
@@ -99,19 +99,19 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing" />
@@ -136,11 +136,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
index df90cca273..18895f3aef 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
@@ -1524,7 +1524,7 @@ namespace MonoDevelop.Debugger
void SetPreviewButtonIcon (PreviewButtonIcons icon, TreeIter it = default(TreeIter))
{
- if (PreviewWindowManager.IsVisible) {
+ if (PreviewWindowManager.IsVisible || editing) {
return;
}
if (!it.Equals (TreeIter.Zero)) {
@@ -1766,27 +1766,32 @@ namespace MonoDevelop.Debugger
startPreviewCaret = GetCellRendererArea (path, col, cr);
startHAdj = Hadjustment.Value;
startVAdj = Vadjustment.Value;
+ int w, h;
using (var layout = new Pango.Layout (PangoContext)) {
layout.FontDescription = crtExp.FontDesc.Copy ();
layout.FontDescription.Family = crtExp.Family;
layout.SetText ((string)store.GetValue (it, NameColumn));
- int w, h;
layout.GetPixelSize (out w, out h);
- startPreviewCaret.X += (int)(w + cr.Xpad * 3);
- startPreviewCaret.Width = 16;
- ConvertTreeToWidgetCoords (startPreviewCaret.X, startPreviewCaret.Y, out startPreviewCaret.X, out startPreviewCaret.Y);
- startPreviewCaret.X += (int)Hadjustment.Value;
- startPreviewCaret.Y += (int)Vadjustment.Value;
- if (startPreviewCaret.X < evnt.X &&
- startPreviewCaret.X + 16 > evnt.X) {
- if (CompactView) {
- SetPreviewButtonIcon (PreviewButtonIcons.Active, it);
- } else {
- SetPreviewButtonIcon (PreviewButtonIcons.Selected, it);
- }
- DebuggingService.ShowPreviewVisualizer (val, this, startPreviewCaret);
- closePreviewWindow = false;
+ }
+ startPreviewCaret.X += (int)(w + cr.Xpad * 3);
+ startPreviewCaret.Width = 16;
+ ConvertTreeToWidgetCoords (startPreviewCaret.X, startPreviewCaret.Y, out startPreviewCaret.X, out startPreviewCaret.Y);
+ startPreviewCaret.X += (int)Hadjustment.Value;
+ startPreviewCaret.Y += (int)Vadjustment.Value;
+ if (startPreviewCaret.X < evnt.X &&
+ startPreviewCaret.X + 16 > evnt.X) {
+ if (CompactView) {
+ SetPreviewButtonIcon (PreviewButtonIcons.Active, it);
+ } else {
+ SetPreviewButtonIcon (PreviewButtonIcons.Selected, it);
}
+ DebuggingService.ShowPreviewVisualizer (val, this, startPreviewCaret);
+ closePreviewWindow = false;
+ } else {
+ if (editing)
+ base.OnButtonPressEvent (evnt);//End current editing
+ if (!Selection.IterIsSelected (it))
+ base.OnButtonPressEvent (evnt);//Select row, so base.OnButtonPressEvent below starts editing
}
} else if (cr == crtValue) {
if ((Platform.IsMac && ((evnt.State & Gdk.ModifierType.Mod2Mask) > 0)) ||
@@ -1797,6 +1802,11 @@ namespace MonoDevelop.Debugger
DesktopService.ShowUrl (url);
}
}
+ } else if (cr == crtExp) {
+ if (editing)
+ base.OnButtonPressEvent (evnt);//End current editing
+ if (!Selection.IterIsSelected (it))
+ base.OnButtonPressEvent (evnt);//Select row, so base.OnButtonPressEvent below starts editing
} else if (!editing) {
if (cr == crpButton) {
HandleValueButton (it);
@@ -1861,6 +1871,10 @@ namespace MonoDevelop.Debugger
[CommandUpdateHandler (EditCommands.SelectAll)]
protected void UpdateSelectAll (CommandInfo cmd)
{
+ if (editing) {
+ cmd.Bypass = true;
+ return;
+ }
TreeIter iter;
cmd.Enabled = store.GetIterFirst (out iter);
@@ -1869,6 +1883,10 @@ namespace MonoDevelop.Debugger
[CommandHandler (EditCommands.SelectAll)]
protected new void OnSelectAll ()
{
+ if (editing) {
+ base.OnSelectAll ();
+ return;
+ }
Selection.SelectAll ();
}
diff --git a/main/src/addins/MonoDevelop.Debugger/packages.config b/main/src/addins/MonoDevelop.Debugger/packages.config
index b2c4c974c7..27a905b565 100644
--- a/main/src/addins/MonoDevelop.Debugger/packages.config
+++ b/main/src/addins/MonoDevelop.Debugger/packages.config
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
index 178a232392..d3a3da0f9b 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.csproj
@@ -72,11 +72,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/packages.config b/main/src/addins/MonoDevelop.DesignerSupport/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/packages.config
+++ b/main/src/addins/MonoDevelop.DesignerSupport/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
index 7e88624c8f..2b48694876 100644
--- a/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
+++ b/main/src/addins/MonoDevelop.DocFood/MonoDevelop.DocFood.csproj
@@ -58,19 +58,19 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.DocFood/packages.config b/main/src/addins/MonoDevelop.DocFood/packages.config
index f8f771207f..c6cd994d30 100644
--- a/main/src/addins/MonoDevelop.DocFood/packages.config
+++ b/main/src/addins/MonoDevelop.DocFood/packages.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
index 9f9da3ca40..dc1ea49911 100644
--- a/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
+++ b/main/src/addins/MonoDevelop.Gettext/MonoDevelop.Gettext.csproj
@@ -68,11 +68,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.Gettext/packages.config b/main/src/addins/MonoDevelop.Gettext/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/MonoDevelop.Gettext/packages.config
+++ b/main/src/addins/MonoDevelop.Gettext/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
index a5a71f065d..65cde80d96 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
@@ -93,7 +93,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
var docId = TypeSystemService.GetDocumentId (project, file);
if (docId == null)
return null;
- var doc = TypeSystemService.GetCodeAnysisDocument (docId);
+ var doc = TypeSystemService.GetCodeAnalysisDocument (docId);
if (doc == null)
return null;
Microsoft.CodeAnalysis.SemanticModel semanticModel;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
index d42732a2a1..8ff0c6bc73 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
@@ -343,7 +343,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
var docId = TypeSystemService.GetDocumentId (args.Project, args.ProjectFile.Name);
if (docId == null)
continue;
- var doc = TypeSystemService.GetCodeAnysisDocument (docId);
+ var doc = TypeSystemService.GetCodeAnalysisDocument (docId);
if (doc == null)
continue;
@@ -376,7 +376,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder
var docId = TypeSystemService.GetDocumentId (args.Project, args.ProjectFile.Name);
if (docId == null)
continue;
- var doc = TypeSystemService.GetCodeAnysisDocument (docId);
+ var doc = TypeSystemService.GetCodeAnalysisDocument (docId);
if (doc == null)
continue;
var semanticModel = doc.GetSemanticModelAsync ().Result;
diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
index d59b56aa8b..ca274dae25 100644
--- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
+++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.csproj
@@ -70,27 +70,27 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.GtkCore/packages.config b/main/src/addins/MonoDevelop.GtkCore/packages.config
index 12fcbf164a..b8e64e0806 100644
--- a/main/src/addins/MonoDevelop.GtkCore/packages.config
+++ b/main/src/addins/MonoDevelop.GtkCore/packages.config
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/AnalyzersFromAssembly.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/AnalyzersFromAssembly.cs
index 05331147ab..fa232eb3fe 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/AnalyzersFromAssembly.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeIssues/AnalyzersFromAssembly.cs
@@ -70,7 +70,7 @@ namespace MonoDevelop.CodeIssues
var assemblyName = asm.GetName ().Name;
if (assemblyName == "MonoDevelop.AspNet" ||
assemblyName == "Microsoft.CodeAnalysis.CSharp" ||
- assemblyName != "ICSharpCode.NRefactory6.CSharp.Refactoring" &&
+ assemblyName != "NR6Pack" &&
!(asm.GetReferencedAssemblies ().Any (a => a.Name == diagnosticAnalyzerAssembly) && asm.GetReferencedAssemblies ().Any (a => a.Name == "MonoDevelop.Ide")))
return;
}
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
index 291163ce86..77a3178061 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.csproj
@@ -84,35 +84,35 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Composition.AttributedModel">
@@ -269,16 +269,16 @@
<Name>ICSharpCode.NRefactory6.CSharp</Name>
<Private>False</Private>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp.Refactoring\ICSharpCode.NRefactory6.CSharp.Refactoring.csproj">
- <Project>{C465A5DC-AD28-49A2-89C0-F81838814A7E}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp.Refactoring</Name>
- <Private>False</Private>
- </ProjectReference>
<ProjectReference Include="..\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor.csproj">
<Project>{F8F92AA4-A376-4679-A9D4-60E7B7FBF477}</Project>
<Name>MonoDevelop.SourceEditor</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\..\..\external\NRefactory6\NR6Pack\NR6Pack.csproj">
+ <Project>{C465A5DC-AD28-49A2-89C0-F81838814A7E}</Project>
+ <Name>NR6Pack</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
index 4f4009a77e..030b7ee404 100644
--- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
+++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs
@@ -83,16 +83,41 @@ namespace MonoDevelop.Refactoring
var handler = new RenameHandler (changes);
FileService.FileRenamed += handler.FileRename;
var fileNames = new HashSet<FilePath> ();
+ var ws = TypeSystemService.Workspace as MonoDevelopWorkspace;
+ string originalName;
+ int originalOffset;
+
+ for (int i = 0; i < changes.Count; i++) {
+ var change = changes[i] as TextReplaceChange;
+ if (change == null)
+ continue;
+
+ if (ws.TryGetOriginalFileFromProjection (change.FileName, change.Offset, out originalName, out originalOffset)) {
+ fileNames.Add (change.FileName);
+ change.FileName = originalName;
+ change.Offset = originalOffset;
+ }
+ }
+ if (changes.All (x => x is TextReplaceChange)) {
+ List<Change> newChanges = new List<Change> (changes);
+ newChanges.Sort ((Change x, Change y) => ((TextReplaceChange)x).Offset.CompareTo (((TextReplaceChange)y).Offset));
+ changes = newChanges;
+ }
+
+
for (int i = 0; i < changes.Count; i++) {
changes[i].PerformChange (monitor, rctx);
var replaceChange = changes[i] as TextReplaceChange;
if (replaceChange == null)
continue;
+
for (int j = i + 1; j < changes.Count; j++) {
var change = changes[j] as TextReplaceChange;
if (change == null)
continue;
+
fileNames.Add (change.FileName);
+
if (replaceChange.Offset >= 0 && change.Offset >= 0 && replaceChange.FileName == change.FileName) {
if (replaceChange.Offset < change.Offset) {
change.Offset -= replaceChange.RemovedChars;
diff --git a/main/src/addins/MonoDevelop.Refactoring/packages.config b/main/src/addins/MonoDevelop.Refactoring/packages.config
index 796aed48f4..46efb6b2e2 100644
--- a/main/src/addins/MonoDevelop.Refactoring/packages.config
+++ b/main/src/addins/MonoDevelop.Refactoring/packages.config
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.27" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
index 230fea5ab5..da3dcf556a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.Wrappers/SemanticHighlightingSyntaxMode.cs
@@ -66,7 +66,7 @@ namespace MonoDevelop.SourceEditor.Wrappers
{
public bool GetStyle (Chunk chunk, ref int endOffset, out string style)
{
- var segment = GetSegmentsAt (chunk.Offset).FirstOrDefault ();
+ var segment = GetSegmentsAt (chunk.Offset).FirstOrDefault (s => s.EndOffset > chunk.Offset);
if (segment == null) {
style = null;
return false;
@@ -142,7 +142,7 @@ namespace MonoDevelop.SourceEditor.Wrappers
return;
}
int endLoc = -1;
- string semanticStyle = null;
+ StyledTreeSegment treeseg = null;
try {
HighlightingSegmentTree tree;
@@ -154,21 +154,23 @@ namespace MonoDevelop.SourceEditor.Wrappers
}
semanticMode.lineSegments[line] = tree;
}
- string style;
- if (tree.GetStyle (chunk, ref endLoc, out style)) {
- semanticStyle = style;
- }
+ treeseg = tree.GetSegmentsOverlapping (chunk).FirstOrDefault (s => s.Offset < chunk.EndOffset && s.EndOffset > chunk.Offset);
} catch (Exception e) {
Console.WriteLine ("Error in semantic highlighting: " + e);
}
- if (semanticStyle != null) {
- if (endLoc < chunk.EndOffset) {
- base.AddRealChunk (new Chunk (chunk.Offset, endLoc - chunk.Offset, semanticStyle));
- base.AddRealChunk (new Chunk (endLoc, chunk.EndOffset - endLoc, chunk.Style));
- return;
- }
- chunk.Style = semanticStyle;
+ if (treeseg != null) {
+ if (treeseg.Offset - chunk.Offset > 0)
+ AddRealChunk (new Chunk (chunk.Offset, treeseg.Offset - chunk.Offset, chunk.Style));
+
+ var startOffset = Math.Max (chunk.Offset, treeseg.Offset);
+ var endOffset = Math.Min (treeseg.EndOffset, chunk.EndOffset);
+
+ base.AddRealChunk (new Chunk (startOffset, endOffset - startOffset, treeseg.Style));
+
+ if (endOffset < chunk.EndOffset)
+ AddRealChunk (new Chunk (treeseg.EndOffset, chunk.EndOffset - endOffset, chunk.Style));
+ return;
}
base.AddRealChunk (chunk);
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index 0e0287a4d7..ce2cba47ed 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -134,11 +134,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
index 0f37053c2d..a4fad85253 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
@@ -55,6 +55,7 @@ using System.Text;
using Mono.Addins;
using MonoDevelop.Components;
using Mono.TextEditor.Utils;
+using MonoDevelop.Core.Text;
using MonoDevelop.Ide.Editor;
using MonoDevelop.SourceEditor.Wrappers;
using MonoDevelop.Ide.Editor.Extension;
@@ -674,7 +675,7 @@ namespace MonoDevelop.SourceEditor
// writeBom =!Mono.TextEditor.Utils.TextFileUtility.IsASCII (writeText);
}
}
- TextFileUtility.WriteText (fileName, writeText, writeEncoding, writeBom);
+ MonoDevelop.Core.Text.TextFileUtility.WriteText (fileName, writeText, writeEncoding, writeBom);
} catch (InvalidEncodingException) {
var result = MessageService.AskQuestion (GettextCatalog.GetString ("Can't save file with current codepage."),
GettextCatalog.GetString ("Some unicode characters in this file could not be saved with the current encoding.\nDo you want to resave this file as Unicode ?\nYou can choose another encoding in the 'save as' dialog."),
@@ -684,7 +685,7 @@ namespace MonoDevelop.SourceEditor
if (result != AlertButton.Cancel) {
hadBom = true;
this.encoding = Encoding.UTF8;
- TextFileUtility.WriteText (fileName, Document.Text, encoding, hadBom);
+ MonoDevelop.Core.Text.TextFileUtility.WriteText (fileName, Document.Text, encoding, hadBom);
} else {
return;
}
@@ -775,10 +776,10 @@ namespace MonoDevelop.SourceEditor
else {
inLoad = true;
if (loadEncoding == null) {
- text = TextFileUtility.ReadAllText (fileName, out hadBom, out encoding);
+ text = MonoDevelop.Core.Text.TextFileUtility.ReadAllText (fileName, out hadBom, out encoding);
} else {
encoding = loadEncoding;
- text = TextFileUtility.ReadAllText (fileName, loadEncoding, out hadBom);
+ text = MonoDevelop.Core.Text.TextFileUtility.ReadAllText (fileName, loadEncoding, out hadBom);
}
text = ProcessLoadText (text);
if (reload) {
@@ -1431,7 +1432,7 @@ namespace MonoDevelop.SourceEditor
TextEditor.DeleteSelectedText ();
var offset = TextEditor.Caret.Offset;
int length = TextEditor.Insert (offset, value);
- TextEditor.SelectionRange = new TextSegment (offset, length);
+ TextEditor.SelectionRange = new Mono.TextEditor.TextSegment (offset, length);
}
}
@@ -1703,7 +1704,12 @@ namespace MonoDevelop.SourceEditor
result.TriggerLineOffset = loc.Column - 1;
var p = widget.TextEditor.LocationToPoint (loc);
int tx, ty;
- editor.ParentWindow.GetOrigin (out tx, out ty);
+ var parentWindow = editor.ParentWindow;
+ if (parentWindow != null) {
+ parentWindow.GetOrigin (out tx, out ty);
+ } else {
+ tx = ty = 0;
+ }
tx += editor.Allocation.X + p.X;
ty += editor.Allocation.Y + p.Y + (int)editor.LineHeight;
@@ -2619,7 +2625,7 @@ namespace MonoDevelop.SourceEditor
IEnumerable<ITextSegmentMarker> ITextEditorImpl.GetTextSegmentMarkersAt (MonoDevelop.Core.Text.ISegment segment)
{
- return TextEditor.Document.GetTextSegmentMarkersAt (new TextSegment (segment.Offset, segment.Length)).OfType<ITextSegmentMarker> ();
+ return TextEditor.Document.GetTextSegmentMarkersAt (new Mono.TextEditor.TextSegment (segment.Offset, segment.Length)).OfType<ITextSegmentMarker> ();
}
IEnumerable<ITextSegmentMarker> ITextEditorImpl.GetTextSegmentMarkersAt (int offset)
@@ -2701,7 +2707,7 @@ namespace MonoDevelop.SourceEditor
return MonoDevelop.Core.Text.TextSegment.FromBounds (range.Offset, range.EndOffset);
}
set {
- TextEditor.SelectionRange = new TextSegment (value.Offset, value.Length);
+ TextEditor.SelectionRange = new Mono.TextEditor.TextSegment (value.Offset, value.Length);
}
}
@@ -2910,6 +2916,28 @@ namespace MonoDevelop.SourceEditor
}
}
+ void ITextEditorImpl.UpdateBraceMatchingResult (BraceMatchingResult? result)
+ {
+ var oldOffset = widget.TextEditor.TextViewMargin.HighlightBracketOffset;
+
+ if (result.HasValue) {
+ if (result.Value.IsCaretInLeft) {
+ widget.TextEditor.TextViewMargin.HighlightBracketOffset = result.Value.RightSegment.Offset;
+ } else {
+ widget.TextEditor.TextViewMargin.HighlightBracketOffset = result.Value.LeftSegment.Offset;
+ }
+ } else {
+ widget.TextEditor.TextViewMargin.HighlightBracketOffset = -1;
+ }
+
+ if (oldOffset >= 0) {
+ widget.Document.CommitLineUpdate (widget.TextEditor.OffsetToLineNumber (oldOffset));
+ }
+ if (widget.TextEditor.TextViewMargin.HighlightBracketOffset >= 0) {
+ widget.Document.CommitLineUpdate (widget.TextEditor.OffsetToLineNumber (widget.TextEditor.TextViewMargin.HighlightBracketOffset));
+ }
+ }
+
public event EventHandler<MonoDevelop.Ide.Editor.LineEventArgs> LineChanged;
public event EventHandler<MonoDevelop.Ide.Editor.LineEventArgs> LineInserted;
@@ -3214,9 +3242,9 @@ namespace MonoDevelop.SourceEditor
switch (effect) {
case TextSegmentMarkerEffect.DottedLine:
case TextSegmentMarkerEffect.WavedLine:
- return new GenericUnderlineMarker (new TextSegment (offset, length), effect);
+ return new GenericUnderlineMarker (new Mono.TextEditor.TextSegment (offset, length), effect);
case TextSegmentMarkerEffect.GrayOut:
- return new GrayOutMarker (new TextSegment (offset, length));
+ return new GrayOutMarker (new Mono.TextEditor.TextSegment (offset, length));
default:
throw new ArgumentOutOfRangeException ();
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/packages.config b/main/src/addins/MonoDevelop.SourceEditor2/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/packages.config
+++ b/main/src/addins/MonoDevelop.SourceEditor2/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
index aebd84d0d2..ffc2b02c90 100644
--- a/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
+++ b/main/src/addins/NUnit/MonoDevelop.NUnit.csproj
@@ -84,11 +84,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/NUnit/packages.config b/main/src/addins/NUnit/packages.config
index 9e112b4847..8df46df342 100644
--- a/main/src/addins/NUnit/packages.config
+++ b/main/src/addins/NUnit/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="NUnit" version="2.6.3" targetFramework="net40" />
<package id="NUnit.Runners" version="2.6.3" targetFramework="net40" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
index 6829810e05..7bcc71200a 100644
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/MonoDevelop.TextTemplating.csproj
@@ -85,11 +85,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml" />
diff --git a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config
+++ b/main/src/addins/TextTemplating/MonoDevelop.TextTemplating/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
index c329b72003..83dc409354 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.csproj
@@ -121,11 +121,11 @@
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config b/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config
index d3fca62c00..da5082381a 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/addins/Xml/Formatting/XmlFormatter.cs b/main/src/addins/Xml/Formatting/XmlFormatter.cs
index 04dec619c5..0db7df655f 100644
--- a/main/src/addins/Xml/Formatting/XmlFormatter.cs
+++ b/main/src/addins/Xml/Formatting/XmlFormatter.cs
@@ -32,10 +32,11 @@ using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide;
using MonoDevelop.Projects.Policies;
using MonoDevelop.Ide.CodeFormatting;
+using MonoDevelop.Core.Text;
namespace MonoDevelop.Xml.Formatting
{
- public class XmlFormatter: ICodeFormatter
+ public class XmlFormatter: AbstractCodeFormatter
{
public static string FormatXml (TextStylePolicy textPolicy, XmlFormattingPolicy formattingPolicy, string input)
{
@@ -55,12 +56,12 @@ namespace MonoDevelop.Xml.Formatting
xmlWriter.Flush ();
return sw.ToString ();
}
-
- public string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeInheritanceChain, string input)
+
+ protected override Core.Text.ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, Core.Text.ITextSource input, int startOffset, int endOffset)
{
- var txtPol = policyParent.Get<TextStylePolicy> (mimeTypeInheritanceChain);
- var xmlPol = policyParent.Get<XmlFormattingPolicy> (mimeTypeInheritanceChain);
- return FormatXml (txtPol, xmlPol, input);
+ var txtPol = policyParent.Get<TextStylePolicy> (mimeType);
+ var xmlPol = policyParent.Get<XmlFormattingPolicy> (mimeType);
+ return new StringTextSource(FormatXml (txtPol, xmlPol, input.Text));
}
public string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeInheritanceChain, string input, int fromOffest, int toOffset)
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/LineSplitter.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/LineSplitter.cs
index 3b3ec80988..4343b21bb4 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/LineSplitter.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/LineSplitter.cs
@@ -90,7 +90,7 @@ namespace Mono.TextEditor
public DocumentLine GetLineByOffset (int offset)
{
var lineNumber = OffsetToLineNumber (offset);
- return lineNumber >= 0 ? Get (lineNumber) : null;
+ return lineNumber >= 1 ? Get (lineNumber) : null;
}
public void TextReplaced (object sender, DocumentChangeEventArgs args)
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
index 68441c45cd..7f14249c79 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/TextViewMargin.cs
@@ -50,6 +50,15 @@ namespace Mono.TextEditor
internal double charWidth;
int highlightBracketOffset = -1;
+
+ public int HighlightBracketOffset {
+ get {
+ return highlightBracketOffset;
+ }
+ set {
+ highlightBracketOffset = value;
+ }
+ }
double LineHeight {
get {
@@ -137,13 +146,8 @@ namespace Mono.TextEditor
markerLayout = PangoUtil.CreateLayout (textEditor);
defaultLayout = PangoUtil.CreateLayout (textEditor);
- textEditor.Document.EndUndo += HandleEndUndo;
- textEditor.SelectionChanged += UpdateBracketHighlighting;
- textEditor.Document.Undone += HandleUndone;
- textEditor.Document.Redone += HandleUndone;
textEditor.TextArea.FocusInEvent += HandleFocusInEvent;
textEditor.TextArea.FocusOutEvent += HandleFocusOutEvent;
- Caret.PositionChanged += UpdateBracketHighlighting;
textEditor.VScroll += HandleVAdjustmentValueChanged;
}
@@ -159,17 +163,6 @@ namespace Mono.TextEditor
currentLineColor = ColorStyle.LineMarkerInactive;
}
- void HandleUndone (object sender, EventArgs e)
- {
- UpdateBracketHighlighting (this, EventArgs.Empty);
- }
-
- void HandleEndUndo (object sender, EventArgs e)
- {
- if (!textEditor.Document.IsInAtomicUndo)
- UpdateBracketHighlighting (this, EventArgs.Empty);
- }
-
void HandleTextReplaced (object sender, DocumentChangeEventArgs e)
{
RemoveCachedLine (Document.GetLineByOffset (e.Offset));
@@ -357,85 +350,6 @@ namespace Mono.TextEditor
Gdk.Cursor xtermCursor = new Gdk.Cursor (Gdk.CursorType.Xterm);
Gdk.Cursor textLinkCursor = new Gdk.Cursor (Gdk.CursorType.Hand1);
- void UpdateBracketHighlighting (object sender, EventArgs e)
- {
- HighlightCaretLine = false;
-
- if (!textEditor.Options.HighlightMatchingBracket || textEditor.IsSomethingSelected) {
- if (highlightBracketOffset >= 0) {
- textEditor.RedrawLine (Document.OffsetToLineNumber (highlightBracketOffset));
- highlightBracketOffset = -1;
- }
- return;
- }
-
- int offset = Caret.Offset - 1;
- if (Caret.Mode != CaretMode.Insert || (offset >= 0 && offset < Document.TextLength && !TextDocument.IsBracket (Document.GetCharAt (offset))))
- offset++;
- offset = System.Math.Max (0, offset);
- if (highlightBracketOffset >= 0 && (offset >= Document.TextLength || !TextDocument.IsBracket (Document.GetCharAt (offset)))) {
- int old = highlightBracketOffset;
- highlightBracketOffset = -1;
- if (old >= 0)
- textEditor.RedrawLine (Document.OffsetToLineNumber (old));
- return;
- }
- if (offset < 0)
- offset = 0;
-
- DisposeHighightBackgroundWorker ();
-
- highlightBracketWorker = new System.ComponentModel.BackgroundWorker ();
- highlightBracketWorker.WorkerSupportsCancellation = true;
- highlightBracketWorker.DoWork += HighlightBracketWorkerDoWork;
- highlightBracketWorker.RunWorkerAsync (offset);
- }
-
- void HighlightBracketWorkerDoWork (object sender, System.ComponentModel.DoWorkEventArgs e)
- {
- System.ComponentModel.BackgroundWorker worker = (System.ComponentModel.BackgroundWorker)sender;
- int offset = (int)e.Argument;
- int oldIndex = highlightBracketOffset;
- int caretOffset = Caret.Offset;
- int matchingBracket;
- matchingBracket = Document.GetMatchingBracketOffset (worker, offset);
- if (worker.CancellationPending)
- return;
- if (matchingBracket == caretOffset && offset + 1 < Document.TextLength)
- matchingBracket = Document.GetMatchingBracketOffset (worker, offset + 1);
- if (worker.CancellationPending)
- return;
- if (matchingBracket == caretOffset)
- matchingBracket = -1;
- if (matchingBracket != oldIndex) {
- int line1 = oldIndex >= 0 ? Document.OffsetToLineNumber (oldIndex) : -1;
- int line2 = matchingBracket >= 0 ? Document.OffsetToLineNumber (matchingBracket) : -1;
- //DocumentLocation matchingBracketLocation = Document.OffsetToLocation (matchingBracket);
- if (worker.CancellationPending)
- return;
- highlightBracketOffset = matchingBracket;
- Application.Invoke (delegate {
- if (textEditor.IsDisposed)
- return;
- if (line1 >= 0)
- textEditor.RedrawLine (line1);
- if (line1 != line2 && line2 >= 0)
- textEditor.RedrawLine (line2);
- });
- }
- }
-
- void DisposeHighightBackgroundWorker ()
- {
- if (highlightBracketWorker == null)
- return;
- if (highlightBracketWorker.IsBusy)
- highlightBracketWorker.CancelAsync ();
- highlightBracketWorker.DoWork -= HighlightBracketWorkerDoWork;
- highlightBracketWorker.Dispose ();
- highlightBracketWorker = null;
- }
-
static readonly string[] markerTexts = {
"<EOF>",
"\\n",
@@ -552,19 +466,12 @@ namespace Mono.TextEditor
{
CancelCodeSegmentTooltip ();
StopCaretThread ();
- DisposeHighightBackgroundWorker ();
DisposeSearchPatternWorker ();
textEditor.Document.TextReplaced -= HandleTextReplaced;
textEditor.Document.LineChanged -= TextEditorDocumentLineChanged;
- textEditor.Document.EndUndo -= HandleEndUndo;
- textEditor.Document.Undone -= HandleUndone;
- textEditor.Document.Redone -= HandleUndone;
-
- textEditor.Document.EndUndo -= UpdateBracketHighlighting;
textEditor.TextArea.FocusInEvent -= HandleFocusInEvent;
textEditor.TextArea.FocusOutEvent -= HandleFocusOutEvent;
- Caret.PositionChanged -= UpdateBracketHighlighting;
textEditor.GetTextEditorData ().SearchChanged -= HandleSearchChanged;
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
index 599ba88014..e18731ee32 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditorData.cs
@@ -382,6 +382,8 @@ namespace Mono.TextEditor
var styleStack = new Stack<ChunkStyle> ();
foreach (var chunk in mode.GetChunks (style, line, curOffset, toOffset - curOffset)) {
+ if (chunk.Length == 0)
+ continue;
var chunkStyle = style.GetChunkStyle (chunk);
bool setBold = (styleStack.Count > 0 && styleStack.Peek ().FontWeight != chunkStyle.FontWeight) ||
chunkStyle.FontWeight != FontWeight.Normal;
diff --git a/main/src/core/Mono.Texteditor/SyntaxModes/CSharpSyntaxMode.xml b/main/src/core/Mono.Texteditor/SyntaxModes/CSharpSyntaxMode.xml
index b7cea68816..4b8674d67e 100644
--- a/main/src/core/Mono.Texteditor/SyntaxModes/CSharpSyntaxMode.xml
+++ b/main/src/core/Mono.Texteditor/SyntaxModes/CSharpSyntaxMode.xml
@@ -58,6 +58,11 @@
<End>"</End>
</Span>
+ <Span color = "String" rule="InterpolatedString" stopateol = "true" escape='\"'>
+ <Begin>$"</Begin>
+ <End>"</End>
+ </Span>
+
<Span color = "String" rule="String" stopateol = "true" escape='\"'>
<Begin>"</Begin>
<End>"</End>
@@ -321,7 +326,17 @@
<Rule name = "String">
<Match color ="String(Escape)" ignorecase="True">\\(['"\\abfnrtv]|x[0-9a-fA-F]{2,4}|0\d\d)</Match>
</Rule>
-
+
+
+ <Rule name = "InterpolatedString">
+ <Match color ="String(Escape)" ignorecase="True">\\(['"\\abfnrtv]|x[0-9a-fA-F]{2,4}|0\d\d)</Match>
+
+ <Span color = "Plain Text" rule="mode:text/x-csharp" stopateol = "true">
+ <Begin color = "String">{</Begin>
+ <End color = "String">}</End>
+ </Span>
+ </Rule>
+
<Rule name = "VerbatimString">
<Match color ="String(Escape)">""</Match>
</Rule>
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
index 02c0acfda2..7c34d93a29 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs
@@ -327,6 +327,11 @@ namespace MonoDevelop.Core.Text
this.offset = segment.Offset;
this.length = segment.Length;
}
+
+ public override string ToString ()
+ {
+ return string.Format ("[AbstractSegment: Offset={0}, Length={1}]", Offset, Length);
+ }
}
@@ -372,6 +377,16 @@ namespace MonoDevelop.Core.Text
}
/// <summary>
+ /// Gets whether the offset is within the <paramref name="segment"/>.
+ /// </summary>
+ public static bool IsInside (this ISegment segment, int offset)
+ {
+ if (segment == null)
+ throw new ArgumentNullException ("segment");
+ return unchecked((uint)(offset - segment.Offset) <= (uint)segment.Length);
+ }
+
+ /// <summary>
/// Determines whether <paramref name="other"/> overlaps this span. Two spans are considered to overlap
/// if they have positions in common and neither is empty. Empty spans do not overlap with any
/// other span.
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
index 546570bdac..24431c3c32 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj
@@ -105,10 +105,10 @@
<HintPath>..\..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel" />
<Reference Include="Microsoft.CSharp" />
diff --git a/main/src/core/MonoDevelop.Core/packages.config b/main/src/core/MonoDevelop.Core/packages.config
index 6cc5b68cc1..fd54630965 100644
--- a/main/src/core/MonoDevelop.Core/packages.config
+++ b/main/src/core/MonoDevelop.Core/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
index f7bda2abb7..25a5de8e5f 100644
--- a/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
+++ b/main/src/core/MonoDevelop.Ide/ExtensionModel/MonoDevelop.Ide.addin.xml
@@ -256,6 +256,7 @@
<Extension path = "/MonoDevelop/Ide/TextEditorExtensions">
<Class id="InitialStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
<Class id="MidStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
+ <Class class = "MonoDevelop.Ide.Editor.Extension.BraceMatcherTextEditorExtension" />
<Class id="FinalStep" class = "MonoDevelop.Ide.Editor.Extension.TextEditorExtensionMarker" />
</Extension>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
index 525016a618..c90976f6cb 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchResult.cs
@@ -160,7 +160,7 @@ namespace MonoDevelop.Components.MainToolbar
return new TooltipInformation ();
}
var cancellationToken = default(CancellationToken);
- var task = type.GetSymbolAsync (TypeSystemService.GetCodeAnysisDocument (docId, cancellationToken), cancellationToken);
+ var task = type.GetSymbolAsync (TypeSystemService.GetCodeAnalysisDocument (docId, cancellationToken), cancellationToken);
var tooltipInformation = Ambience.GetTooltip (task.Result);
return tooltipInformation;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileEntry.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileEntry.cs
index a47612b712..d89665deff 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileEntry.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/FileEntry.cs
@@ -57,6 +57,6 @@ namespace MonoDevelop.Components
return null;
}
- public Gtk.FileChooserAction Action { get; set; }
+ public new Gtk.FileChooserAction Action { get; set; }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
index e93c4687d0..93d495803b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionData.cs
@@ -104,8 +104,8 @@ namespace MonoDevelop.Ide.CodeCompletion
{
int partialWordLength = window.PartialWord != null ? window.PartialWord.Length : 0;
int replaceLength = window.CodeCompletionContext.TriggerWordLength + partialWordLength - window.InitialWordLength;
- int endOffset = Math.Min (window.CodeCompletionContext.TriggerOffset + replaceLength, window.CompletionWidget.TextLength);
- var result = window.CompletionWidget.GetText (window.CodeCompletionContext.TriggerOffset, endOffset);
+ int endOffset = Math.Min (window.StartOffset + replaceLength, window.CompletionWidget.TextLength);
+ var result = window.CompletionWidget.GetText (window.StartOffset, endOffset);
return result;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
index e7726d1ea0..32dce6f16d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs
@@ -480,7 +480,7 @@ namespace MonoDevelop.Ide.CodeCompletion
try {
// first close the completion list, then insert the text.
// this is required because that's the logical event chain, otherwise things could be messed up
- CloseCompletionList ();
+ CloseCompletionList ();
/* var cdItem = (CompletionData)item;
cdItem.InsertCompletionText (this, ref ka, closeChar, keyChar, modifier);
AddWordToHistory (PartialWord, cdItem.CompletionText);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
index 655ebe98f3..616d0cdd83 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/ListWindow.cs
@@ -33,9 +33,7 @@ using MonoDevelop.Ide.Gui.Content;
using System.Linq;
using Gdk;
using Gtk;
-using MonoDevelop.Core.Text;
using MonoDevelop.Components;
-using MonoDevelop.Ide.Gui.Content;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Highlighting;
using MonoDevelop.Ide.Editor.Extension;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs
new file mode 100644
index 0000000000..20215b263e
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/AbstractCodeFormatter.cs
@@ -0,0 +1,123 @@
+//
+// CodeFormatter.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 MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Projects.Policies;
+using MonoDevelop.Core.Text;
+using MonoDevelop.Core;
+
+namespace MonoDevelop.Ide.CodeFormatting
+{
+ public abstract class AbstractCodeFormatter
+ {
+ protected abstract ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, ITextSource input, int startOffset, int endOffset);
+
+ public ITextSource Format (PolicyContainer policyParent, string mimeType, ITextSource input, int fromOffset, int toOffset)
+ {
+ if (fromOffset < 0 || fromOffset > input.Length)
+ throw new ArgumentOutOfRangeException (nameof (fromOffset), "should be >= 0 && < " + input.Length + " was:" + fromOffset);
+ if (toOffset < 0 || toOffset > input.Length)
+ throw new ArgumentOutOfRangeException (nameof (toOffset), "should be >= 0 && < " + input.Length + " was:" + toOffset);
+ try {
+ return FormatImplementation (policyParent ?? PolicyService.DefaultPolicies, mimeType, input, fromOffset, toOffset);
+ } catch (Exception e) {
+ LoggingService.LogError ("Error while formatting text.", e);
+ }
+ return input.CreateSnapshot (fromOffset, toOffset - fromOffset);
+ }
+
+ public ITextSource Format (PolicyContainer policyParent, string mimeType, ITextSource input)
+ {
+ if (input == null)
+ throw new ArgumentNullException (nameof (input));
+ return Format (policyParent ?? PolicyService.DefaultPolicies, mimeType, input, 0, input.Length);
+ }
+
+ public string FormatText (PolicyContainer policyParent, string mimeType, string input, int fromOffset, int toOffset)
+ {
+ if (input == null)
+ throw new ArgumentNullException (nameof (input));
+ if (mimeType == null)
+ throw new ArgumentNullException (nameof (mimeType));
+ return FormatImplementation (policyParent, mimeType, new StringTextSource (input), fromOffset, toOffset).Text;
+ }
+
+ public string FormatText (PolicyContainer policyParent, string mimeType, string input)
+ {
+ if (input == null)
+ throw new ArgumentNullException (nameof (input));
+ return FormatText (policyParent ?? PolicyService.DefaultPolicies, mimeType, input, 0, input.Length);
+ }
+
+ public virtual bool SupportsOnTheFlyFormatting { get { return false; } }
+
+ protected virtual void OnTheFlyFormatImplementation (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
+ {
+ throw new NotSupportedException ("On the fly formatting not supported");
+ }
+
+ public virtual void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
+ {
+ if (editor == null)
+ throw new ArgumentNullException (nameof (editor));
+ if (context == null)
+ throw new ArgumentNullException (nameof (context));
+
+ if (startOffset < 0 || startOffset > editor.Length)
+ throw new ArgumentOutOfRangeException (nameof (startOffset), "should be >= 0 && < " + editor.Length + " was:" + startOffset);
+ if (endOffset < 0 || endOffset > editor.Length)
+ throw new ArgumentOutOfRangeException (nameof (endOffset), "should be >= 0 && < " + editor.Length + " was:" + endOffset);
+
+ OnTheFlyFormatImplementation (editor, context, startOffset, endOffset);
+ }
+
+ public void OnTheFlyFormat (Document ideDocument, int startOffset, int endOffset)
+ {
+ OnTheFlyFormat (ideDocument.Editor, ideDocument, startOffset, endOffset);
+ }
+
+ public virtual bool SupportsCorrectingIndent { get { return false; } }
+
+ protected virtual void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
+ {
+ throw new NotSupportedException ("Indent correction not supported");
+ }
+
+ public void CorrectIndenting (PolicyContainer policyParent, TextEditor editor, int line)
+ {
+ if (policyParent == null)
+ throw new ArgumentNullException (nameof (policyParent));
+ if (editor == null)
+ throw new ArgumentNullException (nameof (editor));
+ if (line < 0 || line >= editor.LineCount)
+ throw new ArgumentOutOfRangeException (nameof (line), "should be >= 0 && < " + editor.LineCount + " was:" + line);
+ CorrectIndentingImplementation (policyParent, editor, line);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
index 450441cb1a..be4902a61d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs
@@ -1,4 +1,4 @@
-//
+//
// Formatter.cs
//
// Author:
@@ -29,93 +29,93 @@ using MonoDevelop.Projects.Policies;
using System.Collections.Generic;
using MonoDevelop.Core;
using MonoDevelop.Ide.Editor;
+using MonoDevelop.Core.Text;
+using MonoDevelop.Ide.Gui;
namespace MonoDevelop.Ide.CodeFormatting
{
public sealed class CodeFormatter
{
- ICodeFormatter formatter;
- IList<string> mimeTypeChain;
-
- internal CodeFormatter (IList<string> mimeTypeChain, ICodeFormatter formatter)
+ readonly AbstractCodeFormatter formatter;
+ readonly string mimeType;
+
+ public bool IsDefault {
+ get {
+ return formatter is DefaultCodeFormatter;
+ }
+ }
+
+ internal CodeFormatter (string mimeType, AbstractCodeFormatter formatter)
{
- this.mimeTypeChain = mimeTypeChain;
+ this.mimeType = mimeType;
this.formatter = formatter;
}
-
- public string FormatText (PolicyContainer policyParent, string input)
+
+ public ITextSource Format (PolicyContainer policyParent, ITextSource input, int fromOffset, int toOffset)
{
- try {
- return formatter.FormatText (policyParent ?? PolicyService.DefaultPolicies, mimeTypeChain, input);
- } catch (Exception e) {
- LoggingService.LogError ("Error while formatting text.", e);
- }
- return input;
+ return formatter.Format (policyParent, mimeType, input, fromOffset, toOffset);
+ }
+
+ public ITextSource Format (PolicyContainer policyParent, ITextSource input, ISegment segment)
+ {
+ if (segment == null)
+ throw new ArgumentNullException (nameof (segment));
+ return formatter.Format (policyParent, mimeType, input, segment.Offset, segment.EndOffset);
+ }
+
+ public ITextSource Format (PolicyContainer policyParent, ITextSource input)
+ {
+ return formatter.Format (policyParent, mimeType, input);
}
-
- /// <summary>Formats a subrange of the input text.</summary>
- /// <returns>The formatted text of the range.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException">When the offsets are out of bounds.</exception>
+
public string FormatText (PolicyContainer policyParent, string input, int fromOffset, int toOffset)
{
- if (fromOffset < 0 || fromOffset > input.Length)
- throw new ArgumentOutOfRangeException ("fromOffset", "should be >= 0 && < " + input.Length + " was:" + fromOffset);
- if (toOffset < 0 || toOffset > input.Length)
- throw new ArgumentOutOfRangeException ("fromOffset", "should be >= 0 && < " + input.Length + " was:" + toOffset);
- try {
- return formatter.FormatText (policyParent ?? PolicyService.DefaultPolicies, mimeTypeChain, input, fromOffset, toOffset);
- } catch (Exception e) {
- LoggingService.LogError ("Error while formatting text.", e);
- }
- return input.Substring (fromOffset, toOffset - fromOffset);
+ return formatter.FormatText (policyParent, mimeType, input, fromOffset, toOffset);
}
-
- public bool SupportsOnTheFlyFormatting {
- get {
- var adv = formatter as IAdvancedCodeFormatter;
- return adv != null && adv.SupportsOnTheFlyFormatting;
- }
+
+ public string FormatText (PolicyContainer policyParent, string input, ISegment segment)
+ {
+ if (segment == null)
+ throw new ArgumentNullException (nameof (segment));
+ return formatter.FormatText (policyParent, mimeType, input, segment.Offset, segment.EndOffset);
}
-
- public bool SupportsCorrectingIndent {
- get {
- var adv = formatter as IAdvancedCodeFormatter;
- return adv != null && adv.SupportsCorrectingIndent;
- }
+
+ public string FormatText (PolicyContainer policyParent, string input)
+ {
+ return formatter.FormatText (policyParent, mimeType, input);
}
-
- public bool IsDefault {
- get {
- return formatter is DefaultCodeFormatter;
- }
+
+ public bool SupportsOnTheFlyFormatting { get { return formatter.SupportsOnTheFlyFormatting; } }
+
+ public void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
+ {
+ formatter.OnTheFlyFormat (editor, context, startOffset, endOffset);
}
-
- /// <summary>
- /// Formats a text document directly with insert/remove operations.
- /// </summary>
- public void OnTheFlyFormat (TextEditor editor, DocumentContext documentContext, int startOffset, int endOffset)
+
+ public void OnTheFlyFormat (TextEditor editor, DocumentContext context, ISegment segment)
{
- var adv = formatter as IAdvancedCodeFormatter;
- if (adv == null || !adv.SupportsOnTheFlyFormatting)
- throw new InvalidOperationException ("On the fly formatting not supported");
-
- adv.OnTheFlyFormat (editor, documentContext, startOffset, endOffset);
+ if (segment == null)
+ throw new ArgumentNullException (nameof (segment));
+ formatter.OnTheFlyFormat (editor, context, segment.Offset, segment.EndOffset);
}
- /// <summary>
- /// Formats a text document directly with insert/remove operations.
- /// </summary>
- public void OnTheFlyFormat (MonoDevelop.Ide.Gui.Document doc, int startOffset, int endOffset)
+ public void OnTheFlyFormat (Document ideDocument, int startOffset, int endOffset)
+ {
+ formatter.OnTheFlyFormat (ideDocument, startOffset, endOffset);
+ }
+
+ public bool SupportsCorrectingIndent { get { return formatter.SupportsCorrectingIndent; } }
+
+ public void CorrectIndenting (PolicyContainer policyParent, TextEditor editor, int line)
{
- OnTheFlyFormat (doc.Editor, doc, startOffset, endOffset);
+ formatter.CorrectIndenting (policyParent, editor, line);
}
- public void CorrectIndenting (PolicyContainer policyParent, TextEditor data, int line)
+ public void CorrectIndenting (PolicyContainer policyParent, TextEditor editor, IDocumentLine line)
{
- var adv = formatter as IAdvancedCodeFormatter;
- if (adv == null || !adv.SupportsCorrectingIndent)
- throw new InvalidOperationException ("Indent correction not supported");
- adv.CorrectIndenting (policyParent ?? PolicyService.DefaultPolicies, mimeTypeChain, data, line);
+ if (line == null)
+ throw new ArgumentNullException (nameof (line));
+ formatter.CorrectIndenting (policyParent, editor, line.LineNumber);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
index a5e22d90c7..53e1b1e5c1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterExtensionNode.cs
@@ -37,9 +37,9 @@ namespace MonoDevelop.Ide.CodeFormatting
get { return mimeType; }
}
- public ICodeFormatter GetFormatter ()
+ public AbstractCodeFormatter GetFormatter ()
{
- return (ICodeFormatter) this.GetInstance ();
+ return (AbstractCodeFormatter) this.GetInstance ();
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
index aa483788ef..fc44c8af3a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatterService.cs
@@ -62,11 +62,11 @@ namespace MonoDevelop.Ide.CodeFormatting
foreach (var mt in chain) {
var node = nodes.FirstOrDefault (f => f.MimeType == mt);
if (node != null)
- return new CodeFormatter (chain, node.GetFormatter ());
+ return new CodeFormatter (mimeType, node.GetFormatter ());
}
if (DesktopService.GetMimeTypeIsText (mimeType))
- return new CodeFormatter (chain, new DefaultCodeFormatter ());
+ return new CodeFormatter (mimeType, new DefaultCodeFormatter ());
return null;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
index 2e9509738d..c4ce152ab1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/DefaultCodeFormatter.cs
@@ -32,23 +32,22 @@ using MonoDevelop.Projects;
using MonoDevelop.Projects.Text;
using MonoDevelop.Projects.Policies;
using MonoDevelop.Ide;
+using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.CodeFormatting
{
- public class DefaultCodeFormatter : AbstractCodeFormatter
+ class DefaultCodeFormatter : AbstractCodeFormatter
{
static int GetNextTabstop (int currentColumn, int tabSize)
{
int result = currentColumn - 1 + tabSize;
return 1 + (result / tabSize) * tabSize;
}
-
- public override string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- string input, int startOffset, int endOffset)
+
+ protected override ITextSource FormatImplementation (PolicyContainer policyParent, string mimeType, ITextSource input, int startOffset, int endOffset)
{
- var currentPolicy = policyParent.Get<TextStylePolicy> (mimeTypeChain);
+ var currentPolicy = policyParent.Get<TextStylePolicy> (mimeType);
- input = input ?? "";
int line = 0, col = 0;
string eolMarker = currentPolicy.GetEolMarker ();
var result = new StringBuilder ();
@@ -79,7 +78,8 @@ namespace MonoDevelop.Ide.CodeFormatting
break;
}
}
- return result.ToString ();
+
+ return new StringTextSource (result.ToString (), input.Encoding, input.UseBOM);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/IAdvancedCodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/IAdvancedCodeFormatter.cs
deleted file mode 100644
index 42e9cebec8..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/IAdvancedCodeFormatter.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// IPrettyPrinter.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 MonoDevelop.Projects.Policies;
-using MonoDevelop.Ide.Editor;
-using MonoDevelop.Ide.Gui;
-
-namespace MonoDevelop.Ide.CodeFormatting
-{
- public interface IAdvancedCodeFormatter : ICodeFormatter
- {
- bool SupportsOnTheFlyFormatting { get; }
- bool SupportsCorrectingIndent { get; }
-
- void CorrectIndenting (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, TextEditor textEditorData, int line);
-
- void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset);
- }
-
- public static class AdvancedCodeFormatterExtensions
- {
- public static void OnTheFlyFormat (this IAdvancedCodeFormatter formatter, Document document, int startOffset, int endOffset)
- {
- if (formatter == null)
- throw new ArgumentNullException ("formatter");
- formatter.OnTheFlyFormat (document.Editor, document, startOffset, endOffset);
- }
-
-
- }
-
- public abstract class AbstractAdvancedFormatter : AbstractCodeFormatter, IAdvancedCodeFormatter
- {
- public virtual bool SupportsOnTheFlyFormatting { get { return false; } }
- public virtual bool SupportsCorrectingIndent { get { return false; } }
-
- public virtual void OnTheFlyFormat (TextEditor editor, DocumentContext context, int startOffset, int endOffset)
- {
- throw new NotSupportedException ();
- }
-
- public void OnTheFlyFormat (Document doc, int startOffset, int endOffset)
- {
- OnTheFlyFormat (doc.Editor, doc, startOffset, endOffset);
- }
-
- public virtual void CorrectIndenting (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- TextEditor data, int line)
- {
- throw new NotSupportedException ();
- }
- }
-}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCodon.cs
index 488387a28d..c4c6f23f42 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCodon.cs
@@ -32,7 +32,7 @@ using System.IO;
namespace MonoDevelop.Ide.CodeTemplates
{
[ExtensionNode (Description="A template for color and syntax shemes.")]
- public class CodeTemplateCodon : ExtensionNode
+ class CodeTemplateCodon : ExtensionNode
{
[NodeAttribute("resource", "Name of the resource where the template is stored.")]
string resource;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
index 6edaa60d6e..f3c254cc0c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs
@@ -38,7 +38,7 @@ namespace MonoDevelop.Ide.CodeTemplates
void InsertTemplate (CodeTemplate template, TextEditor editor, DocumentContext context);
}
- public class CodeTemplateCompletionData : CompletionData
+ class CodeTemplateCompletionData : CompletionData
{
readonly TextEditorExtension doc;
readonly CodeTemplate template;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateListDataProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateListDataProvider.cs
index 30a94e91ef..79e29a55cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateListDataProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateListDataProvider.cs
@@ -28,7 +28,7 @@ using System.Collections.Generic;
namespace MonoDevelop.Ide.CodeTemplates
{
- public class CodeTemplateListDataProvider : IListDataProvider<string>
+ class CodeTemplateListDataProvider : IListDataProvider<string>
{
List<CodeTemplateVariableValue> itemList;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/EditTemplateDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/EditTemplateDialog.cs
index eedfa7e058..b320e3a353 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/EditTemplateDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/EditTemplateDialog.cs
@@ -38,9 +38,7 @@ using MonoDevelop.Core.Text;
namespace MonoDevelop.Ide.CodeTemplates
{
-
-
- public partial class EditTemplateDialog : Gtk.Dialog
+ partial class EditTemplateDialog : Gtk.Dialog
{
CodeTemplate template;
TextEditor textEditor = TextEditorFactory.CreateNewEditor ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs
new file mode 100644
index 0000000000..493181bbd6
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/AbstractBraceMatcher.cs
@@ -0,0 +1,63 @@
+//
+// AbstractBraceMatcher.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System.Threading;
+using System.Threading.Tasks;
+using MonoDevelop.Ide.Editor;
+using MonoDevelop.Ide.Editor.Util;
+using MonoDevelop.Core.Text;
+using System;
+
+namespace MonoDevelop.Ide.Editor
+{
+ abstract class AbstractBraceMatcher
+ {
+ public abstract bool CanHandle (TextEditor editor);
+ public abstract Task<BraceMatchingResult?> GetMatchingBracesAsync(IReadonlyTextDocument editor, DocumentContext context, int offset, CancellationToken cancellationToken = default(CancellationToken));
+ }
+
+ sealed class DefaultBraceMatcher : AbstractBraceMatcher
+ {
+ public override bool CanHandle (TextEditor editor)
+ {
+ return true;
+ }
+
+ public override Task<BraceMatchingResult?> GetMatchingBracesAsync (IReadonlyTextDocument editor, DocumentContext context, int offset, CancellationToken cancellationToken)
+ {
+ BraceMatchingResult? result = null;
+
+ var matching = SimpleBracketMatcher.GetMatchingBracketOffset (editor, offset, cancellationToken);
+ if (matching >= 0) {
+ int start = Math.Min (offset, matching);
+ int end = Math.Max (offset, matching);
+ result = new BraceMatchingResult (new TextSegment (start, 1), new TextSegment (end, 1), offset == start);
+ }
+
+ return Task.FromResult (result);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs
new file mode 100644
index 0000000000..aefdbf0508
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatcherTextEditorExtension.cs
@@ -0,0 +1,92 @@
+//
+// BraceMatcherTextEditorExtension.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+using Gtk;
+
+namespace MonoDevelop.Ide.Editor.Extension
+{
+ sealed class BraceMatcherTextEditorExtension : TextEditorExtension
+ {
+ CancellationTokenSource src = new CancellationTokenSource();
+
+ AbstractBraceMatcher GetBraceMatcher ()
+ {
+ return new DefaultBraceMatcher ();
+ }
+
+ protected override void Initialize ()
+ {
+ if ((Editor.TextEditorType & TextEditorType.Invisible) != 0)
+ return;
+ Editor.CaretPositionChanged += Editor_CaretPositionChanged;
+ }
+
+ public override void Dispose ()
+ {
+ src.Cancel ();
+ Editor.CaretPositionChanged -= Editor_CaretPositionChanged;
+ }
+
+ void Editor_CaretPositionChanged (object sender, EventArgs e)
+ {
+ Editor.UpdateBraceMatchingResult (null);
+ src.Cancel ();
+ src = new CancellationTokenSource ();
+ var token = src.Token;
+ var matcher = GetBraceMatcher ();
+ if (matcher == null)
+ return;
+ var caretOffset = Editor.CaretOffset;
+ var ctx = DocumentContext;
+ var snapshot = Editor.CreateDocumentSnapshot ();
+ Task.Run (async delegate() {
+ BraceMatchingResult? result;
+ try {
+ result = await matcher.GetMatchingBracesAsync (snapshot, ctx, caretOffset, token).ConfigureAwait (false);
+ if (result == null && caretOffset > 0)
+ result = await matcher.GetMatchingBracesAsync (snapshot, ctx, caretOffset - 1, token).ConfigureAwait (false);
+ if (result == null)
+ return;
+ } catch (OperationCanceledException) {
+ return;
+ } catch (AggregateException ae) {
+ ae.Flatten ().Handle (ex => ex is OperationCanceledException);
+ return;
+ }
+ if (token.IsCancellationRequested)
+ return;
+ Application.Invoke (delegate {
+ if (token.IsCancellationRequested)
+ return;
+ Editor.UpdateBraceMatchingResult (result);
+ });
+ });
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs
new file mode 100644
index 0000000000..e1eedcba12
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/BraceMatchingResult.cs
@@ -0,0 +1,51 @@
+//
+// BraceMatchingResult.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core.Text;
+
+namespace MonoDevelop.Ide.Editor
+{
+ struct BraceMatchingResult
+ {
+ public ISegment LeftSegment { get; }
+
+ public ISegment RightSegment { get; }
+
+ public bool IsCaretInLeft { get; }
+
+ public BraceMatchingResult (ISegment leftSegment, ISegment rightSegment, bool isCaretInLeft) : this ()
+ {
+ if (leftSegment == null)
+ throw new ArgumentNullException (nameof (leftSegment));
+ if (rightSegment == null)
+ throw new ArgumentNullException (nameof (rightSegment));
+ LeftSegment = leftSegment;
+ RightSegment = rightSegment;
+ IsCaretInLeft = isCaretInLeft;
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
index b8927af746..02495c7b98 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Extension/CompletionTextEditorExtension.cs
@@ -42,14 +42,21 @@ namespace MonoDevelop.Ide.Editor.Extension
{
public class CompletionTextEditorExtension : TextEditorExtension
{
- protected CodeCompletionContext currentCompletionContext;
+ internal protected CodeCompletionContext CurrentCompletionContext {
+ get;
+ set;
+ }
bool autoHideCompletionWindow = true, autoHideParameterWindow = true;
+ ICompletionWidget completionWidget;
internal virtual ICompletionWidget CompletionWidget
{
- get;
- set;
+ get { return completionWidget; }
+ set
+ {
+ completionWidget = value;
+ }
}
@@ -63,16 +70,16 @@ namespace MonoDevelop.Ide.Editor.Extension
public void ShowCompletion (ICompletionDataList completionList)
{
- currentCompletionContext = CompletionWidget.CreateCodeCompletionContext (Editor.CaretOffset);
+ CurrentCompletionContext = CompletionWidget.CreateCodeCompletionContext (Editor.CaretOffset);
int cpos, wlen;
if (!GetCompletionCommandOffset (out cpos, out wlen)) {
cpos = Editor.CaretOffset;
wlen = 0;
}
- currentCompletionContext.TriggerOffset = cpos;
- currentCompletionContext.TriggerWordLength = wlen;
+ CurrentCompletionContext.TriggerOffset = cpos;
+ CurrentCompletionContext.TriggerWordLength = wlen;
- CompletionWindowManager.ShowWindow (this, '\0', completionList, CompletionWidget, currentCompletionContext);
+ CompletionWindowManager.ShowWindow (this, '\0', completionList, CompletionWidget, CurrentCompletionContext);
}
CancellationTokenSource completionTokenSrc = new CancellationTokenSource ();
CancellationTokenSource parameterHintingSrc = new CancellationTokenSource ();
@@ -81,7 +88,7 @@ namespace MonoDevelop.Ide.Editor.Extension
public override bool KeyPress (KeyDescriptor descriptor)
{
bool res;
- if (currentCompletionContext != null) {
+ if (CurrentCompletionContext != null) {
if (CompletionWindowManager.PreProcessKeyEvent (descriptor)) {
CompletionWindowManager.PostProcessKeyEvent (descriptor);
autoHideCompletionWindow = true;
@@ -123,13 +130,13 @@ namespace MonoDevelop.Ide.Editor.Extension
// Handle code completion
if (descriptor.KeyChar != '\0' && CompletionWidget != null && !CompletionWindowManager.IsVisible) {
- currentCompletionContext = CompletionWidget.CurrentCodeCompletionContext;
+ CurrentCompletionContext = CompletionWidget.CurrentCodeCompletionContext;
completionTokenSrc.Cancel ();
completionTokenSrc = new CancellationTokenSource ();
var token = completionTokenSrc.Token;
var caretOffset = Editor.CaretOffset;
try {
- var task = HandleCodeCompletionAsync (currentCompletionContext, descriptor.KeyChar, token);
+ var task = HandleCodeCompletionAsync (CurrentCompletionContext, descriptor.KeyChar, token);
if (task != null) {
var result = task.Result;
if (result != null) {
@@ -137,22 +144,21 @@ namespace MonoDevelop.Ide.Editor.Extension
if (triggerWordLength > 0 && (triggerWordLength < caretOffset
|| (triggerWordLength == 1 && caretOffset == 1))) {
- currentCompletionContext = CompletionWidget.CreateCodeCompletionContext (caretOffset - triggerWordLength);
- currentCompletionContext.TriggerWordLength = triggerWordLength;
+ CurrentCompletionContext = CompletionWidget.CreateCodeCompletionContext (caretOffset - triggerWordLength);
+ CurrentCompletionContext.TriggerWordLength = triggerWordLength;
}
-
- if (!CompletionWindowManager.ShowWindow (this, descriptor.KeyChar, result, CompletionWidget, currentCompletionContext))
- currentCompletionContext = null;
+ if (!CompletionWindowManager.ShowWindow (this, descriptor.KeyChar, result, CompletionWidget, CurrentCompletionContext))
+ CurrentCompletionContext = null;
} else {
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
} else {
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
} catch (TaskCanceledException) {
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
} catch (AggregateException) {
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
}
@@ -183,17 +189,17 @@ namespace MonoDevelop.Ide.Editor.Extension
{
if (Editor.SelectionMode == SelectionMode.Block)
return;
- if (CompletionWidget != null && currentCompletionContext == null) {
- currentCompletionContext = CompletionWidget.CurrentCodeCompletionContext;
+ if (CompletionWidget != null && CurrentCompletionContext == null) {
+ CurrentCompletionContext = CompletionWidget.CurrentCodeCompletionContext;
if (triggerWordLength > 0 && triggerWordLength < Editor.CaretOffset) {
- currentCompletionContext =
+ CurrentCompletionContext =
CompletionWidget.CreateCodeCompletionContext (Editor.CaretOffset - triggerWordLength);
- currentCompletionContext.TriggerWordLength = triggerWordLength;
+ CurrentCompletionContext.TriggerWordLength = triggerWordLength;
}
if (completionList != null)
- CompletionWindowManager.ShowWindow (this, keyChar, completionList, CompletionWidget, currentCompletionContext);
+ CompletionWindowManager.ShowWindow (this, keyChar, completionList, CompletionWidget, CurrentCompletionContext);
else
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
autoHideCompletionWindow = autoHideParameterWindow = true;
}
@@ -204,12 +210,13 @@ namespace MonoDevelop.Ide.Editor.Extension
}
- protected void OnCompletionContextChanged (object o, EventArgs a)
+ internal protected virtual void OnCompletionContextChanged (object o, EventArgs a)
{
if (!IsActiveExtension ())
return;
- if (autoHideCompletionWindow)
+ if (autoHideCompletionWindow) {
CompletionWindowManager.HideWindow ();
+ }
if (autoHideParameterWindow)
ParameterInformationWindowManager.HideWindow (this, CompletionWidget);
ParameterInformationWindowManager.UpdateCursorPosition (this, CompletionWidget);
@@ -248,13 +255,13 @@ namespace MonoDevelop.Ide.Editor.Extension
cpos = Editor.CaretOffset;
wlen = 0;
}
- currentCompletionContext = CompletionWidget.CreateCodeCompletionContext (cpos);
- currentCompletionContext.TriggerWordLength = wlen;
- completionList = CodeCompletionCommand (currentCompletionContext);
+ CurrentCompletionContext = CompletionWidget.CreateCodeCompletionContext (cpos);
+ CurrentCompletionContext.TriggerWordLength = wlen;
+ completionList = CodeCompletionCommand (CurrentCompletionContext);
if (completionList != null)
- CompletionWindowManager.ShowWindow (this, (char)0, completionList, CompletionWidget, currentCompletionContext);
+ CompletionWindowManager.ShowWindow (this, (char)0, completionList, CompletionWidget, CurrentCompletionContext);
else
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
[CommandHandler(TextEditorCommands.ShowCodeTemplateWindow)]
@@ -322,7 +329,7 @@ namespace MonoDevelop.Ide.Editor.Extension
public virtual bool CanRunCompletionCommand ()
{
- return (CompletionWidget != null && currentCompletionContext == null);
+ return (CompletionWidget != null && CurrentCompletionContext == null);
}
public virtual bool CanRunParameterCompletionCommand ()
@@ -501,7 +508,7 @@ namespace MonoDevelop.Ide.Editor.Extension
{
base.Initialize ();
CompletionWindowManager.WindowClosed += HandleWindowClosed;
- CompletionWidget = DocumentContext.GetContent <ICompletionWidget> ();
+ CompletionWidget = DocumentContext.GetContent <ICompletionWidget> () ?? CompletionWidget;
if (CompletionWidget != null)
CompletionWidget.CompletionContextChanged += OnCompletionContextChanged;
Editor.CaretPositionChanged += HandlePositionChanged;
@@ -515,7 +522,7 @@ namespace MonoDevelop.Ide.Editor.Extension
Initialize ();
}
- void HandlePositionChanged (object sender, EventArgs e)
+ internal protected virtual void HandlePositionChanged (object sender, EventArgs e)
{
if (!IsActiveExtension ())
return;
@@ -524,26 +531,32 @@ namespace MonoDevelop.Ide.Editor.Extension
void HandleWindowClosed (object sender, EventArgs e)
{
- currentCompletionContext = null;
+ CurrentCompletionContext = null;
}
bool disposed = false;
public override void Dispose ()
{
- if (!disposed) {
- CompletionWindowManager.HideWindow ();
- ParameterInformationWindowManager.HideWindow (this, CompletionWidget);
+ if (!disposed)
+ {
+ CompletionWindowManager.HideWindow();
+ ParameterInformationWindowManager.HideWindow(this, CompletionWidget);
+
+ disposed = true;
+ // if (document.Editor.Parent != null)
+ // document.Editor.Parent.TextArea.FocusOutEvent -= HandleFocusOutEvent;
+ // document.Editor.Paste -= HandlePaste;
+ Deinitialize();
+ }
+ base.Dispose ();
+ }
- disposed = true;
-// if (document.Editor.Parent != null)
-// document.Editor.Parent.TextArea.FocusOutEvent -= HandleFocusOutEvent;
-// document.Editor.Paste -= HandlePaste;
- Editor.CaretPositionChanged -= HandlePositionChanged;
- CompletionWindowManager.WindowClosed -= HandleWindowClosed;
- if (CompletionWidget != null)
- CompletionWidget.CompletionContextChanged -= OnCompletionContextChanged;
- }
- base.Dispose ();
+ internal void Deinitialize ()
+ {
+ Editor.CaretPositionChanged -= HandlePositionChanged;
+ CompletionWindowManager.WindowClosed -= HandleWindowClosed;
+ if (CompletionWidget != null)
+ CompletionWidget.CompletionContextChanged -= OnCompletionContextChanged;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/AmbientColor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/AmbientColor.cs
index b65a66a3de..39f683371d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/AmbientColor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/AmbientColor.cs
@@ -110,7 +110,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return new HslColor (0, 0, 0);
}
- public static AmbientColor Create (XElement element, Dictionary<string, HslColor> palette)
+ internal static AmbientColor Create (XElement element, Dictionary<string, HslColor> palette)
{
var result = new AmbientColor ();
foreach (var node in element.DescendantNodes ()) {
@@ -148,9 +148,8 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return (Colors != null ? Colors.GetHashCode () : 0) ^ (Name != null ? Name.GetHashCode () : 0);
}
}
-
- public static AmbientColor Import (Dictionary<string, ColorScheme.VSSettingColor> colors, string vsSetting)
+ internal static AmbientColor Import (Dictionary<string, ColorScheme.VSSettingColor> colors, string vsSetting)
{
var result = new AmbientColor ();
var attrs = vsSetting.Split (',');
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ChunkStyle.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ChunkStyle.cs
index bed02ad91d..e289421edd 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ChunkStyle.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ChunkStyle.cs
@@ -44,6 +44,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+
public bool TransparentBackground {
get {
return Background.Alpha == 0.0;
@@ -54,20 +55,6 @@ namespace MonoDevelop.Ide.Editor.Highlighting
public Xwt.Drawing.FontStyle FontStyle { get; set; }
- [Obsolete("Will be removed - use FontWeight")]
- public bool Bold {
- get {
- return FontWeight == Xwt.Drawing.FontWeight.Bold;
- }
- }
-
- [Obsolete("Will be removed - use FontStyle")]
- public bool Italic {
- get {
- return FontStyle == Xwt.Drawing.FontStyle.Italic;
- }
- }
-
public bool Underline {
get; set;
}
@@ -108,7 +95,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public static ChunkStyle Create (XElement element, Dictionary<string, HslColor> palette)
+ internal static ChunkStyle Create (XElement element, Dictionary<string, HslColor> palette)
{
var result = new ChunkStyle ();
@@ -146,12 +133,12 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return result;
}
- public Gdk.GC CreateBgGC (Gdk.Drawable drawable)
+ internal Gdk.GC CreateBgGC (Gdk.Drawable drawable)
{
return new Gdk.GC (drawable) { RgbBgColor = (HslColor)Foreground, RgbFgColor = (HslColor)Background };
}
- public Gdk.GC CreateFgGC (Gdk.Drawable drawable)
+ internal Gdk.GC CreateFgGC (Gdk.Drawable drawable)
{
return new Gdk.GC (drawable) { RgbBgColor = (HslColor)Background, RgbFgColor = (HslColor)Foreground };
}
@@ -161,7 +148,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return string.Format ("[ChunkStyle: Name={0}, CairoColor={1}, CairoBackgroundColor={2}, FontWeight={3}, FontStyle={4}]", Name, Foreground, Background, FontWeight, FontStyle);
}
- public static ChunkStyle Import (string name, ColorScheme.VSSettingColor vsc)
+ internal static ChunkStyle Import (string name, ColorScheme.VSSettingColor vsc)
{
var textColor = new ChunkStyle ();
textColor.Name = name;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorDescriptionAttribute.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorDescriptionAttribute.cs
index d69e2013c9..7b600bfe60 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorDescriptionAttribute.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorDescriptionAttribute.cs
@@ -28,7 +28,7 @@ using System;
namespace MonoDevelop.Ide.Editor.Highlighting
{
- public sealed class ColorDescriptionAttribute : Attribute
+ sealed class ColorDescriptionAttribute : Attribute
{
public string Name { get; private set; }
public string Description { get; set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
index 6714d9abe9..09e5d84779 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColorScheme.cs
@@ -610,7 +610,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
#endregion
- public class PropertyDecsription
+ internal class PropertyDecsription
{
public readonly PropertyInfo Info;
public readonly ColorDescriptionAttribute Attribute;
@@ -624,7 +624,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
static Dictionary<string, PropertyDecsription> textColors = new Dictionary<string, PropertyDecsription> ();
- public static IEnumerable<PropertyDecsription> TextColors {
+ internal static IEnumerable<PropertyDecsription> TextColors {
get {
return textColors.Values;
}
@@ -632,7 +632,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
static Dictionary<string, PropertyDecsription> ambientColors = new Dictionary<string, PropertyDecsription> ();
- public static IEnumerable<PropertyDecsription> AmbientColors {
+ internal static IEnumerable<PropertyDecsription> AmbientColors {
get {
return ambientColors.Values;
}
@@ -676,7 +676,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return HslColor.Parse (value);
}
- public static HslColor ParsePaletteColor (Dictionary<string, HslColor> palette, string value)
+ internal static HslColor ParsePaletteColor (Dictionary<string, HslColor> palette, string value)
{
HslColor result;
if (palette.TryGetValue (value, out result))
@@ -684,7 +684,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return ParseColor (value);
}
- public ChunkStyle GetChunkStyle (string color)
+ internal ChunkStyle GetChunkStyle (string color)
{
if (color == null)
return GetChunkStyle ("Plain Text");
@@ -704,7 +704,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
color.Info.SetValue (this, color.Info.GetValue (baseScheme, null), null);
}
- public static ColorScheme LoadFrom (Stream stream)
+ internal static ColorScheme LoadFrom (Stream stream)
{
var result = new ColorScheme ();
var reader = System.Runtime.Serialization.Json.JsonReaderWriterFactory.CreateJsonReader (stream, new System.Xml.XmlDictionaryReaderQuotas ());
@@ -791,8 +791,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return color.ToMarkup ();
}
-
- public void Save (string fileName)
+ internal void Save (string fileName)
{
using (var writer = new StreamWriter (fileName)) {
writer.WriteLine ("{");
@@ -895,7 +894,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return HslColor.Parse (color);
}
- public class VSSettingColor
+ internal class VSSettingColor
{
public string Name { get; private set; }
public string Foreground { get; private set; }
@@ -913,7 +912,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public static HslColor AlphaBlend (HslColor fore, HslColor back, double alpha)
+ internal static HslColor AlphaBlend (HslColor fore, HslColor back, double alpha)
{
var fc = (Cairo.Color)fore;
var bc = (Cairo.Color)back;
@@ -923,7 +922,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
(1.0 - alpha) * bc.B + alpha * fc.B);
}
- public static ColorScheme Import (string fileName, Stream stream)
+ internal static ColorScheme Import (string fileName, Stream stream)
{
var result = new ColorScheme ();
result.Name = Path.GetFileNameWithoutExtension (fileName);
@@ -1019,12 +1018,11 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return result;
}
- public HslColor GetForeground (ChunkStyle chunkStyle)
+ internal HslColor GetForeground (ChunkStyle chunkStyle)
{
if (chunkStyle.TransparentForeground)
return PlainText.Foreground;
return chunkStyle.Foreground;
}
-
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
index 9f67c54602..a5beeea92b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/ColoredSegment.cs
@@ -37,7 +37,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
{
readonly string colorStyleKey;
- //// <summary>
+ /// <summary>
/// Gets the color style. The style is looked up in the current color scheme.
/// </summary>
public string ColorStyleKey {
@@ -55,5 +55,10 @@ namespace MonoDevelop.Ide.Editor.Highlighting
{
this.colorStyleKey = colorStyleKey;
}
+
+ public override string ToString ()
+ {
+ return string.Format ("[ColoredSegment: Offset={0}, Length={1},ColorStyleKey={2}]", Offset, Length, ColorStyleKey);
+ }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/IStreamProvider.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/IStreamProvider.cs
index 97126a1219..086402fe69 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/IStreamProvider.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/IStreamProvider.cs
@@ -36,15 +36,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
Stream Open ();
}
- [Obsolete("Do not use this anymore. Use ResourceStreamProvider.")]
- public class ResourceXmlProvider : ResourceStreamProvider
- {
- public ResourceXmlProvider (Assembly assembly, string manifestResourceName) : base(assembly, manifestResourceName)
- {
-
- }
- }
- public class ResourceStreamProvider : IStreamProvider
+ class ResourceStreamProvider : IStreamProvider
{
Assembly assembly;
string manifestResourceName;
@@ -73,7 +65,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public class UrlStreamProvider : IStreamProvider
+ class UrlStreamProvider : IStreamProvider
{
string url;
@@ -93,5 +85,4 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return File.OpenRead (url);
}
}
-
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxModeService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxModeService.cs
index 539bcc5c6a..7e5a14aba5 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxModeService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/SyntaxModeService.cs
@@ -59,6 +59,12 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
+ public static ColorScheme DefaultColorStyle {
+ get {
+ return GetColorStyle ("Default");
+ }
+ }
+
public static ColorScheme GetColorStyle (string name)
{
if (styles.ContainsKey (name))
@@ -70,7 +76,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
return GetColorStyle ("Default");
}
- public static IStreamProvider GetProvider (ColorScheme style)
+ static IStreamProvider GetProvider (ColorScheme style)
{
if (styleLookup.ContainsKey (style.Name))
return styleLookup[style.Name];
@@ -104,7 +110,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
- public static void Remove (ColorScheme style)
+ static void Remove (ColorScheme style)
{
if (styleLookup.ContainsKey (style.Name))
styleLookup.Remove (style.Name);
@@ -118,14 +124,14 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
- public static List<ValidationEventArgs> ValidateStyleFile (string fileName)
+ static List<ValidationEventArgs> ValidateStyleFile (string fileName)
{
List<ValidationEventArgs> result = new List<ValidationEventArgs> ();
return result;
}
- public static void LoadStylesAndModes (string path)
+ internal static void LoadStylesAndModes (string path)
{
foreach (string file in Directory.GetFiles (path)) {
if (file.EndsWith (".json", StringComparison.Ordinal)) {
@@ -146,7 +152,7 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public static void LoadStylesAndModes (Assembly assembly)
+ static void LoadStylesAndModes (Assembly assembly)
{
foreach (string resource in assembly.GetManifestResourceNames ()) {
if (resource.EndsWith ("Style.json", StringComparison.Ordinal)) {
@@ -176,12 +182,12 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public static void AddStyle (ColorScheme style)
+ internal static void AddStyle (ColorScheme style)
{
styles [style.Name] = style;
}
- public static void AddStyle (IStreamProvider provider)
+ internal static void AddStyle (IStreamProvider provider)
{
using (var stream = provider.Open ()) {
string styleName = ScanStyle (stream);
@@ -189,20 +195,14 @@ namespace MonoDevelop.Ide.Editor.Highlighting
}
}
- public static void RemoveStyle (IStreamProvider provider)
+ internal static void RemoveStyle (IStreamProvider provider)
{
using (var stream = provider.Open ()) {
string styleName = ScanStyle (stream);
styleLookup.Remove (styleName);
}
}
-
- public static ColorScheme DefaultColorStyle {
- get {
- return GetColorStyle ("Default");
- }
- }
-
+
static SyntaxModeService ()
{
var textEditorAssembly = Assembly.Load ("Mono.TextEditor");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
index ddf704e991..859686c49b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Highlighting/TemplateExtensionNodeLoader.cs
@@ -30,7 +30,7 @@ using MonoDevelop.Ide.Editor.Highlighting;
namespace MonoDevelop.Ide.Editor.Highlighting
{
- public static class TemplateExtensionNodeLoader
+ static class TemplateExtensionNodeLoader
{
static bool initialized = false;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
index b7cc92bb45..2ac82d045a 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor.Util/SimpleBracketMatcher.cs
@@ -26,16 +26,16 @@
using System;
using System.Collections.Generic;
using MonoDevelop.Ide.Editor.Highlighting;
+using System.Threading;
namespace MonoDevelop.Ide.Editor.Util
{
- public static class SimpleBracketMatcher
+ static class SimpleBracketMatcher
{
const string openBrackets = "([{<";
const string closingBrackets = ")]}>";
-
- public static int GetMatchingBracketOffset (IReadonlyTextDocument document, int offset)
+ public static int GetMatchingBracketOffset (IReadonlyTextDocument document, int offset, CancellationToken cancellationToken = default(CancellationToken))
{
if (offset < 0 || offset >= document.Length)
return -1;
@@ -43,11 +43,11 @@ namespace MonoDevelop.Ide.Editor.Util
int bracket = openBrackets.IndexOf (ch);
int result;
if (bracket >= 0) {
- result = SearchMatchingBracketForward (document, offset + 1, closingBrackets [bracket], openBrackets [bracket]);
+ result = SearchMatchingBracketForward (document, offset + 1, closingBrackets [bracket], openBrackets [bracket], cancellationToken);
} else {
bracket = closingBrackets.IndexOf (ch);
if (bracket >= 0) {
- result = SearchMatchingBracketBackward (document, offset - 1, openBrackets [bracket], closingBrackets [bracket]);
+ result = SearchMatchingBracketBackward (document, offset - 1, openBrackets [bracket], closingBrackets [bracket], cancellationToken);
} else {
result = -1;
}
@@ -77,7 +77,7 @@ namespace MonoDevelop.Ide.Editor.Util
return -1;
}
- static int SearchMatchingBracketForward (IReadonlyTextDocument document, int offset, char openBracket, char closingBracket)
+ static int SearchMatchingBracketForward (IReadonlyTextDocument document, int offset, char openBracket, char closingBracket, CancellationToken cancellationToken)
{
bool isInBlockComment = false;
bool isInLineComment = false;
@@ -91,6 +91,8 @@ namespace MonoDevelop.Ide.Editor.Util
var stringQuotes = GetList (document, "StringQuote");
int depth = -1;
while (offset >= 0 && offset < document.Length) {
+ if (offset % 100 == 0 && cancellationToken.IsCancellationRequested)
+ return -1;
if (curStringQuote < 0) {
// check line comments
if (!isInBlockComment && !isInLineComment)
@@ -199,7 +201,7 @@ namespace MonoDevelop.Ide.Editor.Util
return lineOffset;
}
- static int SearchMatchingBracketBackward (IReadonlyTextDocument document, int offset, char openBracket, char closingBracket)
+ static int SearchMatchingBracketBackward (IReadonlyTextDocument document, int offset, char openBracket, char closingBracket, CancellationToken cancellationToken)
{
bool isInBlockComment = false;
bool isInLineComment = false;
@@ -216,6 +218,8 @@ namespace MonoDevelop.Ide.Editor.Util
offset = GetLastSourceCodePosition (document, offset);
while (offset >= 0 && offset < document.Length) {
+ if (offset % 100 == 0 && cancellationToken.IsCancellationRequested)
+ return -1;
char ch = document.GetCharAt (offset);
// check block comments
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
index 7e95e9df8e..9e0cf1cdbf 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DocumentLocation.cs
@@ -33,10 +33,6 @@ namespace MonoDevelop.Ide.Editor
/// A line/column position.
/// Text editor lines/columns are counted started from one.
/// </summary>
- /// <remarks>
- /// The document provides the methods <see cref="Editor.IDocument.GetLocation"/> and
- /// <see cref="Editor.IDocument.GetOffset(TextLocation)"/> to convert between offsets and TextLocations.
- /// </remarks>
[Serializable]
[TypeConverter(typeof(DocumentLocationConverter))]
public struct DocumentLocation : IComparable<DocumentLocation>, IEquatable<DocumentLocation>
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
index 4b299a40ef..c1633917c1 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/InternalExtensionAPI/ITextEditorImpl.cs
@@ -240,5 +240,6 @@ namespace MonoDevelop.Ide.Editor
void AddOverlay (Control messageOverlayContent, Func<int> sizeFunc);
void RemoveOverlay (Control messageOverlayContent);
+ void UpdateBraceMatchingResult (BraceMatchingResult? result);
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
index 631132043c..a477fccf28 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedCompletionExtension.cs
@@ -98,9 +98,12 @@ namespace MonoDevelop.Ide.Editor.Projection
var projection = GetProjectionAt (offset);
if (projection != null) {
var result = projection.ProjectedEditor.GetContent<CompletionTextEditorExtension> ();
- if (result != null) {
+ if (result != null && CompletionWidget != null) {
result.CompletionWidget = new ProjectedCompletionWidget (CompletionWidget, projection);
+ if (result.CurrentCompletionContext == null)
+ result.CurrentCompletionContext = result.CompletionWidget.CurrentCodeCompletionContext;
}
+ result.Next = Next;
return result;
}
return null;
@@ -139,7 +142,7 @@ namespace MonoDevelop.Ide.Editor.Projection
string ICompletionWidget.GetText (int startOffset, int endOffset)
{
- return projection.ProjectedEditor.GetTextBetween (startOffset, endOffset);
+ return completionWidget.GetText(startOffset, endOffset);
}
char ICompletionWidget.GetChar (int offset)
@@ -149,13 +152,6 @@ namespace MonoDevelop.Ide.Editor.Projection
void ICompletionWidget.Replace (int offset, int count, string text)
{
- foreach (var seg in projection.ProjectedSegments) {
- if (seg.ContainsProjected (offset)) {
- offset = seg.FromProjectedToOriginal (offset);
- break;
- }
- }
-
completionWidget.Replace (offset, count, text);
}
@@ -219,7 +215,7 @@ namespace MonoDevelop.Ide.Editor.Projection
int ICompletionWidget.CaretOffset {
get {
- return ConvertOffset (completionWidget.CaretOffset);
+ return projection.ProjectedEditor.CaretOffset = ConvertOffset (completionWidget.CaretOffset);
}
set {
completionWidget.CaretOffset = ProjectOffset (value);
@@ -330,10 +326,13 @@ namespace MonoDevelop.Ide.Editor.Projection
public override bool KeyPress (KeyDescriptor descriptor)
{
- projections = ctx.GetPartialProjectionsAsync ().Result;
+ var task = ctx.GetPartialProjectionsAsync ();
+ if (task != null)
+ projections = task.Result;
var projectedExtension = GetCurrentExtension();
- if (projectedExtension != null)
+ if (projectedExtension != null) {
return projectedExtension.KeyPress (descriptor);
+ }
return base.KeyPress (descriptor);
}
@@ -433,6 +432,7 @@ namespace MonoDevelop.Ide.Editor.Projection
var loc = projection.ProjectedEditor.OffsetToLocation (offset);
line = loc.Line;
lineOffset = loc.Column - 1;
+ break;
}
}
}
@@ -447,5 +447,24 @@ namespace MonoDevelop.Ide.Editor.Projection
TriggerWordLength = completionContext.TriggerWordLength
};
}
+
+ internal protected override void OnCompletionContextChanged (object o, EventArgs a)
+ {
+ if (!IsActiveExtension ())
+ return;
+ var ext = GetExtensionAt (Editor.CaretOffset);
+ if (ext != null) {
+ ext.CurrentCompletionContext = ext.CompletionWidget.CurrentCodeCompletionContext;
+ }
+ }
+
+ internal protected override void HandlePositionChanged (object sender, EventArgs e)
+ {
+ if (!IsActiveExtension ())
+ return;
+ var ext = GetExtensionAt (Editor.CaretOffset);
+ if (ext != null)
+ ext.HandlePositionChanged (sender, e);
+ }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
index 4b49f137b3..ffc11c579b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedFilterCompletionTextEditorExtension.cs
@@ -68,21 +68,21 @@ namespace MonoDevelop.Ide.Editor.Projection
public override bool KeyPress (KeyDescriptor descriptor)
{
- if (IsInProjection())
+ if (!IsActiveExtension())
return Next == null || Next.KeyPress (descriptor);
return completionTextEditorExtension.KeyPress (descriptor);
}
public override bool IsValidInContext (DocumentContext context)
{
- if (IsInProjection())
+ if (!IsActiveExtension())
return false;
return completionTextEditorExtension.IsValidInContext (context);
}
public override int GetCurrentParameterIndex (int startOffset)
{
- if (IsInProjection())
+ if (!IsActiveExtension())
return -1;
return completionTextEditorExtension.GetCurrentParameterIndex (startOffset);
}
@@ -95,35 +95,35 @@ namespace MonoDevelop.Ide.Editor.Projection
public override void RunCompletionCommand ()
{
- if (IsInProjection ())
+ if (!IsActiveExtension())
return;
completionTextEditorExtension.RunCompletionCommand ();
}
public override void RunShowCodeTemplatesWindow ()
{
- if (IsInProjection ())
+ if (!IsActiveExtension())
return;
completionTextEditorExtension.RunShowCodeTemplatesWindow ();
}
public override void RunParameterCompletionCommand ()
{
- if (IsInProjection ())
+ if (!IsActiveExtension())
return;
completionTextEditorExtension.RunParameterCompletionCommand ();
}
public override bool CanRunCompletionCommand ()
{
- if (IsInProjection ())
+ if (!IsActiveExtension ())
return false;
return completionTextEditorExtension.CanRunCompletionCommand ();
}
public override bool CanRunParameterCompletionCommand ()
{
- if (IsInProjection ())
+ if (!IsActiveExtension ())
return false;
return completionTextEditorExtension.CanRunParameterCompletionCommand ();
}
@@ -140,7 +140,7 @@ namespace MonoDevelop.Ide.Editor.Projection
public override bool GetCompletionCommandOffset (out int cpos, out int wlen)
{
- if (IsInProjection ()) {
+ if (!IsActiveExtension()) {
cpos = 0; wlen = 0;
return false;
}
@@ -149,34 +149,47 @@ namespace MonoDevelop.Ide.Editor.Projection
public override CodeCompletion.ICompletionDataList ShowCodeSurroundingsCommand (CodeCompletion.CodeCompletionContext completionContext)
{
- if (IsInProjection ()) return null;
+ if (!IsActiveExtension()) return null;
return completionTextEditorExtension.ShowCodeSurroundingsCommand (completionContext);
}
public override CodeCompletion.ICompletionDataList ShowCodeTemplatesCommand (CodeCompletion.CodeCompletionContext completionContext)
{
- if (IsInProjection ()) return null;
+ if (!IsActiveExtension()) return null;
return completionTextEditorExtension.ShowCodeTemplatesCommand (completionContext);
}
public override CodeCompletion.ICompletionDataList CodeCompletionCommand (CodeCompletion.CodeCompletionContext completionContext)
{
- if (IsInProjection ()) return null;
+ if (!IsActiveExtension()) return null;
return completionTextEditorExtension.CodeCompletionCommand (completionContext);
}
public override CodeCompletion.ParameterHintingResult ParameterCompletionCommand (CodeCompletion.CodeCompletionContext completionContext)
{
- if (IsInProjection ()) return null;
+ if (!IsActiveExtension()) return null;
return completionTextEditorExtension.ParameterCompletionCommand (completionContext);
}
public override int GuessBestMethodOverload (CodeCompletion.ParameterHintingResult provider, int currentOverload)
{
- if (IsInProjection ()) return -1;
+ if (!IsActiveExtension()) return -1;
return completionTextEditorExtension.GuessBestMethodOverload (provider, currentOverload);
}
+ internal protected override void OnCompletionContextChanged (object o, EventArgs a)
+ {
+ if (!IsActiveExtension()) return;
+ completionTextEditorExtension.OnCompletionContextChanged (o, a);
+ }
+
+ internal protected override void HandlePositionChanged (object sender, EventArgs e)
+ {
+ if (!IsActiveExtension ())
+ return;
+ completionTextEditorExtension.HandlePositionChanged (sender, e);
+ }
+
protected override void Initialize ()
{
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSegment.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSegment.cs
index 8a49d40ca3..ba077a7d8c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSegment.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSegment.cs
@@ -85,5 +85,10 @@ namespace MonoDevelop.Ide.Editor.Projection
{
return offset + Offset - ProjectedOffset;
}
+
+ public override string ToString ()
+ {
+ return string.Format ("[ProjectedSegment: Offset={0}, ProjectedOffset={1}, Length={2}]", Offset, ProjectedOffset, Length);
+ }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
index 82ceb984a2..93da211780 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/ProjectedSemanticHighlighting.cs
@@ -73,26 +73,34 @@ namespace MonoDevelop.Ide.Editor.Projection
{
foreach (Projection p in projections) {
foreach (var seg in p.ProjectedSegments) {
- if (seg.IsInOriginal (segment)) {
+ if (seg.ContainsOriginal (segment.Offset) ||
+ seg.ContainsOriginal (segment.EndOffset) ||
+ segment.Offset <= seg.Offset && seg.Offset + seg.Length <= segment.EndOffset) {
if (p.ProjectedEditor.SemanticHighlighting == null)
continue;
+ if (segment.Offset < seg.Offset) {
+ foreach (var cs in GetColoredSegments (MonoDevelop.Core.Text.TextSegment.FromBounds (segment.Offset, seg.Offset - 1)))
+ yield return cs;
+ }
+
- int delta = segment.EndOffset - (seg.Offset + seg.Length);
- int len = seg.Length;
- if (delta < 0) {
- len += delta;
+ var v = Math.Max (seg.Offset, segment.Offset);
+ var projectedStartOffset = seg.FromOriginalToProjected (v);
+ var projectedEndOffset = Math.Min (seg.FromOriginalToProjected (segment.EndOffset), seg.ProjectedOffset + seg.Length);
+ var originalEndOffset = seg.FromProjectedToOriginal (projectedEndOffset);
+
+ foreach (var cs in p.ProjectedEditor.SemanticHighlighting.GetColoredSegments (MonoDevelop.Core.Text.TextSegment.FromBounds (projectedStartOffset, projectedEndOffset))) {
+ yield return new ColoredSegment (cs.Offset - projectedStartOffset + v, cs.Length, cs.ColorStyleKey);
}
- foreach (var cs in p.ProjectedEditor.SemanticHighlighting.GetColoredSegments (new MonoDevelop.Core.Text.TextSegment (seg.ProjectedOffset, len))) {
- yield return new ColoredSegment (cs.Offset - seg.ProjectedOffset + seg.Offset, cs.Length, cs.ColorStyleKey);
+ if (originalEndOffset < segment.EndOffset) {
+ foreach (var cs in GetColoredSegments (MonoDevelop.Core.Text.TextSegment.FromBounds (originalEndOffset, segment.EndOffset)))
+ yield return cs;
}
- foreach (var cs in GetColoredSegments (MonoDevelop.Core.Text.TextSegment.FromBounds (seg.Offset + len, segment.EndOffset)))
- yield return cs;
yield break;
}
}
}
}
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
index 1e7c3b37cc..b1a17b8064 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/Projection/Projection.cs
@@ -79,7 +79,7 @@ namespace MonoDevelop.Ide.Editor.Projection
public TextEditor CreateProjectedEditor (DocumentContext originalContext)
{
if (projectedEditor == null) {
- projectedEditor = TextEditorFactory.CreateNewEditor (Document);
+ projectedEditor = TextEditorFactory.CreateNewEditor (Document, TextEditorType.Projection);
projectedDocumentContext = new ProjectedDocumentContext (projectedEditor, originalContext);
projectedEditor.InitializeExtensionChain (projectedDocumentContext);
projectedProjections.InstallListener (projectedEditor);
@@ -126,5 +126,29 @@ namespace MonoDevelop.Ide.Editor.Projection
originalProjections.UpdateOnTextReplace (sender, e);
}
+
+ public bool TryConvertFromProjectionToOriginal (int projectedOffset, out int originalOffset)
+ {
+ foreach (var pseg in ProjectedSegments) {
+ if (pseg.ContainsProjected (projectedOffset)) {
+ originalOffset = pseg.FromProjectedToOriginal (projectedOffset);
+ return true;
+ }
+ }
+ originalOffset = -1;
+ return false;
+ }
+
+ public bool TryConvertFromOriginalToProjection (int originalOffset, out int projectedOffset)
+ {
+ foreach (var pseg in ProjectedSegments) {
+ if (pseg.ContainsOriginal (originalOffset)) {
+ projectedOffset = pseg.FromOriginalToProjected (originalOffset);
+ return true;
+ }
+ }
+ projectedOffset = -1;
+ return false;
+ }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
index 444f64fd04..8444f53f7f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditor.cs
@@ -55,6 +55,8 @@ namespace MonoDevelop.Ide.Editor
}
}
+ public TextEditorType TextEditorType { get; internal set; }
+
FileTypeCondition fileTypeCondition = new FileTypeCondition ();
List<TooltipExtensionNode> allProviders = new List<TooltipExtensionNode> ();
@@ -67,9 +69,9 @@ namespace MonoDevelop.Ide.Editor
allProviders.Add (extensionNode);
if (extensionNode.IsValidFor (MimeType))
return;
- provider = (TooltipProvider) extensionNode.CreateInstance ();
+ provider = (TooltipProvider)extensionNode.CreateInstance ();
} catch (Exception e) {
- LoggingService.LogError ("Can't create tooltip provider:"+ a.ExtensionNode, e);
+ LoggingService.LogError ("Can't create tooltip provider:" + a.ExtensionNode, e);
return;
}
if (a.Change == ExtensionChange.Add) {
@@ -465,7 +467,7 @@ namespace MonoDevelop.Ide.Editor
public void RunWhenLoaded (Action action)
{
if (action == null)
- throw new ArgumentNullException ("action");
+ throw new ArgumentNullException (nameof (action));
textEditorImpl.RunWhenLoaded (action);
}
@@ -482,14 +484,14 @@ namespace MonoDevelop.Ide.Editor
public void StartInsertionMode (InsertionModeOptions insertionModeOptions)
{
if (insertionModeOptions == null)
- throw new ArgumentNullException ("insertionModeOptions");
+ throw new ArgumentNullException (nameof (insertionModeOptions));
textEditorImpl.StartInsertionMode (insertionModeOptions);
}
public void StartTextLinkMode (TextLinkModeOptions textLinkModeOptions)
{
if (textLinkModeOptions == null)
- throw new ArgumentNullException ("textLinkModeOptions");
+ throw new ArgumentNullException (nameof (textLinkModeOptions));
textEditorImpl.StartTextLinkMode (textLinkModeOptions);
}
@@ -506,7 +508,7 @@ namespace MonoDevelop.Ide.Editor
public Xwt.Point LocationToPoint (DocumentLocation location)
{
return textEditorImpl.LocationToPoint (location.Line, location.Column);
- }
+ }
public Xwt.Point LocationToPoint (int line, int column)
{
@@ -546,13 +548,13 @@ namespace MonoDevelop.Ide.Editor
public void RemoveText (int offset, int count)
{
- RemoveText (new TextSegment (offset, count));
+ RemoveText (new TextSegment (offset, count));
}
public void RemoveText (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
ReadWriteTextDocument.RemoveText (segment);
}
@@ -569,14 +571,14 @@ namespace MonoDevelop.Ide.Editor
public void ReplaceText (ISegment segment, string value)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
ReadWriteTextDocument.ReplaceText (segment.Offset, segment.Length, value);
}
public void ReplaceText (ISegment segment, ITextSource value)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
ReadWriteTextDocument.ReplaceText (segment.Offset, segment.Length, value);
}
@@ -598,37 +600,37 @@ namespace MonoDevelop.Ide.Editor
public void AddMarker (IDocumentLine line, ITextLineMarker lineMarker)
{
if (line == null)
- throw new ArgumentNullException ("line");
+ throw new ArgumentNullException (nameof (line));
if (lineMarker == null)
- throw new ArgumentNullException ("lineMarker");
+ throw new ArgumentNullException (nameof (lineMarker));
textEditorImpl.AddMarker (line, lineMarker);
}
public void AddMarker (int lineNumber, ITextLineMarker lineMarker)
{
if (lineMarker == null)
- throw new ArgumentNullException ("lineMarker");
+ throw new ArgumentNullException (nameof (lineMarker));
AddMarker (GetLine (lineNumber), lineMarker);
}
public void RemoveMarker (ITextLineMarker lineMarker)
{
if (lineMarker == null)
- throw new ArgumentNullException ("lineMarker");
+ throw new ArgumentNullException (nameof (lineMarker));
textEditorImpl.RemoveMarker (lineMarker);
}
public IEnumerable<ITextLineMarker> GetLineMarkers (IDocumentLine line)
{
if (line == null)
- throw new ArgumentNullException ("line");
+ throw new ArgumentNullException (nameof (line));
return textEditorImpl.GetLineMarkers (line);
}
public IEnumerable<ITextSegmentMarker> GetTextSegmentMarkersAt (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
return textEditorImpl.GetTextSegmentMarkersAt (segment);
}
@@ -640,21 +642,21 @@ namespace MonoDevelop.Ide.Editor
public void AddMarker (ITextSegmentMarker marker)
{
if (marker == null)
- throw new ArgumentNullException ("marker");
+ throw new ArgumentNullException (nameof (marker));
textEditorImpl.AddMarker (marker);
}
public bool RemoveMarker (ITextSegmentMarker marker)
{
if (marker == null)
- throw new ArgumentNullException ("marker");
+ throw new ArgumentNullException (nameof (marker));
return textEditorImpl.RemoveMarker (marker);
}
public void SetFoldings (IEnumerable<IFoldSegment> foldings)
{
if (foldings == null)
- throw new ArgumentNullException ("foldings");
+ throw new ArgumentNullException (nameof (foldings));
textEditorImpl.SetFoldings (foldings);
}
@@ -667,7 +669,7 @@ namespace MonoDevelop.Ide.Editor
public IEnumerable<IFoldSegment> GetFoldingsIn (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
return textEditorImpl.GetFoldingsIn (segment.Offset, segment.Length);
}
@@ -681,7 +683,7 @@ namespace MonoDevelop.Ide.Editor
/// it doesn't require creating a String object.</remarks>
public char GetCharAt (int offset)
{
- return ReadOnlyTextDocument.GetCharAt (offset);
+ return ReadOnlyTextDocument.GetCharAt (offset);
}
public string GetTextAt (int offset, int length)
@@ -692,7 +694,7 @@ namespace MonoDevelop.Ide.Editor
public string GetTextAt (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
return ReadOnlyTextDocument.GetTextAt (segment);
}
@@ -704,28 +706,28 @@ namespace MonoDevelop.Ide.Editor
public string GetVirtualIndentationString (int lineNumber)
{
if (lineNumber < 1 || lineNumber > LineCount)
- throw new ArgumentOutOfRangeException ("lineNumber");
+ throw new ArgumentOutOfRangeException (nameof (lineNumber));
return textEditorImpl.GetVirtualIndentationString (lineNumber);
}
public string GetVirtualIndentationString (IDocumentLine line)
{
if (line == null)
- throw new ArgumentNullException ("line");
+ throw new ArgumentNullException (nameof (line));
return textEditorImpl.GetVirtualIndentationString (line.LineNumber);
}
public int GetVirtualIndentationColumn (int lineNumber)
{
if (lineNumber < 1 || lineNumber > LineCount)
- throw new ArgumentOutOfRangeException ("lineNumber");
+ throw new ArgumentOutOfRangeException (nameof (lineNumber));
return 1 + textEditorImpl.GetVirtualIndentationString (lineNumber).Length;
}
public int GetVirtualIndentationColumn (IDocumentLine line)
{
if (line == null)
- throw new ArgumentNullException ("line");
+ throw new ArgumentNullException (nameof (line));
return 1 + textEditorImpl.GetVirtualIndentationString (line.LineNumber).Length;
}
@@ -752,21 +754,21 @@ namespace MonoDevelop.Ide.Editor
public ITextSource CreateSnapshot (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
return ReadOnlyTextDocument.CreateSnapshot (segment.Offset, segment.Length);
}
public void WriteTextTo (TextWriter writer)
{
if (writer == null)
- throw new ArgumentNullException ("writer");
+ throw new ArgumentNullException (nameof (writer));
ReadOnlyTextDocument.WriteTextTo (writer);
}
public void WriteTextTo (TextWriter writer, int offset, int length)
{
if (writer == null)
- throw new ArgumentNullException ("writer");
+ throw new ArgumentNullException (nameof (writer));
ReadOnlyTextDocument.WriteTextTo (writer, offset, length);
}
@@ -808,8 +810,10 @@ namespace MonoDevelop.Ide.Editor
textEditorImpl.SetTextPasteHandler (textPasteHandler);
}
- public IList<SkipChar> SkipChars {
- get {
+ public IList<SkipChar> SkipChars
+ {
+ get
+ {
return textEditorImpl.SkipChars;
}
}
@@ -846,7 +850,7 @@ namespace MonoDevelop.Ide.Editor
set {
if (extensionContext != null) {
extensionContext.RemoveExtensionNodeHandler ("MonoDevelop/SourceEditor2/TooltipProviders", OnTooltipProviderChanged);
-// textEditorImpl.ClearTooltipProviders ();
+ // textEditorImpl.ClearTooltipProviders ();
}
extensionContext = value;
if (extensionContext != null)
@@ -860,17 +864,24 @@ namespace MonoDevelop.Ide.Editor
}
}
+ internal TextEditorExtension TextEditorExtensionChain {
+ get {
+ return textEditorImpl.EditorExtension;
+ }
+ }
+
internal ITextMarkerFactory TextMarkerFactory {
get {
return textEditorImpl.TextMarkerFactory;
}
}
- internal TextEditor (ITextEditorImpl textEditorImpl)
+ internal TextEditor (ITextEditorImpl textEditorImpl, TextEditorType textEditorType)
{
if (textEditorImpl == null)
- throw new ArgumentNullException ("textEditorImpl");
+ throw new ArgumentNullException (nameof (textEditorImpl));
this.textEditorImpl = textEditorImpl;
+ this.TextEditorType = textEditorType;
commandRouter = new InternalCommandRouter (this);
fileTypeCondition.SetFileName (FileName);
ExtensionContext = AddinManager.CreateExtensionContext ();
@@ -884,7 +895,7 @@ namespace MonoDevelop.Ide.Editor
textEditorImpl.ClearTooltipProviders ();
foreach (var extensionNode in allProviders) {
if (extensionNode.IsValidFor (MimeType))
- textEditorImpl.AddTooltipProvider ((TooltipProvider) extensionNode.CreateInstance ());
+ textEditorImpl.AddTooltipProvider ((TooltipProvider)extensionNode.CreateInstance ());
}
};
}
@@ -915,7 +926,7 @@ namespace MonoDevelop.Ide.Editor
{
this.editor = editor;
}
-
+
#region IMultiCastCommandRouter implementation
System.Collections.IEnumerable MonoDevelop.Components.Commands.IMultiCastCommandRouter.GetCommandTargets ()
@@ -962,11 +973,12 @@ namespace MonoDevelop.Ide.Editor
internal void InitializeExtensionChain (DocumentContext documentContext)
{
if (documentContext == null)
- throw new ArgumentNullException ("documentContext");
+ throw new ArgumentNullException (nameof (documentContext));
DetachExtensionChain ();
var extensions = ExtensionContext.GetExtensionNodes ("/MonoDevelop/Ide/TextEditorExtensions", typeof(TextEditorExtensionNode));
- TextEditorExtension last = null;
var mimetypeChain = DesktopService.GetMimeTypeInheritanceChainForFile (FileName).ToArray ();
+ var newExtensions = new List<TextEditorExtension> ();
+
foreach (TextEditorExtensionNode extNode in extensions) {
if (!extNode.Supports (FileName, mimetypeChain))
continue;
@@ -974,12 +986,25 @@ namespace MonoDevelop.Ide.Editor
try {
var instance = extNode.CreateInstance ();
ext = instance as TextEditorExtension;
- if (ext == null)
- continue;
+ if (ext != null)
+ newExtensions.Add (ext);
} catch (Exception e) {
- LoggingService.LogError ("Error while creating text editor extension :" + extNode.Id + "(" + extNode.Type +")", e);
+ LoggingService.LogError ("Error while creating text editor extension :" + extNode.Id + "(" + extNode.Type + ")", e);
continue;
}
+ }
+ SetExtensionChain (documentContext, newExtensions);
+ }
+
+ internal void SetExtensionChain (DocumentContext documentContext, IEnumerable<TextEditorExtension> extensions)
+ {
+ if (documentContext == null)
+ throw new ArgumentNullException (nameof (documentContext));
+ if (extensions == null)
+ throw new ArgumentNullException (nameof (extensions));
+
+ TextEditorExtension last = null;
+ foreach (var ext in extensions) {
if (ext.IsValidInContext (documentContext)) {
if (last != null) {
last.Next = ext;
@@ -990,9 +1015,10 @@ namespace MonoDevelop.Ide.Editor
ext.Initialize (this, documentContext);
}
}
- this.DocumentContext = documentContext;
+ DocumentContext = documentContext;
}
+
void DetachExtensionChain ()
{
var editorExtension = textEditorImpl.EditorExtension;
@@ -1007,7 +1033,7 @@ namespace MonoDevelop.Ide.Editor
textEditorImpl.EditorExtension = null;
}
- public T GetContent<T> () where T : class
+ public T GetContent<T>() where T : class
{
T result = textEditorImpl as T;
if (result != null)
@@ -1022,7 +1048,7 @@ namespace MonoDevelop.Ide.Editor
return null;
}
- public IEnumerable<T> GetContents<T> () where T : class
+ public IEnumerable<T> GetContents<T>() where T : class
{
T result = textEditorImpl as T;
if (result != null)
@@ -1045,7 +1071,7 @@ namespace MonoDevelop.Ide.Editor
public string GetPangoMarkup (ISegment segment)
{
if (segment == null)
- throw new ArgumentNullException ("segment");
+ throw new ArgumentNullException (nameof (segment));
return textEditorImpl.GetPangoMarkup (segment.Offset, segment.Length);
}
@@ -1066,15 +1092,15 @@ namespace MonoDevelop.Ide.Editor
// There are two uses for this custom list type:
// 1) it's private, and thus (unlike List<object>) cannot be confused with real annotations
// 2) It allows us to simplify the cloning logic by making the list behave the same as a clonable annotation.
- public AnnotationList (int initialCapacity) : base(initialCapacity)
+ public AnnotationList (int initialCapacity) : base (initialCapacity)
{
}
public object Clone ()
{
lock (this) {
- AnnotationList copy = new AnnotationList (this.Count);
- for (int i = 0; i < this.Count; i++) {
+ AnnotationList copy = new AnnotationList (Count);
+ for (int i = 0; i < Count; i++) {
object obj = this [i];
ICloneable c = obj as ICloneable;
copy.Add (c != null ? c.Clone () : obj);
@@ -1087,9 +1113,9 @@ namespace MonoDevelop.Ide.Editor
public void AddAnnotation (object annotation)
{
if (annotation == null)
- throw new ArgumentNullException ("annotation");
+ throw new ArgumentNullException (nameof (annotation));
retry: // Retry until successful
- object oldAnnotation = Interlocked.CompareExchange (ref this.annotations, annotation, null);
+ object oldAnnotation = Interlocked.CompareExchange (ref annotations, annotation, null);
if (oldAnnotation == null) {
return; // we successfully added a single annotation
}
@@ -1099,7 +1125,7 @@ namespace MonoDevelop.Ide.Editor
list = new AnnotationList (4);
list.Add (oldAnnotation);
list.Add (annotation);
- if (Interlocked.CompareExchange (ref this.annotations, list, oldAnnotation) != oldAnnotation) {
+ if (Interlocked.CompareExchange (ref annotations, list, oldAnnotation) != oldAnnotation) {
// the transformation failed (some other thread wrote to this.annotations first)
goto retry;
}
@@ -1111,23 +1137,23 @@ namespace MonoDevelop.Ide.Editor
}
}
- public void RemoveAnnotations<T> () where T : class
+ public void RemoveAnnotations<T>() where T : class
{
- retry: // Retry until successful
- object oldAnnotations = this.annotations;
+ retry: // Retry until successful
+ object oldAnnotations = annotations;
var list = oldAnnotations as AnnotationList;
if (list != null) {
lock (list)
list.RemoveAll (obj => obj is T);
} else if (oldAnnotations is T) {
- if (Interlocked.CompareExchange (ref this.annotations, null, oldAnnotations) != oldAnnotations) {
+ if (Interlocked.CompareExchange (ref annotations, null, oldAnnotations) != oldAnnotations) {
// Operation failed (some other thread wrote to this.annotations first)
goto retry;
}
}
}
- public T Annotation<T> () where T: class
+ public T Annotation<T>() where T : class
{
object annotations = this.annotations;
var list = annotations as AnnotationList;
@@ -1147,8 +1173,10 @@ namespace MonoDevelop.Ide.Editor
/// <summary>
/// Gets all annotations stored on this AstNode.
/// </summary>
- public IEnumerable<object> Annotations {
- get {
+ public IEnumerable<object> Annotations
+ {
+ get
+ {
object annotations = this.annotations;
AnnotationList list = annotations as AnnotationList;
if (list != null) {
@@ -1164,12 +1192,12 @@ namespace MonoDevelop.Ide.Editor
#endregion
List<ProjectedTooltipProvider> projectedProviders = new List<ProjectedTooltipProvider> ();
- IReadOnlyList<MonoDevelop.Ide.Editor.Projection.Projection> projections = null;
+ IReadOnlyList<Editor.Projection.Projection> projections = null;
- public void SetOrUpdateProjections (DocumentContext ctx, IReadOnlyList<MonoDevelop.Ide.Editor.Projection.Projection> projections, DisabledProjectionFeatures disabledFeatures = DisabledProjectionFeatures.None)
+ public void SetOrUpdateProjections (DocumentContext ctx, IReadOnlyList<Editor.Projection.Projection> projections, DisabledProjectionFeatures disabledFeatures = DisabledProjectionFeatures.None)
{
if (ctx == null)
- throw new ArgumentNullException ("ctx");
+ throw new ArgumentNullException (nameof (ctx));
if (this.projections != null) {
foreach (var projection in this.projections) {
projection.Dettach ();
@@ -1183,7 +1211,7 @@ namespace MonoDevelop.Ide.Editor
}
if ((disabledFeatures & DisabledProjectionFeatures.SemanticHighlighting) != DisabledProjectionFeatures.SemanticHighlighting) {
- if (SemanticHighlighting is ProjectedSemanticHighlighting) {
+ if (SemanticHighlighting is ProjectedSemanticHighlighting) {
((ProjectedSemanticHighlighting)SemanticHighlighting).UpdateProjection (projections);
} else {
SemanticHighlighting = new ProjectedSemanticHighlighting (this, ctx, projections);
@@ -1191,11 +1219,13 @@ namespace MonoDevelop.Ide.Editor
}
if ((disabledFeatures & DisabledProjectionFeatures.Tooltips) != DisabledProjectionFeatures.Tooltips) {
- projectedProviders.ForEach (textEditorImpl.RemoveTooltipProvider);
+ projectedProviders.ForEach (textEditorImpl.RemoveTooltipProvider);
projectedProviders = new List<ProjectedTooltipProvider> ();
foreach (var projection in projections) {
- foreach (var tp in projection.ProjectedEditor.textEditorImpl.TooltipProvider) {
- var newProvider = new ProjectedTooltipProvider (this, ctx, projection, tp);
+ foreach (var tp in projection.ProjectedEditor.allProviders) {
+ if (!tp.IsValidFor (projection.ProjectedEditor.MimeType))
+ continue;
+ var newProvider = new ProjectedTooltipProvider (this, ctx, projection, (TooltipProvider)tp.CreateInstance ());
projectedProviders.Add (newProvider);
textEditorImpl.AddTooltipProvider (newProvider);
}
@@ -1227,6 +1257,7 @@ namespace MonoDevelop.Ide.Editor
var completionTextEditorExtension = lastExtension.Next as CompletionTextEditorExtension;
if (completionTextEditorExtension != null) {
var projectedFilterExtension = new ProjectedFilterCompletionTextEditorExtension (completionTextEditorExtension, projections) { Next = completionTextEditorExtension.Next };
+ completionTextEditorExtension.Deinitialize ();
lastExtension.Next = projectedFilterExtension;
projectedFilterExtension.Initialize (this, DocumentContext);
}
@@ -1256,5 +1287,10 @@ namespace MonoDevelop.Ide.Editor
{
textEditorImpl.RemoveOverlay (messageOverlayContent);
}
+
+ internal void UpdateBraceMatchingResult (BraceMatchingResult? result)
+ {
+ textEditorImpl.UpdateBraceMatchingResult (result);
+ }
}
} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
index 6d54b8060b..06c213cf54 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorFactory.cs
@@ -71,16 +71,16 @@ namespace MonoDevelop.Ide.Editor
return currentFactory.CreateNewDocument (textSource, fileName, mimeType);
}
- public static TextEditor CreateNewEditor ()
+ public static TextEditor CreateNewEditor (TextEditorType textEditorType = TextEditorType.Default)
{
- return new TextEditor (currentFactory.CreateNewEditor ());
+ return new TextEditor (currentFactory.CreateNewEditor (), textEditorType);
}
- public static TextEditor CreateNewEditor (IReadonlyTextDocument document)
+ public static TextEditor CreateNewEditor (IReadonlyTextDocument document, TextEditorType textEditorType = TextEditorType.Default)
{
if (document == null)
throw new System.ArgumentNullException ("document");
- return new TextEditor (currentFactory.CreateNewEditor (document));
+ return new TextEditor (currentFactory.CreateNewEditor (document), textEditorType);
}
public static string[] GetSyntaxProperties (string mimeType, string name)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorType.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorType.cs
new file mode 100644
index 0000000000..882e872411
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorType.cs
@@ -0,0 +1,39 @@
+//
+// ITextEditor.cs
+//
+// Author:
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2014 Xamarin Inc. (http://xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+
+namespace MonoDevelop.Ide.Editor
+{
+ [Flags]
+ public enum TextEditorType
+ {
+ Default = 0,
+ Projection = 1,
+
+ Visibile = Default,
+ Invisible = Projection
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
index 2305687ba2..2f37ec6a29 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs
@@ -44,7 +44,6 @@ using MonoDevelop.Components;
using MonoDevelop.Core;
using System.Threading.Tasks;
using System.Threading;
-using System.Threading;
using Microsoft.CodeAnalysis;
using Gdk;
using MonoDevelop.Ide.CodeFormatting;
@@ -687,7 +686,7 @@ namespace MonoDevelop.Ide.Editor
break;
}
startOffset = i;
- for (int j = 0; j < commentTag.Length; j++) {
+ for (int j = 0; j < commentTag.Length && i < text.Length; j++) {
if (text.GetCharAt (i) != commentTag [j])
return false;
i++;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsPanelNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsPanelNode.cs
index 75fd11084f..36e9a2802e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsPanelNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Extensions/OptionsPanelNode.cs
@@ -85,7 +85,7 @@ namespace MonoDevelop.Ide.Extensions
}
}
- public string TypeName {
+ public new string TypeName {
get {
return typeName;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/MemberCollector.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/MemberCollector.cs
deleted file mode 100644
index de5119e2be..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/MemberCollector.cs
+++ /dev/null
@@ -1,236 +0,0 @@
-////
-//// MemberCollector.cs
-////
-//// Author:
-//// Mansheng Yang <lightyang0@gmail.com>
-////
-//// Copyright (c) 2012 Mansheng Yang
-////
-//// Permission is hereby granted, free of charge, to any person obtaining a copy
-//// of this software and associated documentation files (the "Software"), to deal
-//// in the Software without restriction, including without limitation the rights
-//// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-//// copies of the Software, and to permit persons to whom the Software is
-//// furnished to do so, subject to the following conditions:
-////
-//// The above copyright notice and this permission notice shall be included in
-//// all copies or substantial portions of the Software.
-////
-//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-//// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-//// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-//// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-//// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-//// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-//// THE SOFTWARE.
-//using System;
-//using System.Collections.Generic;
-//using System.Linq;
-//using MonoDevelop.Projects;
-//using MonoDevelop.Ide.TypeSystem;
-//using ICSharpCode.NRefactory.TypeSystem;
-//
-//namespace MonoDevelop.Ide.FindInFiles
-//{
-// public static class MemberCollector
-// {
-// static bool MatchParameters (IMember a, IMember b)
-// {
-// return MatchParameters (a as IParameterizedMember, b as IParameterizedMember);
-// }
-//
-// static bool MatchParameters (IParameterizedMember a, IParameterizedMember b)
-// {
-// if (a == null && b == null) return true;
-// if (a == null || b == null) return false;
-//
-// return Equals (a.Compilation, a.Parameters, b.Parameters);
-// }
-//
-// #region Code from NRefactory ParameterListComparer
-//
-// public static bool Equals(ICompilation comp, IList<IParameter> x, IList<IParameter> y)
-// {
-// if (x == y)
-// return true;
-// if (x == null || y == null || x.Count != y.Count)
-// return false;
-// for (int i = 0; i < x.Count; i++) {
-// var a = x[i];
-// var b = y[i];
-// if (a == null && b == null)
-// continue;
-// if (a == null || b == null)
-// return false;
-//
-// // We want to consider the parameter lists "Method<T>(T a)" and "Method<S>(S b)" as equal.
-// // However, the parameter types are not considered equal, as T is a different type parameter than S.
-// // In order to compare the method signatures, we will normalize all method type parameters.
-// IType aType = a.Type.AcceptVisitor(normalizationVisitor);
-// IType bType = b.Type.AcceptVisitor(normalizationVisitor);
-// bType = comp.Import (bType);
-// if (!aType.Equals(bType))
-// return false;
-// }
-// return true;
-// }
-//
-// sealed class NormalizeTypeVisitor : TypeVisitor
-// {
-// public override IType VisitTypeParameter(ITypeParameter type)
-// {
-// if (type.OwnerType == SymbolKind.Method) {
-// return ICSharpCode.NRefactory.TypeSystem.Implementation.DummyTypeParameter.GetMethodTypeParameter(type.Index);
-// } else {
-// return base.VisitTypeParameter(type);
-// }
-// }
-//
-// public override IType VisitTypeDefinition(ITypeDefinition type)
-// {
-// if (type.KnownTypeCode == KnownTypeCode.Object)
-// return SpecialType.Dynamic;
-// return base.VisitTypeDefinition(type);
-// }
-// }
-//
-// static readonly NormalizeTypeVisitor normalizationVisitor = new NormalizeTypeVisitor();
-//
-// #endregion
-//
-// /// <summary>
-// /// find all base types(types that are not derived from other types) in the specified types
-// /// </summary>
-// /// <param name="types"></param>
-// /// <returns></returns>
-// public static IEnumerable<ITypeDefinition> GetBaseTypes (IEnumerable<ITypeDefinition> types)
-// {
-// if (types == null)
-// yield break;
-// types = types.ToList ();
-// if (!types.Any ())
-// yield break;
-//
-// var baseType = types.FirstOrDefault ();
-// var otherTypes = new List<ITypeDefinition> ();
-//
-// foreach (var type in types.Skip (1)) {
-// if (baseType.IsDerivedFrom (type)) {
-// baseType = type;
-// } else if (!type.IsDerivedFrom (baseType)) {
-// // this type is not directly related to baseType
-// otherTypes.Add (type);
-// }
-// }
-// yield return baseType;
-// foreach (var type in GetBaseTypes (otherTypes))
-// yield return type;
-// }
-//
-// static IEnumerable<IMember> GetMembers (ITypeDefinition type, IMember member, bool ignoreInherited,
-// Func<IMember, bool> filter)
-// {
-// var options = ignoreInherited ? GetMemberOptions.IgnoreInheritedMembers : GetMemberOptions.None;
-// var members = type.GetMembers (m => m.Name == member.Name, options);
-//
-///* // Filter out shadowed members.
-// // class A { public string Foo { get; set; } } class B : A { public string Foo { get; set; } }
-// if (member.SymbolKind == SymbolKind.Property || !(member is IParameterizedMember)) {
-// members = members.Where (m => m == member || m.DeclaringType.Kind == TypeKind.Interface);
-// }*/
-// if (filter != null)
-// members = members.Where (filter);
-// return members;
-// }
-//
-// static IEnumerable<ITypeDefinition> Import (ICompilation compilation, IEnumerable<ITypeDefinition> types)
-// {
-// return types.Select (t => compilation.Import (t));
-// }
-//
-// /// <summary>
-// /// collect members with the same signature/name(if overloads are included) as the specified member
-// /// in the inheritance tree
-// /// </summary>
-// public static IEnumerable<IMember> CollectMembers (Solution solution, IMember member, ReferenceFinder.RefactoryScope scope,
-// bool includeOverloads = true, bool matchDeclaringType = false)
-// {
-// if (solution == null || member.SymbolKind == SymbolKind.Destructor || member.SymbolKind == SymbolKind.Operator)
-// return new [] { member };
-//
-// if (member.SymbolKind == SymbolKind.Constructor) {
-// if (includeOverloads)
-// return member.DeclaringType.GetMembers (m => m.SymbolKind == SymbolKind.Constructor, GetMemberOptions.IgnoreInheritedMembers);
-// return new [] { member };
-// }
-//
-// Func<IMember, bool> memberFilter = null;
-// if (member is IParameterizedMember && !includeOverloads)
-// memberFilter = m => MatchParameters (m, member);
-//
-// var declaringType = member.DeclaringTypeDefinition;
-// if (declaringType == null)
-// return new [] { member };
-// // only collect members in declaringType
-// if (matchDeclaringType)
-// return GetMembers (declaringType, member, true, memberFilter);
-//
-// if (declaringType.Kind != TypeKind.Class && declaringType.Kind != TypeKind.Interface)
-// return GetMembers (declaringType, member, false, memberFilter);
-//
-// var searchTypes = new List<ITypeDefinition> ();
-// if (includeOverloads) {
-// var interfaces = from t in declaringType.GetAllBaseTypeDefinitions ()
-// where t.Kind == TypeKind.Interface && GetMembers (t, member, true, memberFilter).Any ()
-// select t;
-// searchTypes.AddRange (GetBaseTypes (interfaces));
-// }
-//
-// if (member.DeclaringType.Kind == TypeKind.Class) {
-// var members = GetMembers (declaringType, member, false, memberFilter).ToList ();
-// if (members.Any (m => m.IsOverridable))
-// searchTypes.AddRange (GetBaseTypes (members.Select (m => m.DeclaringTypeDefinition)));
-// else if (searchTypes.Count == 0)
-// return members;
-// }
-//
-// IList<ICompilation> compilations;
-// if (scope == ReferenceFinder.RefactoryScope.Solution || scope == ReferenceFinder.RefactoryScope.Unknown) {
-// var projects = SearchCollector.CollectProjects (solution, searchTypes);
-// compilations = projects.Select (TypeSystemService.GetCompilation).ToList ();
-// } else {
-// compilations = new [] { member.Compilation };
-// }
-//
-// var result = new List<IMember> ();
-// var mainAssemblies = new HashSet<string> (compilations.Select (c => c.MainAssembly.AssemblyName));
-// var searchedAssemblies = new HashSet<string> ();
-// var searchedTypes = new HashSet<string> ();
-//
-// foreach (var compilation in compilations) {
-// var baseTypeImports = Import(compilation, searchTypes).Where (t => t != null).ToList ();
-// if (!baseTypeImports.Any ()) continue;
-//
-// foreach (var assembly in compilation.Assemblies) {
-// // search main assemblies in their projects' own compilation, to avoid possible resolving problems
-// if ((mainAssemblies.Contains(assembly.AssemblyName) && assembly != compilation.MainAssembly) ||
-// !searchedAssemblies.Add (assembly.AssemblyName))
-// continue;
-//
-// foreach (var type in assembly.GetAllTypeDefinitions ()) {
-// // members in base types will also be added
-// // because IsDerivedFrom return true for a type itself
-// if (!searchedTypes.Add (type.ReflectionName) || !baseTypeImports.Any (type.IsDerivedFrom))
-// continue;
-// result.AddRange (GetMembers (type, member, true, memberFilter));
-// }
-// }
-// }
-// if (!result.Contains (member))
-// result.Add (member);
-// return result;
-// }
-//
-// }
-//}
-//
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/ReferencesFinder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/ReferencesFinder.cs
deleted file mode 100644
index c69477eb13..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/ReferencesFinder.cs
+++ /dev/null
@@ -1,323 +0,0 @@
-////
-//// ReferenceFinder.cs
-////
-//// Author:
-//// Mike Krüger <mkrueger@novell.com>
-////
-//// 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 Mono.Addins;
-//using MonoDevelop.Core;
-//using MonoDevelop.Projects;
-//using ICSharpCode.NRefactory.TypeSystem;
-//using MonoDevelop.Ide.TypeSystem;
-//using System.Threading.Tasks;
-//
-//namespace MonoDevelop.Ide.FindInFiles
-//{
-// public abstract class ReferenceFinder
-// {
-// public bool IncludeDocumentation {
-// get;
-// set;
-// }
-//
-// /*
-// Project project;
-// protected Project Project {
-// get {
-// if (project == null)
-// project = Content.GetProject ();
-// return project;
-// }
-// }*/
-//
-// static List<ReferenceFinderCodon> referenceFinderCodons = new List<ReferenceFinderCodon> ();
-//
-// static ReferenceFinder ()
-// {
-// AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/ReferenceFinder", delegate(object sender, ExtensionNodeEventArgs args) {
-// var codon = (ReferenceFinderCodon)args.ExtensionNode;
-// switch (args.Change) {
-// case ExtensionChange.Add:
-// referenceFinderCodons.Add (codon);
-// break;
-// case ExtensionChange.Remove:
-// referenceFinderCodons.Remove (codon);
-// break;
-// }
-// });
-// }
-//
-// static ReferenceFinder GetReferenceFinder (string mimeType)
-// {
-// var codon = referenceFinderCodons.FirstOrDefault (c => c.SupportedMimeTypes.Any (mt => mt == mimeType));
-// return codon != null ? codon.CreateFinder () : null;
-// }
-//
-// public static IEnumerable<MemberReference> FindReferences (object member, bool searchForAllOverloads, IProgressMonitor monitor = null)
-// {
-// return FindReferences (IdeApp.ProjectOperations.CurrentSelectedSolution, member, searchForAllOverloads, RefactoryScope.Unknown, monitor);
-// }
-//
-// public static IEnumerable<MemberReference> FindReferences (object member, bool searchForAllOverloads, RefactoryScope scope, IProgressMonitor monitor = null)
-// {
-// return FindReferences (IdeApp.ProjectOperations.CurrentSelectedSolution, member, searchForAllOverloads, scope, monitor);
-// }
-//
-// static SearchCollector.FileList GetFileList (string fileName)
-// {
-// var doc = IdeApp.Workbench.GetDocument (fileName);
-// if (doc != null)
-// return new SearchCollector.FileList (doc.Project, null, new [] { (FilePath)fileName });
-// return null;
-// }
-//
-// static IEnumerable<SearchCollector.FileList> GetFileNames (Solution solution, object node, RefactoryScope scope,
-// IProgressMonitor monitor, IEnumerable<object> searchNodes)
-// {
-// if (!(node is IField) && !(node is IParameter) && node is IVariable || scope == RefactoryScope.File) {
-// string fileName;
-// if (node is IEntity) {
-// fileName = ((IEntity)node).Region.FileName;
-// } else if (node is ITypeParameter) {
-// fileName = ((ITypeParameter)node).Region.FileName;
-// } else {
-// fileName = ((IVariable)node).Region.FileName;
-// }
-// var fileList = GetFileList (fileName);
-// if (fileList != null)
-// yield return fileList;
-// yield break;
-// }
-//
-// if (node is ITypeParameter) {
-// var typeParameter = node as ITypeParameter;
-// if (typeParameter.Owner != null) {
-// yield return SearchCollector.CollectDeclaringFiles (typeParameter.Owner);
-// yield break;
-// }
-// var fileList = GetFileList (typeParameter.Region.FileName);
-// if (fileList != null)
-// yield return fileList;
-// yield break;
-// }
-// var par = node as IParameter;
-// if (par != null) {
-// node = par.Owner;
-// }
-//
-// var compilationProvider = (ICompilationProvider)node;
-// switch (scope) {
-// case RefactoryScope.DeclaringType:
-// var entity = (IEntity)compilationProvider;
-// if (entity.DeclaringTypeDefinition != null)
-// yield return SearchCollector.CollectDeclaringFiles (entity.DeclaringTypeDefinition);
-// else
-// yield return SearchCollector.CollectDeclaringFiles (entity);
-// break;
-// case RefactoryScope.Project:
-// var sourceProject = TypeSystemService.GetProject (compilationProvider.Compilation.MainAssembly.UnresolvedAssembly.Location);
-// foreach (var file in SearchCollector.CollectFiles (sourceProject, searchNodes))
-// yield return file;
-// break;
-// default:
-// var files = SearchCollector.CollectFiles (solution, searchNodes).ToList ();
-// if (monitor != null)
-// monitor.BeginTask (GettextCatalog.GetString ("Searching for references in solution..."), files.Count);
-// foreach (var file in files) {
-// if (monitor != null && monitor.IsCancelRequested)
-// yield break;
-// yield return file;
-// if (monitor != null)
-// monitor.Step (1);
-// }
-// if (monitor != null)
-// monitor.EndTask ();
-// break;
-// }
-// }
-//
-// public static List<Project> GetAllReferencingProjects (Solution solution, Project sourceProject)
-// {
-// var projects = new List<Project> ();
-// projects.Add (sourceProject);
-// foreach (var project in solution.GetAllProjects ()) {
-// if (project.GetReferencedItems (ConfigurationSelector.Default).Any (prj => prj == sourceProject))
-// projects.Add (project);
-// }
-// return projects;
-// }
-//
-// public static IEnumerable<MemberReference> FindReferences (Solution solution, object member, bool searchForAllOverloads, RefactoryScope scope = RefactoryScope.Unknown, IProgressMonitor monitor = null)
-// {
-// yield break;
-//
-//// if (member == null)
-//// yield break;
-//// if (solution == null && member is IEntity) {
-//// var project = TypeSystemService.GetProject ((member as IEntity).Compilation.MainAssembly.UnresolvedAssembly.Location);
-//// if (project == null)
-//// yield break;
-//// solution = project.ParentSolution;
-//// }
-////
-//// IList<object> searchNodes = new [] { member };
-//// if (member is ITypeParameter) {
-//// // nothing
-//// } else if (member is IType) {
-//// searchNodes = CollectMembers ((IType)member).ToList<object> ();
-//// } else if (member is IEntity) {
-//// var e = (IEntity)member;
-//// if (e.SymbolKind == SymbolKind.Destructor) {
-//// foreach (var r in FindReferences (solution, e.DeclaringType, searchForAllOverloads, scope, monitor)) {
-//// yield return r;
-//// }
-//// yield break;
-//// }
-//// if (member is IMember)
-//// searchNodes = CollectMembers (solution, (IMember)member, scope, searchForAllOverloads).ToList<object> ();
-//// }
-//// // prepare references finder
-//// var preparedFinders = new List<Tuple<ReferenceFinder, Project, IProjectContent, List<FilePath>>> ();
-//// var curList = new List<FilePath> ();
-//// int totalFiles = 0;
-//// foreach (var info in GetFileNames (solution, member, scope, monitor, searchNodes)) {
-//// string oldMime = null;
-//// foreach (var file in info.Files) {
-//// if (monitor != null && monitor.IsCancelRequested)
-//// yield break;
-////
-//// string mime = DesktopService.GetMimeTypeForUri (file);
-//// if (mime != oldMime) {
-//// var finder = GetReferenceFinder (mime);
-//// if (finder == null)
-//// continue;
-////
-//// oldMime = mime;
-////
-//// curList = new List<FilePath> ();
-//// preparedFinders.Add (Tuple.Create (finder, info.Project, info.Content, curList));
-//// }
-//// curList.Add (file);
-//// totalFiles++;
-//// }
-//// }
-////
-//// // execute search
-//// if (monitor != null)
-//// monitor.BeginTask (GettextCatalog.GetString ("Analyzing files..."), totalFiles);
-//// var foundOccurrences = new HashSet<Tuple<string, DomRegion>> ();
-//// foreach (var tuple in preparedFinders) {
-//// var finder = tuple.Item1;
-//// foreach (var foundReference in finder.FindReferences (tuple.Item2, tuple.Item3, tuple.Item4, monitor, searchNodes)) {
-//// if (monitor != null && monitor.IsCancelRequested)
-//// yield break;
-//// var tag = Tuple.Create (foundReference.FileName, foundReference.Region);
-//// if (foundOccurrences.Contains (tag))
-//// continue;
-//// foundOccurrences.Add (tag);
-//// yield return foundReference;
-//// }
-//// }
-//// if (monitor != null)
-//// monitor.EndTask ();
-// }
-//
-// public abstract IEnumerable<MemberReference> FindReferences (Project project, IProjectContent content, IEnumerable<FilePath> files, IProgressMonitor monitor, IEnumerable<object> searchedMembers);
-//
-// internal static IEnumerable<IMember> CollectMembers (Solution solution, IMember member, RefactoryScope scope, bool includeOverloads = true)
-// {
-// return MemberCollector.CollectMembers (solution, member, scope, includeOverloads);
-// }
-//
-// internal static IEnumerable<IEntity> CollectMembers (IType type)
-// {
-// var typeDefinition = type.GetDefinition ();
-// if (typeDefinition == null)
-// yield break;
-// yield return (IEntity)typeDefinition;
-// foreach (var c in typeDefinition.GetMembers (m => m.SymbolKind == SymbolKind.Constructor, GetMemberOptions.IgnoreInheritedMembers)) {
-// if (!c.IsSynthetic)
-// yield return c;
-// }
-//
-// foreach (var m in type.GetMethods (m => m.IsDestructor, GetMemberOptions.IgnoreInheritedMembers)) {
-// yield return m;
-// }
-// }
-//
-//
-// public enum RefactoryScope{ Unknown, File, DeclaringType, Solution, Project}
-//// static RefactoryScope GetScope (object o)
-//// {
-//// IEntity node = o as IEntity;
-//// if (node == null)
-//// return RefactoryScope.File;
-////
-//// // TODO: RefactoringsScope.Hierarchy
-//// switch (node.Accessibility) {
-//// case Accessibility.Public:
-//// case Accessibility.Protected:
-//// case Accessibility.ProtectedOrInternal:
-//// if (node.DeclaringTypeDefinition != null) {
-//// var scope = GetScope (node.DeclaringTypeDefinition);
-//// if (scope != RefactoryScope.Solution)
-//// return RefactoryScope.Project;
-//// }
-//// return RefactoryScope.Solution;
-//// case Accessibility.Internal:
-//// case Accessibility.ProtectedAndInternal:
-//// return RefactoryScope.Project;
-//// }
-//// return RefactoryScope.DeclaringType;
-//// }
-// }
-//
-// [ExtensionNode (Description="A reference finder. The specified class needs to inherit from MonoDevelop.Projects.CodeGeneration.ReferenceFinder")]
-// internal class ReferenceFinderCodon : TypeExtensionNode
-// {
-// [NodeAttribute("supportedmimetypes", "Mime types supported by this binding (to be shown in the Open File dialog)")]
-// string[] supportedMimetypes;
-//
-// public string[] SupportedMimeTypes {
-// get {
-// return supportedMimetypes;
-// }
-// set {
-// supportedMimetypes = value;
-// }
-// }
-//
-// public ReferenceFinder CreateFinder ()
-// {
-// return (ReferenceFinder)CreateInstance ();
-// }
-//
-// public override string ToString ()
-// {
-// return string.Format ("[ReferenceFinderCodon: SupportedMimeTypes={0}]", SupportedMimeTypes);
-// }
-// }
-//}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchCollector.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchCollector.cs
deleted file mode 100755
index 053d55449f..0000000000
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchCollector.cs
+++ /dev/null
@@ -1,272 +0,0 @@
-////
-//// SearchCollector.cs
-////
-//// Author:
-//// Mansheng Yang <lightyang0@gmail.com>
-////
-//// Copyright (c) 2012 Mansheng Yang
-////
-//// 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 ICSharpCode.NRefactory.TypeSystem;
-//using MonoDevelop.Core;
-//using MonoDevelop.Projects;
-//using MonoDevelop.Ide.TypeSystem;
-//
-//namespace MonoDevelop.Ide.FindInFiles
-//{
-// public class SearchCollector
-// {
-//
-// public class FileList
-// {
-// public Project Project
-// {
-// get;
-// private set;
-// }
-//
-// public IProjectContent Content
-// {
-// get;
-// private set;
-// }
-//
-// public IEnumerable<FilePath> Files
-// {
-// get;
-// private set;
-// }
-//
-// public FileList (Project project, IProjectContent content, IEnumerable<FilePath> files)
-// {
-// Project = project;
-// Content = content;
-// Files = files;
-// }
-// }
-//
-// public static IEnumerable<Project> CollectProjects (Solution solution, IEnumerable<object> entities)
-// {
-// return new SearchCollector (solution, null, entities).CollectProjects ();
-// }
-//
-// public static IEnumerable<FileList> CollectFiles (Project project, IEnumerable<object> entities)
-// {
-// return new SearchCollector (project.ParentSolution, project, entities).CollectFiles ();
-// }
-//
-// public static IEnumerable<FileList> CollectFiles (Solution solution, IEnumerable<object> entities)
-// {
-// return new SearchCollector (solution, null, entities).CollectFiles ();
-// }
-//
-// static IEnumerable<Project> GetAllReferencingProjects (Solution solution, string assemblyName)
-// {
-// return solution.GetAllProjects ().Where (
-// project => TypeSystemService.GetCompilation (project).Assemblies.Any (a => a.AssemblyName == assemblyName));
-// }
-//
-// static FileList CollectDeclaringFiles (IEntity entity, IEnumerable<string> fileNames)
-// {
-// var project = TypeSystemService.GetProject (entity);
-// var paths = fileNames.Distinct().Select (p => (FilePath)p);
-// return new SearchCollector.FileList (project, TypeSystemService.GetProjectContext (project), paths);
-// }
-//
-// public static FileList CollectDeclaringFiles (IEntity entity)
-// {
-// if (entity is ITypeDefinition)
-// return CollectDeclaringFiles (entity, (entity as ITypeDefinition).Parts.Select (p => p.Region.FileName));
-// if (entity is IMethod)
-// return CollectDeclaringFiles (entity, (entity as IMethod).Parts.Select (p => p.Region.FileName));
-// return CollectDeclaringFiles (entity, new [] { entity.Region.FileName });
-// }
-//
-// Project searchProject;
-// bool searchProjectAdded; // if the searchProject is added, we can stop collecting
-// Solution solution;
-// IEnumerable<object> entities;
-// bool projectOnly; // only collect projects
-//
-// IDictionary<Project, ISet<string>> collectedFiles = new Dictionary<Project, ISet<string>> ();
-// ISet<Project> collectedProjects = new HashSet<Project> ();
-//
-// ISet<string> searchedAssemblies = new HashSet<string> ();
-// ISet<Project> searchedProjects = new HashSet<Project> ();
-//
-// /// <param name="searchProject">the project to search. use to null to search the whole solution</param>
-// SearchCollector (Solution solution, Project searchProject, IEnumerable<object> entities)
-// {
-// this.solution = solution;
-// this.searchProject = searchProject;
-// this.entities = entities;
-// }
-//
-// IEnumerable<Project> CollectProjects ()
-// {
-// projectOnly = true;
-// foreach (var o in entities) {
-// var entity = o as IEntity;
-// if (entity != null) {
-// Collect (TypeSystemService.GetProject (entity), entity);
-// continue;
-// }
-// var par = o as IParameter;
-// if (par != null) {
-// Collect (TypeSystemService.GetProject (par.Owner), par.Owner);
-// continue;
-// }
-// }
-// return collectedProjects;
-// }
-//
-// IEnumerable<FileList> CollectFiles ()
-// {
-// projectOnly = false;
-// foreach (var o in entities) {
-// if (o is INamespace) {
-// Collect (null, null);
-// continue;
-// }
-//
-// var par = o as IParameter;
-// if (par != null) {
-// if (par.Owner != null) {
-// Collect (TypeSystemService.GetProject (par.Owner), par.Owner);
-// } else {
-// Collect (IdeApp.Workbench.ActiveDocument.Project, null);
-// }
-// } else {
-// var entity = o as IEntity;
-// if (entity == null)
-// continue;
-// Collect (TypeSystemService.GetProject (entity), entity);
-// }
-//
-// if (searchProjectAdded) break;
-// }
-// foreach (var project in collectedProjects)
-// yield return new FileList (project, TypeSystemService.GetProjectContext (project), project.Files.Where (f => f.BuildAction == BuildAction.Compile).Select (f => f.FilePath));
-//
-// foreach (var files in collectedFiles)
-// yield return new FileList (files.Key, TypeSystemService.GetProjectContext (files.Key), files.Value.Select (f => (FilePath)f));
-// }
-//
-// void AddProject (Project project)
-// {
-// if (project == null)
-// throw new ArgumentNullException ("project");
-//
-// searchProjectAdded = (project == searchProject);
-//
-// // remove duplicate files
-// if (collectedProjects.Add (project))
-// collectedFiles.Remove (project);
-// }
-//
-// void AddFiles (Project project, IEnumerable<string> files)
-// {
-// if (project == null)
-// throw new ArgumentNullException ("project");
-//
-// if (collectedProjects.Contains (project))
-// return;
-//
-// ISet<string> fileSet;
-// if (!collectedFiles.TryGetValue (project, out fileSet)) {
-// fileSet = new HashSet<string> ();
-// collectedFiles[project] = fileSet;
-// }
-//
-// foreach (var file in files)
-// fileSet.Add (file);
-// }
-//
-// void Collect (Project sourceProject, IEntity entity, bool searchInProject = false)
-// {
-// if (searchedProjects.Contains(sourceProject))
-// return;
-//
-// if (searchProject != null && sourceProject != searchProject) {
-// // searching for a entity not defined in the project
-// AddProject (searchProject);
-// return;
-// }
-//
-// if (sourceProject == null) {
-// if (entity == null) {
-// foreach (var project in solution.GetAllProjects ())
-// AddProject (project);
-// return;
-// }
-// // entity is defined in a referenced assembly
-// var assemblyName = entity.ParentAssembly.AssemblyName;
-// if (!searchedAssemblies.Add (assemblyName))
-// return;
-// foreach (var project in GetAllReferencingProjects (solution, assemblyName))
-// AddProject (project);
-//
-// return;
-// }
-//
-// if (entity == null) {
-// AddProject (sourceProject);
-// return;
-// }
-//
-// var declaringType = entity.DeclaringTypeDefinition;
-// // TODO: possible optimization for protected
-// switch (entity.Accessibility) {
-// case Accessibility.Public:
-// case Accessibility.Protected:
-// case Accessibility.ProtectedOrInternal:
-// case Accessibility.Internal:
-// case Accessibility.ProtectedAndInternal:
-//
-// if (declaringType != null)
-// Collect (sourceProject, entity.DeclaringTypeDefinition, searchInProject);
-// else if (searchProject != null || searchInProject)
-// AddProject (sourceProject);
-// else {
-// foreach (var project in ReferenceFinder.GetAllReferencingProjects (solution, sourceProject)) {
-// if (entity.Accessibility == Accessibility.Internal || entity.Accessibility == Accessibility.ProtectedAndInternal) {
-// var wrapper = TypeSystemService.GetProjectContentWrapper (project);
-// if (wrapper == null)
-// continue;
-// if (!entity.ParentAssembly.InternalsVisibleTo (wrapper.Compilation.MainAssembly))
-// continue;
-// }
-// AddProject (project);
-// }
-// }
-// break;
-// default: // private
-// if (projectOnly)
-// AddProject (sourceProject);
-// else if (declaringType != null)
-// AddFiles (sourceProject, declaringType.Parts.Select (p => p.Region.FileName));
-// break;
-// }
-// }
-// }
-//}
-//
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs
index 651aed9054..3120b7e1e9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResult.cs
@@ -30,7 +30,6 @@ using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Highlighting;
using System.Collections.Generic;
using MonoDevelop.Projects;
-using System.Collections.Generic;
using System;
namespace MonoDevelop.Ide.FindInFiles
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
index 3a7b9b932f..e32206e69c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.FindInFiles/SearchResultWidget.cs
@@ -407,7 +407,11 @@ namespace MonoDevelop.Ide.FindInFiles
var doc = GetDocument (searchResult);
if (doc == null)
return;
- searchResult.LineNumber = doc.OffsetToLineNumber (searchResult.Offset);
+ try {
+ searchResult.LineNumber = doc.OffsetToLineNumber (searchResult.Offset);
+ } catch (ArgumentOutOfRangeException) {
+ searchResult.LineNumber = -1;
+ }
}
fileNameMarkup = MarkupText (System.IO.Path.GetFileName (searchResult.FileName) + ":" + searchResult.LineNumber, didRead);
searchResult.FileNameMarkup = fileNameMarkup;
@@ -534,8 +538,15 @@ namespace MonoDevelop.Ide.FindInFiles
bool isSelected = treeviewSearchResults.Selection.IterIsSelected (iter);
if (searchResult.Markup == null) {
- if (searchResult.LineNumber <= 0)
- searchResult.LineNumber = doc.OffsetToLineNumber (searchResult.Offset);
+ if (searchResult.LineNumber <= 0) {
+ try {
+ searchResult.LineNumber = doc.OffsetToLineNumber (searchResult.Offset);
+ } catch (ArgumentOutOfRangeException) {
+ searchResult.LineNumber = -1;
+ textMarkup = "Invalid search result offset";
+ goto end;
+ }
+ }
var line = doc.GetLine (searchResult.LineNumber);
if (line == null) {
textMarkup = "Invalid line number " + searchResult.LineNumber + " from offset: " + searchResult.Offset;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
index e772ff3ab4..119b22075b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
@@ -723,8 +723,19 @@ namespace MonoDevelop.Ide.Gui
var currentParseText = editor.CreateDocumentSnapshot ();
CancelOldParsing();
var project = Project ?? adhocProject;
+
if (project != null && TypeSystemService.CanParseProjections (project, Editor.MimeType, FileName)) {
- var task = TypeSystemService.ParseProjection (project, currentParseFile, editor.MimeType, currentParseText);
+
+ var options = new ParseOptions {
+ Project = project,
+ Content = currentParseText,
+ FileName = currentParseFile
+ };
+ var projectFile = project.GetProjectFile (currentParseFile);
+ if (projectFile != null)
+ options.BuildAction = projectFile.BuildAction;
+
+ var task = TypeSystemService.ParseProjection (options, editor.MimeType);
if (task.Result != null) {
var p = task.Result;
this.parsedDocument = p.ParsedDocument;
@@ -830,10 +841,19 @@ namespace MonoDevelop.Ide.Gui
CancelOldParsing ();
var token = parseTokenSource.Token;
var project = Project ?? adhocProject;
+ var projectFile = project.GetProjectFile (currentParseFile);
ThreadPool.QueueUserWorkItem (delegate {
TypeSystemService.AddSkippedFile (currentParseFile);
if (project != null && TypeSystemService.CanParseProjections (project, mimeType, currentParseFile)) {
- TypeSystemService.ParseProjection (project, currentParseFile, mimeType, currentParseText, token).ContinueWith (task => {
+ var options = new ParseOptions {
+ Project = project,
+ Content = currentParseText,
+ FileName = currentParseFile
+ };
+
+ if (projectFile != null)
+ options.BuildAction = projectFile.BuildAction;
+ TypeSystemService.ParseProjection (options, mimeType, token).ContinueWith (task => {
if (token.IsCancellationRequested)
return;
Application.Invoke (delegate {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
index db7d3521c0..55fb6f75c7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
@@ -430,7 +430,7 @@ namespace MonoDevelop.Ide.Projects
if (wizardProvider.MoveToPreviousPage ()) {
return;
}
- } else if (IsLastPage && wizardProvider.HasWizard) {
+ } else if (IsLastPage && wizardProvider.HasWizard && wizardProvider.CurrentWizard.TotalPages != 0) {
IsLastPage = false;
return;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs
index b71e9f1038..ecf5f20cd8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs
@@ -306,6 +306,9 @@ namespace MonoDevelop.Ide.Templates
string referenceOutputAssembly = elem.GetAttribute ("ReferenceOutputAssembly");
if (!string.IsNullOrEmpty (referenceOutputAssembly))
ProjectReference.ReferenceOutputAssembly = bool.Parse (referenceOutputAssembly);
+ string hintPath = elem.GetAttribute ("HintPath");
+ if (!string.IsNullOrEmpty (hintPath))
+ ProjectReference.ExtendedProperties ["_OriginalMSBuildReferenceHintPath"] = hintPath;
}
public ProjectReference ProjectReference { get; private set; }
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
index d8fb742864..89c87321f9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs
@@ -298,7 +298,7 @@ namespace MonoDevelop.Ide.Templates
content = ProcessContent (content, model);
string mime = DesktopService.GetMimeTypeForUri (fileName);
- CodeFormatter formatter = !string.IsNullOrEmpty (mime) ? CodeFormatterService.GetFormatter (mime) : null;
+ var formatter = !string.IsNullOrEmpty (mime) ? CodeFormatterService.GetFormatter (mime) : null;
if (formatter != null) {
var formatted = formatter.FormatText (policyParent != null ? policyParent.Policies : null, content);
@@ -362,7 +362,7 @@ namespace MonoDevelop.Ide.Templates
public virtual void ModifyTags (SolutionFolderItem policyParent, Project project, string language,
string identifier, string fileName, ref Dictionary<string,string> tags)
{
- DotNetProject netProject = project as DotNetProject;
+ //DotNetProject netProject = project as DotNetProject;
string languageExtension = "";
LanguageBinding binding = null;
if (!string.IsNullOrEmpty (language)) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
index 5e565f6978..575153a2e2 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -39,6 +39,7 @@ using MonoDevelop.Core.Text;
using System.Collections.Concurrent;
using MonoDevelop.Ide.CodeFormatting;
using Gtk;
+using MonoDevelop.Ide.Editor.Projection;
namespace MonoDevelop.Ide.TypeSystem
{
@@ -149,6 +150,7 @@ namespace MonoDevelop.Ide.TypeSystem
{
var projects = new ConcurrentBag<ProjectInfo> ();
var mdProjects = solution.GetAllProjects ();
+ projectionList.Clear ();
Parallel.ForEach (mdProjects, proj => {
if (token.IsCancellationRequested)
return;
@@ -353,13 +355,25 @@ namespace MonoDevelop.Ide.TypeSystem
return info;
}
+ internal void UpdateProjectionEnntry (MonoDevelop.Projects.ProjectFile projectFile, IReadOnlyList<Projection> projections)
+ {
+ foreach (var entry in projectionList) {
+ if (entry.File.FilePath == projectFile.FilePath) {
+ projectionList.Remove (entry);
+ break;
+ }
+ }
+ projectionList.Add (new ProjectionEntry { File = projectFile, Projections = projections});
+
+ }
+
internal static Func<string, TextLoader> CreateTextLoader = fileName => new MonoDevelopTextLoader (fileName);
static DocumentInfo CreateDocumentInfo (string projectName, ProjectData id, MonoDevelop.Projects.ProjectFile f)
{
var sourceCodeKind = f.FilePath.Extension == ".sketchcs" ? SourceCodeKind.Interactive : SourceCodeKind.Regular;
return DocumentInfo.Create (
- id.GetOrCreateDocumentId (f.Name),
+ id.GetOrCreateDocumentId (f.FilePath),
f.FilePath,
new [] { projectName }.Concat (f.ProjectVirtualPath.ParentDirectory.ToString ().Split (Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)),
sourceCodeKind,
@@ -368,42 +382,62 @@ namespace MonoDevelop.Ide.TypeSystem
false
);
}
+ List<ProjectionEntry> projectionList = new List<ProjectionEntry>();
+
+ internal IReadOnlyList<ProjectionEntry> ProjectionList {
+ get {
+ return projectionList;
+ }
+ }
- IEnumerable<DocumentInfo> CreateDocuments (ProjectData id, MonoDevelop.Projects.Project p, CancellationToken token)
+ internal class ProjectionEntry
+ {
+ public MonoDevelop.Projects.ProjectFile File;
+ public IReadOnlyList<Projection> Projections;
+ }
+
+ IEnumerable<DocumentInfo> CreateDocuments (ProjectData projectData, MonoDevelop.Projects.Project p, CancellationToken token)
{
var duplicates = new HashSet<DocumentId> ();
foreach (var f in p.Files) {
if (token.IsCancellationRequested)
yield break;
if (TypeSystemParserNode.IsCompileBuildAction (f.BuildAction)) {
- if (!duplicates.Add (id.GetOrCreateDocumentId (f.Name)))
+ if (!duplicates.Add (projectData.GetOrCreateDocumentId (f.Name)))
continue;
- yield return CreateDocumentInfo (p.Name, id, f);
+ yield return CreateDocumentInfo (p.Name, projectData, f);
continue;
}
var mimeType = DesktopService.GetMimeTypeForUri (f.FilePath);
var node = TypeSystemService.GetTypeSystemParserNode (mimeType, f.BuildAction);
if (node == null || !node.Parser.CanGenerateProjection (mimeType, f.BuildAction, p.SupportedLanguages))
continue;
- if (!duplicates.Add (id.GetOrCreateDocumentId (f.Name)))
- continue;
var options = new ParseOptions {
FileName = f.FilePath,
Project = p,
Content = StringTextSource.ReadFrom (f.FilePath),
};
var projections = node.Parser.GenerateProjections (options);
+ var entry = new ProjectionEntry ();
+ entry.File = f;
+ var list = new List<Projection> ();
+ entry.Projections = list;
foreach (var projection in projections.Result) {
+ list.Add (projection);
+ if (!duplicates.Add (projectData.GetOrCreateDocumentId (projection.Document.FileName)))
+ continue;
+ var plainName = projection.Document.FileName.FileName;
yield return DocumentInfo.Create (
- id.GetOrCreateDocumentId (projection.Document.FileName),
- projection.Document.FileName,
- null,
+ projectData.GetOrCreateDocumentId (projection.Document.FileName),
+ plainName,
+ new [] { p.Name }.Concat (f.ProjectVirtualPath.ParentDirectory.ToString ().Split (Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)),
SourceCodeKind.Regular,
TextLoader.From (TextAndVersion.Create (new MonoDevelopSourceText (projection.Document), VersionStamp.Create (), projection.Document.FileName)),
- f.Name,
+ projection.Document.FileName,
false
);
}
+ projectionList.Add (entry);
}
}
@@ -583,12 +617,32 @@ namespace MonoDevelop.Ide.TypeSystem
if (document == null)
return;
bool isOpen;
- var data = TextFileProvider.Instance.GetTextEditorData (document.FilePath, out isOpen);
+ var filePath = document.FilePath;
+
+ Projection projection = null;
+ foreach (var entry in ProjectionList) {
+ var p = entry.Projections.FirstOrDefault (proj => FilePath.PathComparer.Equals (proj.Document.FileName, filePath));
+ if (p != null) {
+ filePath = entry.File.FilePath;
+ projection = p;
+ break;
+ }
+ }
+
+ var data = TextFileProvider.Instance.GetTextEditorData (filePath, out isOpen);
var changes = text.GetTextChanges (document.GetTextAsync ().Result).OrderByDescending (c => c.Span.Start).ToList ();
int delta = 0;
foreach (var change in changes) {
- data.ReplaceText (change.Span.Start, change.Span.Length, change.NewText);
+ var offset = change.Span.Start;
+
+ if (projection != null) {
+ int originalOffset;
+ if (projection.TryConvertFromProjectionToOriginal (offset, out originalOffset))
+ offset = originalOffset;
+ }
+
+ data.ReplaceText (offset, change.Span.Length, change.NewText);
delta += change.Span.Length - change.NewText.Length;
}
@@ -599,18 +653,33 @@ namespace MonoDevelop.Ide.TypeSystem
foreach (var change in changes) {
delta -= change.Span.Length - change.NewText.Length;
var startOffset = change.Span.Start - delta;
+
+ if (projection != null) {
+ int originalOffset;
+ if (projection.TryConvertFromProjectionToOriginal (startOffset, out originalOffset))
+ startOffset = originalOffset;
+ }
+
+
var str = formatter.FormatText (mp.Policies, currentText, startOffset, startOffset + change.NewText.Length);
data.ReplaceText (startOffset, change.NewText.Length, str);
}
data.Save ();
- FileService.NotifyFileChanged (document.FilePath);
+ FileService.NotifyFileChanged (filePath);
} else {
var formatter = CodeFormatterService.GetFormatter (data.MimeType);
- var documentContext = IdeApp.Workbench.Documents.FirstOrDefault (d => FilePath.PathComparer.Compare (d.FileName, document.FilePath) == 0);
+ var documentContext = IdeApp.Workbench.Documents.FirstOrDefault (d => FilePath.PathComparer.Compare (d.FileName, filePath) == 0);
if (documentContext != null) {
foreach (var change in changes) {
delta -= change.Span.Length - change.NewText.Length;
var startOffset = change.Span.Start - delta;
+
+ if (projection != null) {
+ int originalOffset;
+ if (projection.TryConvertFromProjectionToOriginal (startOffset, out originalOffset))
+ startOffset = originalOffset;
+ }
+
formatter.OnTheFlyFormat ((TextEditor)data, documentContext, startOffset, startOffset + change.NewText.Length);
}
}
@@ -700,11 +769,21 @@ namespace MonoDevelop.Ide.TypeSystem
public void UpdateFileContent (string fileName, string text)
{
SourceText newText = SourceText.From (text);
- foreach (var project in this.projectDataMap.Keys) {
- var docId = this.GetDocumentId (project, fileName);
- if (docId == null)
- continue;
- base.OnDocumentTextChanged (docId, newText, PreservationMode.PreserveIdentity);
+ foreach (var kv in this.projectDataMap) {
+ var projectId = kv.Key;
+ var docId = this.GetDocumentId (projectId, fileName);
+ if (docId != null) {
+ base.OnDocumentTextChanged (docId, newText, PreservationMode.PreserveIdentity);
+ }
+ var monoProject = GetMonoProject (projectId);
+ if (monoProject != null) {
+ var pf = monoProject.GetProjectFile (fileName);
+ if (pf != null) {
+ TypeSystemService.ParseProjection (new ParseOptions { Project = monoProject, FileName = fileName, Content = new StringTextSource (text), BuildAction = pf.BuildAction },
+ DesktopService.GetMimeTypeForUri (fileName));
+ }
+ }
+
}
}
@@ -806,7 +885,29 @@ namespace MonoDevelop.Ide.TypeSystem
}
#endregion
-
+
+
+
+ /// <summary>
+ /// Tries the get original file from projection. If the fileName / offset is inside a projection this method tries to convert it
+ /// back to the original physical file.
+ /// </summary>
+ internal bool TryGetOriginalFileFromProjection (string fileName, int offset, out string originalName, out int originalOffset)
+ {
+ foreach (var projectionEntry in ProjectionList) {
+ var projection = projectionEntry.Projections.FirstOrDefault (p => FilePath.PathComparer.Equals (p.Document.FileName, fileName));
+ if (projection != null) {
+ if (projection.TryConvertFromProjectionToOriginal (offset, out originalOffset)) {
+ originalName = projectionEntry.File.FilePath;
+ return true;
+ }
+ }
+ }
+
+ originalName = fileName;
+ originalOffset = offset;
+ return false;
+ }
}
// static class MonoDevelopWorkspaceFeatures
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/ICodeFormatter.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemOutputTrackingNode.cs
index 902a644fdc..0ea3b3bc31 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/ICodeFormatter.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemOutputTrackingNode.cs
@@ -1,21 +1,21 @@
-//
-// IFormatter.cs
-//
+//
+// TypeSystemOutputTrackingNode.cs
+//
// Author:
-// Mike Krüger <mkrueger@novell.com>
-//
-// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
-//
+// Mike Krüger <mkrueger@xamarin.com>
+//
+// Copyright (c) 2015 Xamarin Inc. (http://xamarin.com)
+//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
-//
+//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
-//
+//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -25,32 +25,37 @@
// THE SOFTWARE.
using System;
+using Mono.Addins;
using System.Collections.Generic;
-using MonoDevelop.Projects.Policies;
+using System.Linq;
+using MonoDevelop.Core.StringParsing;
-namespace MonoDevelop.Ide.CodeFormatting
+namespace MonoDevelop.Ide.TypeSystem
{
- public interface ICodeFormatter
+ class TypeSystemOutputTrackingNode : ExtensionNode
{
- string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, string input);
-
- /// <summary>
- /// Formats the text in a range. Returns only the modified range, or null if formatting failed.
- /// </summary>
- string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- string input, int startOffset, int endOffset);
- }
-
- public abstract class AbstractCodeFormatter : ICodeFormatter
- {
- public abstract string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain,
- string input, int startOffset, int endOffset);
-
- public string FormatText (PolicyContainer policyParent, IEnumerable<string> mimeTypeChain, string input)
- {
- if (string.IsNullOrEmpty (input))
- return input;
- return FormatText (policyParent, mimeTypeChain, input, 0, input.Length);
+ [NodeAttribute (Description="The project type.")]
+ string projectType;
+
+ public string ProjectType {
+ get {
+ return projectType;
+ }
+ set {
+ projectType = value;
+ }
+ }
+
+ [NodeAttribute (Description="The language name.")]
+ string languageName;
+
+ public string LanguageName {
+ get {
+ return languageName;
+ }
+ set {
+ languageName = value;
+ }
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
index 62ca819303..210e1386cf 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParser.cs
@@ -39,6 +39,17 @@ namespace MonoDevelop.Ide.TypeSystem
{
public sealed class ParseOptions
{
+ string buildAction;
+
+ public string BuildAction {
+ get {
+ return buildAction ?? "Compile";
+ }
+ set {
+ buildAction = value;
+ }
+ }
+
public string FileName { get; set; }
public ITextSource Content { get; set; }
@@ -84,17 +95,11 @@ namespace MonoDevelop.Ide.TypeSystem
/// <summary>
/// Parse the specified file. The file content is provided as text reader.
/// </summary>
- /// <param name='storeAst'>
- /// If set to <c>true</c> the ast should be stored in the parsed document.
- /// </param>
- /// <param name='fileName'>
- /// The name of the file.
- /// </param>
- /// <param name='content'>
- /// A text reader providing the file contents.
+ /// <param name='options'>
+ /// The parse options.
/// </param>
- /// <param name='project'>
- /// The project the file belongs to.
+ /// <param name='cancellationToken'>
+ /// The cancellation token to cancel the parsing task.
/// </param>
public abstract Task<ParsedDocument> Parse (ParseOptions options, CancellationToken cancellationToken = default(CancellationToken));
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
index 1a58e50598..99b6248989 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemParserNode.cs
@@ -31,7 +31,7 @@ using MonoDevelop.Core.StringParsing;
namespace MonoDevelop.Ide.TypeSystem
{
- public class TypeSystemParserNode : TypeExtensionNode
+ class TypeSystemParserNode : TypeExtensionNode
{
const string ApiDefinitionBuildAction = "ObjcBindingApiDefinition";
@@ -85,32 +85,4 @@ namespace MonoDevelop.Ide.TypeSystem
buildAction == "BMacInputs";
}
}
-
-
- public class TypeSystemOutputTrackingNode : ExtensionNode
- {
- [NodeAttribute (Description="The project type.")]
- string projectType;
-
- public string ProjectType {
- get {
- return projectType;
- }
- set {
- projectType = value;
- }
- }
-
- [NodeAttribute (Description="The language name.")]
- string languageName;
-
- public string LanguageName {
- get {
- return languageName;
- }
- set {
- languageName = value;
- }
- }
- }
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
index 8a5bf71552..4462028b0b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
@@ -198,13 +198,12 @@ namespace MonoDevelop.Ide.TypeSystem
internal static bool CanParseProjections (Project project, string mimeType, string fileName)
{
- var parser = GetParser (mimeType);
- if (parser == null)
- return false;
var projectFile = project.GetProjectFile (fileName);
if (projectFile == null)
return false;
-
+ var parser = GetParser (mimeType, projectFile.BuildAction);
+ if (parser == null)
+ return false;
return parser.CanGenerateProjection (mimeType, projectFile.BuildAction, project.SupportedLanguages);
}
@@ -230,7 +229,7 @@ namespace MonoDevelop.Ide.TypeSystem
if (options.FileName == null)
throw new ArgumentNullException ("fileName");
- var parser = GetParser (mimeType);
+ var parser = GetParser (mimeType, options.BuildAction);
if (parser == null)
return Task.FromResult ((ParsedDocumentProjection)null);
@@ -238,17 +237,23 @@ namespace MonoDevelop.Ide.TypeSystem
try {
var result = parser.GenerateParsedDocumentProjection (options, cancellationToken);
if (options.Project != null) {
- var Workspace = Workspaces.First () ;
- var projectId = Workspace.GetProjectId (options.Project);
+ var ws = Workspaces.First () ;
+ var projectId = ws.GetProjectId (options.Project);
+
if (projectId != null) {
+ ws.UpdateProjectionEnntry (options.Project.GetProjectFile (options.FileName), result.Result.Projections);
foreach (var projection in result.Result.Projections) {
- var docId = Workspace.GetDocumentId (projectId, projection.Document.FileName);
- if (docId != null)
- Workspace.InformDocumentTextChange (docId, new MonoDevelopSourceText (projection.Document));
+ var docId = ws.GetDocumentId (projectId, projection.Document.FileName);
+ if (docId != null) {
+ ws.InformDocumentTextChange (docId, new MonoDevelopSourceText (projection.Document));
+ }
}
}
}
return result;
+ } catch (AggregateException ae) {
+ ae.Flatten ().Handle (x => x is OperationCanceledException);
+ return Task.FromResult ((ParsedDocumentProjection)null);
} catch (OperationCanceledException) {
return Task.FromResult ((ParsedDocumentProjection)null);
} catch (Exception e) {
@@ -628,16 +633,6 @@ namespace MonoDevelop.Ide.TypeSystem
}
#endregion
-
- internal static Microsoft.CodeAnalysis.Document GetCodeAnalysisDocument (Microsoft.CodeAnalysis.DocumentId analysisDocument, CancellationToken cancellationToken = default (CancellationToken))
- {
- foreach (var w in Workspaces) {
- var doc = w.GetDocument (analysisDocument, cancellationToken);
- if (doc != null)
- return doc;
- }
- return null;
- }
internal static void InformDocumentClose (Microsoft.CodeAnalysis.DocumentId analysisDocument, FilePath fileName)
{
@@ -682,7 +677,7 @@ namespace MonoDevelop.Ide.TypeSystem
return null;
}
- public static Microsoft.CodeAnalysis.Document GetCodeAnysisDocument (Microsoft.CodeAnalysis.DocumentId docId, CancellationToken cancellationToken = default (CancellationToken))
+ public static Microsoft.CodeAnalysis.Document GetCodeAnalysisDocument (Microsoft.CodeAnalysis.DocumentId docId, CancellationToken cancellationToken = default (CancellationToken))
{
if (docId == null)
throw new ArgumentNullException ("docId");
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 55f2ae7d71..e820f31e34 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -109,20 +109,20 @@
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="Xamarin.Mac" Condition=" '$(Configuration)' == 'DebugMac' Or '$(Configuration)' == 'ReleaseMac' ">
<HintPath>..\..\..\external\Xamarin.Mac.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
</Reference>
<Reference Include="System.Composition.AttributedModel">
<HintPath>..\..\..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath>
@@ -202,9 +202,9 @@
<Project>{7E891659-45F3-42B5-B940-A728780CCAE9}</Project>
<Name>ICSharpCode.NRefactory6.CSharp</Name>
</ProjectReference>
- <ProjectReference Include="..\..\..\external\NRefactory6\ICSharpCode.NRefactory.CSharp.Refactoring\ICSharpCode.NRefactory6.CSharp.Refactoring.csproj">
+ <ProjectReference Include="..\..\..\external\NRefactory6\NR6Pack\NR6Pack.csproj">
<Project>{C465A5DC-AD28-49A2-89C0-F81838814A7E}</Project>
- <Name>ICSharpCode.NRefactory6.CSharp.Refactoring</Name>
+ <Name>NR6Pack</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\external\nrefactory\ICSharpCode.NRefactory.Cecil\ICSharpCode.NRefactory.Cecil.csproj">
<Project>{2B8F4F83-C2B3-4E84-A27B-8DEE1BE0E006}</Project>
@@ -3099,17 +3099,13 @@
<Compile Include="MonoDevelop.Components.Extensions\TextQuestionDialog.cs" />
<Compile Include="MonoDevelop.Components.Extensions\ErrorDialog.cs" />
<Compile Include="MonoDevelop.Ide.Gui.Dialogs\GtkErrorDialog.cs" />
- <Compile Include="MonoDevelop.Ide.CodeFormatting\ICodeFormatter.cs" />
- <Compile Include="MonoDevelop.Ide.CodeFormatting\IAdvancedCodeFormatter.cs" />
<Compile Include="MonoDevelop.Ide.CodeFormatting\DefaultCodeFormatter.cs" />
<Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormatterExtensionNode.cs" />
- <Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormatter.cs" />
<Compile Include="MonoDevelop.Ide.Gui\GtkSynchronizationContext.cs" />
<Compile Include="MonoDevelop.Ide.Projects\NewPolicySetDialog.cs" />
<Compile Include="gtk-gui\MonoDevelop.Ide.Projects.NewPolicySetDialog.cs" />
<Compile Include="MonoDevelop.Components\HeaderBox.cs" />
<Compile Include="MonoDevelop.Ide.Extensions\StartupHandlerExtensionAttribute.cs" />
- <Compile Include="MonoDevelop.Ide.FindInFiles\ReferencesFinder.cs" />
<Compile Include="MonoDevelop.Components\SectionList.cs" />
<Compile Include="MonoDevelop.Ide.Projects\TemplatePickerWidget.cs" />
<Compile Include="MonoDevelop.Ide.Projects\NewProjectOptionsWidget.cs" />
@@ -3177,8 +3173,6 @@
<Compile Include="MonoDevelop.Components.Commands\CustomCommandTargetAttribute.cs" />
<Compile Include="MonoDevelop.Ide.Extensions\ServiceUrlExtensionNode.cs" />
<Compile Include="MonoDevelop.Ide\ProjectCreatedEventArgs.cs" />
- <Compile Include="MonoDevelop.Ide.FindInFiles\MemberCollector.cs" />
- <Compile Include="MonoDevelop.Ide.FindInFiles\SearchCollector.cs" />
<Compile Include="MonoDevelop.Ide.TypeSystem\TypeSystemService.cs" />
<Compile Include="MonoDevelop.Ide.TypeSystem\Ambience.cs" />
<Compile Include="MonoDevelop.Ide.TypeSystem\StockIcons.cs" />
@@ -3481,6 +3475,13 @@
<Compile Include="MonoDevelop.Components.AutoTest.Operations\TypeOperation.cs" />
<Compile Include="MonoDevelop.Components.AutoTest.Results\GtkTreeModelResult.cs" />
<Compile Include="MonoDevelop.Components.AutoTest.Results\GtkWidgetResult.cs" />
+ <Compile Include="MonoDevelop.Ide.CodeFormatting\AbstractCodeFormatter.cs" />
+ <Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormatter.cs" />
+ <Compile Include="MonoDevelop.Ide.TypeSystem\TypeSystemOutputTrackingNode.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor\TextEditorType.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor.Extension\AbstractBraceMatcher.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor.Extension\BraceMatcherTextEditorExtension.cs" />
+ <Compile Include="MonoDevelop.Ide.Editor.Extension\BraceMatchingResult.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />
diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.CodeTemplates.EditTemplateDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.CodeTemplates.EditTemplateDialog.cs
index 0754b6a148..72ee676759 100644
--- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.CodeTemplates.EditTemplateDialog.cs
+++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.CodeTemplates.EditTemplateDialog.cs
@@ -2,7 +2,7 @@
// This file has been generated by the GUI designer. Do not modify.
namespace MonoDevelop.Ide.CodeTemplates
{
- public partial class EditTemplateDialog
+ partial class EditTemplateDialog
{
private global::Gtk.HPaned hpaned1;
private global::Gtk.VBox vbox2;
diff --git a/main/tests/UnitTests/MonoDevelop.Ide.Editor/Commands/CodeCommentTests.cs b/main/tests/UnitTests/MonoDevelop.Ide.Editor/Commands/CodeCommentTests.cs
index 4ac482e082..f1b3803c02 100644
--- a/main/tests/UnitTests/MonoDevelop.Ide.Editor/Commands/CodeCommentTests.cs
+++ b/main/tests/UnitTests/MonoDevelop.Ide.Editor/Commands/CodeCommentTests.cs
@@ -202,6 +202,29 @@ namespace MonoDevelop.Ide.Editor
}");
}
+
+ [Test]
+ public void TestToggle_Bug()
+ {
+ var editor = CreateTextEditor (@"<-class Foo
+{
+ void Bar ()
+ {
+
+ }
+}
+->");
+ ((TextEditorViewContent)editor.GetViewContent ()).ToggleCodeComment ();
+ AssertEditorState (editor, @"//class Foo
+//{
+// void Bar ()
+// {
+
+// }
+//}
+");
+ }
+
}
}
diff --git a/main/tests/UnitTests/MonoDevelop.Ide.Editor/TextEditorProjectionTests.cs b/main/tests/UnitTests/MonoDevelop.Ide.Editor/TextEditorProjectionTests.cs
index 5cc9c56ce9..bacec6ff29 100644
--- a/main/tests/UnitTests/MonoDevelop.Ide.Editor/TextEditorProjectionTests.cs
+++ b/main/tests/UnitTests/MonoDevelop.Ide.Editor/TextEditorProjectionTests.cs
@@ -33,6 +33,14 @@ using MonoDevelop.CSharpBinding;
using UnitTests;
using MonoDevelop.CSharpBinding.Tests;
using System.Linq;
+using MonoDevelop.Ide.Editor.Highlighting;
+using MonoDevelop.Ide.Editor.Extension;
+using MonoDevelop.Ide.CodeCompletion;
+using System.Threading.Tasks;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Ide.Commands;
+using ICSharpCode.NRefactory.CSharp;
+using Gtk;
namespace MonoDevelop.Ide.Editor
{
@@ -46,7 +54,7 @@ namespace MonoDevelop.Ide.Editor
editor.Text = "1234567890";
var projectedDocument = TextEditorFactory.CreateNewDocument (
- new StringTextSource ("__12__34__56__78__90"),
+ new StringTextSource ("__12__34__56__78__90"),
"a"
);
@@ -65,13 +73,245 @@ namespace MonoDevelop.Ide.Editor
editor.InsertText (1, "foo");
Assert.AreEqual ("__1foo2__34__56__78__90", projectedEditor.Text);
- Assert.AreEqual (2 , projection.ProjectedSegments.ElementAt (0).ProjectedOffset);
+ Assert.AreEqual (2, projection.ProjectedSegments.ElementAt (0).ProjectedOffset);
Assert.AreEqual (2 + "foo".Length, projection.ProjectedSegments.ElementAt (0).Length);
for (int i = 1; i < 5; i++) {
Assert.AreEqual (2 + i * 4 + "foo".Length, projection.ProjectedSegments.ElementAt (i).ProjectedOffset);
Assert.AreEqual (2, projection.ProjectedSegments.ElementAt (i).Length);
}
+ }
+
+ [Test]
+ public void TestProjectionHighlighting ()
+ {
+ var editor = TextEditorFactory.CreateNewEditor ();
+ var options = new CustomEditorOptions (editor.Options);
+ options.ColorScheme = "Tango";
+ editor.Options = options;
+ editor.Text = "1234567890";
+
+ var projectedDocument = TextEditorFactory.CreateNewDocument (
+ new StringTextSource ("__12__34__56__78__90"),
+ "a"
+ );
+
+ var segments = new List<ProjectedSegment> ();
+ for (int i = 0; i < 5; i++) {
+ segments.Add (new ProjectedSegment (i * 2, 2 + i * 4, 2));
+ }
+ var projection = new Projection.Projection (projectedDocument, segments);
+ var tww = new TestWorkbenchWindow ();
+ var content = new TestViewContent ();
+ tww.ViewContent = content;
+
+ var originalContext = new Document (tww);
+ var projectedEditor = projection.CreateProjectedEditor (originalContext);
+ projectedEditor.SemanticHighlighting = new TestSemanticHighlighting (projectedEditor, originalContext);
+ editor.SetOrUpdateProjections (originalContext, new [] { projection }, TypeSystem.DisabledProjectionFeatures.None);
+
+ var markup = editor.GetPangoMarkup (0, editor.Length);
+ var color = "#75507B";
+ Assert.AreEqual ("<span foreground=\"" + color + "\">1</span><span foreground=\"#000000\">234</span><span foreground=\"" + color + "\">5</span><span foreground=\"#000000\">678</span><span foreground=\"" + color + "\">9</span><span foreground=\"#000000\">0</span>", markup);
+ }
+
+ class TestSemanticHighlighting : SemanticHighlighting
+ {
+ public TestSemanticHighlighting (MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext documentContext) : base (editor, documentContext)
+ {
+ }
+
+ public override IEnumerable<ColoredSegment> GetColoredSegments (ISegment segment)
+ {
+ for (int i = 0; i < segment.Length; i++) {
+ char ch = base.editor.GetCharAt (segment.Offset + i);
+ if (ch == '1' || ch == '5' || ch == '9')
+ yield return new ColoredSegment (segment.Offset + i, 1, ColorScheme.UserTypesKey);
+ }
+ }
+
+ protected override void DocumentParsed ()
+ {
+ }
+ }
+
+ [Test]
+ public void TestProjectionCompletion ()
+ {
+ var editor = TextEditorFactory.CreateNewEditor ();
+ var options = new CustomEditorOptions (editor.Options);
+ options.ColorScheme = "Tango";
+ editor.Options = options;
+ editor.Text = "12345678901234567890";
+
+ var projectedDocument = TextEditorFactory.CreateNewDocument (
+ new StringTextSource ("__12__34__56__78__90"),
+ "a"
+ );
+
+ var segments = new List<ProjectedSegment> ();
+ for (int i = 0; i < 5; i++) {
+ segments.Add (new ProjectedSegment (i * 2, 2 + i * 4, 2));
+ }
+ var projection = new Projection.Projection (projectedDocument, segments);
+ var tww = new TestWorkbenchWindow ();
+ var content = new TestViewContent ();
+ tww.ViewContent = content;
+
+ var originalContext = new Document (tww);
+ var projectedEditor = projection.CreateProjectedEditor (originalContext);
+ TestCompletionExtension orignalExtension;
+ editor.SetExtensionChain (originalContext, new [] { orignalExtension = new TestCompletionExtension (editor) });
+ TestCompletionExtension projectedExtension;
+ projectedEditor.SetExtensionChain (originalContext, new [] { projectedExtension = new TestCompletionExtension (editor) });
+
+ orignalExtension.CompletionWidget = new EmptyCompletionWidget (editor);
+ projectedExtension.CompletionWidget = new EmptyCompletionWidget (projectedEditor);
+
+ editor.SetOrUpdateProjections (originalContext, new [] { projection }, TypeSystem.DisabledProjectionFeatures.None);
+ editor.CaretOffset = 1;
+
+ var service = new CommandManager ();
+ service.LoadCommands ("/MonoDevelop/Ide/Commands");
+ service.DispatchCommand (TextEditorCommands.ShowCompletionWindow, null, editor.CommandRouter);
+ Assert.IsFalse (orignalExtension.CompletionRun);
+ Assert.IsTrue (projectedExtension.CompletionRun);
+
+ editor.CaretOffset = 15;
+
+ service.DispatchCommand (TextEditorCommands.ShowCompletionWindow, null, editor.CommandRouter);
+ Assert.IsTrue (orignalExtension.CompletionRun);
+ }
+
+ class TestCompletionExtension : CompletionTextEditorExtension
+ {
+ internal bool CompletionRun;
+
+ public TestCompletionExtension (TextEditor editor)
+ {
+ Editor = editor;
+ }
+
+ public override Task<ICompletionDataList> HandleCodeCompletionAsync (CodeCompletionContext completionContext, char completionChar, System.Threading.CancellationToken token)
+ {
+ CompletionRun = true;
+ var list = new CompletionDataList ();
+ list.Add ("foo");
+ return Task.FromResult<CodeCompletion.ICompletionDataList> (list);
+ }
+ public override bool CanRunCompletionCommand ()
+ {
+ return true;
+ }
+ }
+
+ class EmptyCompletionWidget : ICompletionWidget
+ {
+ TextEditor editor;
+
+ public EmptyCompletionWidget (TextEditor editor)
+ {
+ this.editor = editor;
+ }
+
+ int ICompletionWidget.CaretOffset
+ {
+ get
+ {
+ return 0;
+ }
+
+ set
+ {
+ }
+ }
+
+ CodeCompletionContext ICompletionWidget.CurrentCodeCompletionContext
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ Style ICompletionWidget.GtkStyle
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ int ICompletionWidget.SelectedLength
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ int ICompletionWidget.TextLength
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ double ICompletionWidget.ZoomLevel
+ {
+ get
+ {
+ return 1;
+ }
+ }
+
+ event EventHandler ICompletionWidget.CompletionContextChanged
+ {
+ add
+ {
+ }
+
+ remove
+ {
+ }
+ }
+
+ void ICompletionWidget.AddSkipChar (int cursorPosition, char c)
+ {
+ }
+
+ CodeCompletionContext ICompletionWidget.CreateCodeCompletionContext (int triggerOffset)
+ {
+ return new CodeCompletionContext () { TriggerOffset = editor.CaretOffset };
+ }
+
+ char ICompletionWidget.GetChar (int offset)
+ {
+ return 'a';
+ }
+
+ string ICompletionWidget.GetCompletionText (CodeCompletionContext ctx)
+ {
+ return "";
+ }
+
+ string ICompletionWidget.GetText (int startOffset, int endOffset)
+ {
+ return "";
+ }
+
+ void ICompletionWidget.Replace (int offset, int count, string text)
+ {
+ }
+
+ void ICompletionWidget.SetCompletionText (CodeCompletionContext ctx, string partial_word, string complete_word)
+ {
+ }
+
+ void ICompletionWidget.SetCompletionText (CodeCompletionContext ctx, string partial_word, string complete_word, int completeWordOffset)
+ {
+ }
}
}
}
diff --git a/main/tests/UnitTests/UnitTests.csproj b/main/tests/UnitTests/UnitTests.csproj
index 30bf56f8c2..cf3e7d565d 100644
--- a/main/tests/UnitTests/UnitTests.csproj
+++ b/main/tests/UnitTests/UnitTests.csproj
@@ -69,16 +69,16 @@
<HintPath>..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis">
- <HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
+ <HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop">
- <HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
+ <HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces">
- <HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
+ <HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop">
- <HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc1\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
+ <HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
diff --git a/main/tests/UnitTests/packages.config b/main/tests/UnitTests/packages.config
index f8f771207f..68b89e64cb 100644
--- a/main/tests/UnitTests/packages.config
+++ b/main/tests/UnitTests/packages.config
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc1" targetFramework="net45" />
- <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc1" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" />
+ <package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" />
-</packages> \ No newline at end of file
+</packages>