From 17294bb067ec87e2dccfc3e9f13ea1a0b8247587 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sun, 27 Dec 2015 15:14:16 +0100 Subject: [PATCH 1/4] Update AvalonEdit and re-enable CSharpFormattingTests. --- .../CSharpBinding/Tests/CSharpFormattingTests.cs | 1 - src/Libraries/AvalonEdit | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpFormattingTests.cs b/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpFormattingTests.cs index 46d683e859..1ba6378a7a 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpFormattingTests.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpFormattingTests.cs @@ -26,7 +26,6 @@ namespace CSharpBinding.Tests public class CSharpFormattingTests { [Test] - [Ignore("AvalonEdit indentation changed")] public void EnterInsideString() { const string start = "class X {\n" + diff --git a/src/Libraries/AvalonEdit b/src/Libraries/AvalonEdit index 4e69c3cbc5..19611add5a 160000 --- a/src/Libraries/AvalonEdit +++ b/src/Libraries/AvalonEdit @@ -1 +1 @@ -Subproject commit 4e69c3cbc51ddf1ac47030abf0c4caac520d23cf +Subproject commit 19611add5ac9fea77a41a145fc85211c6c32f921 From 645ef5d6cb8d438a60cf5e9c2fe2d8ff932cfa27 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 14 Dec 2015 15:57:03 +0200 Subject: [PATCH 2/4] Fix scoping issue with the code completion suggestions list Fixes the following issue with code completion. class Foo { public void Bar() {} } var foo = new Foo(); foo. ^ Pressing Ctrl+Space here makes the code completion window show itself. The completions list contains the type names from the 'global' scope whereas it should contain only the list of Foo's members. Cherry-picked from pull request #730 --- .../Src/Completion/CSharpCompletionBinding.cs | 4 +++- .../Src/Completion/CSharpCompletionContext.cs | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs index 9bdc24c826..01af3ab3d0 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionBinding.cs @@ -129,7 +129,9 @@ namespace CSharpBinding.Completion triggerWordLength = 0; } completionData = cce.GetCompletionData(startPos, true); - completionData = completionData.Concat(cce.GetImportCompletionData(startPos)); + if (!completionContext.OnlyTypeMembersFitAtPosition(startPos)) { + completionData = completionData.Concat(cce.GetImportCompletionData(startPos)); + } } else { startPos = caretOffset; if (char.IsLetterOrDigit (completionChar) || completionChar == '_') { diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs index 2f4623dcf7..5ad49fb12f 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpCompletionContext.cs @@ -80,6 +80,30 @@ namespace CSharpBinding.Completion return new CSharpCompletionContext(editor, EmptyList.Instance, compilation, projectContent, document, unresolvedFile, currentLocation); } + + /// + /// Look back for the nearest char that is not a part of an identifier or a whitespace. + /// (We don't stop on whitespaces because it is legal to have a piece of code like "Foo. Bar(). Baz()") + /// If the char we found is a dot, then the code completion suggestions should only include type members, + /// but not types from the outer scope. + /// If the char we found is not a dot (e. g., a semicolon), then the code completion suggestions can include type names. + /// + internal bool OnlyTypeMembersFitAtPosition(int offset) + { + var c = '\0'; + var pos = offset - 1; + while (pos >= 0) { + c = Document.GetCharAt(pos); + if (!char.IsLetterOrDigit(c) && c != '_' && !char.IsWhiteSpace(c)) + break; + pos--; + } + + if (pos == -1 || c != '.') + return false; + + return true; + } private CSharpCompletionContext(ITextEditor editor, IList conditionalSymbols, ICompilation compilation, IProjectContent projectContent, IDocument document, CSharpUnresolvedFile unresolvedFile, TextLocation caretLocation) { From 99c84e1f1062b4ced800ec745e4042ee1a0ec165 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 30 Dec 2015 16:17:35 +0100 Subject: [PATCH 3/4] For consistency with VS, use lower-case GUIDs for project references. --- .../Project/Src/Project/Items/ProjectReferenceProjectItem.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Main/Base/Project/Src/Project/Items/ProjectReferenceProjectItem.cs b/src/Main/Base/Project/Src/Project/Items/ProjectReferenceProjectItem.cs index e72df4147d..cbb434218b 100644 --- a/src/Main/Base/Project/Src/Project/Items/ProjectReferenceProjectItem.cs +++ b/src/Main/Base/Project/Src/Project/Items/ProjectReferenceProjectItem.cs @@ -55,7 +55,7 @@ namespace ICSharpCode.SharpDevelop.Project return Guid.Empty; } set { - SetEvaluatedMetadata("Project", value.ToString("B").ToUpperInvariant()); + SetEvaluatedMetadata("Project", value.ToString("B")); } } From d6ebb706527295fbc7e003458dff9bdae1688ffc Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 30 Dec 2015 16:31:48 +0100 Subject: [PATCH 4/4] Fix project reference GUIDs. --- src/AddIns/Analysis/CodeQuality/CodeQuality.csproj | 2 +- .../Analysis/Profiler/Controller/Profiler.Controller.csproj | 2 +- src/AddIns/Analysis/UnitTesting/Test/UnitTesting.Tests.csproj | 2 +- .../BackendBindings/CSharpBinding/Project/CSharpBinding.csproj | 2 +- .../CSharpBinding/Tests/CSharpBinding.Tests.csproj | 2 +- src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj | 2 +- .../BackendBindings/WixBinding/Test/WixBinding.Tests.csproj | 2 +- .../XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj | 2 +- src/AddIns/Debugger/Debugger.Core/Debugger.Core.csproj | 2 +- .../Cmdlets/Project/PackageManagement.Cmdlets.csproj | 2 +- .../Cmdlets/Test/PackageManagement.Cmdlets.Tests.csproj | 2 +- .../Misc/PackageManagement/Project/PackageManagement.csproj | 2 +- .../Misc/PackageManagement/Test/PackageManagement.Tests.csproj | 2 +- src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj | 2 +- src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj | 2 +- src/Main/SharpDevelop/SharpDevelop.csproj | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/AddIns/Analysis/CodeQuality/CodeQuality.csproj b/src/AddIns/Analysis/CodeQuality/CodeQuality.csproj index 6f26ee88e3..2d9b18d010 100644 --- a/src/AddIns/Analysis/CodeQuality/CodeQuality.csproj +++ b/src/AddIns/Analysis/CodeQuality/CodeQuality.csproj @@ -134,7 +134,7 @@ False - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil False diff --git a/src/AddIns/Analysis/Profiler/Controller/Profiler.Controller.csproj b/src/AddIns/Analysis/Profiler/Controller/Profiler.Controller.csproj index 2d0341be84..ab9dbf6b09 100644 --- a/src/AddIns/Analysis/Profiler/Controller/Profiler.Controller.csproj +++ b/src/AddIns/Analysis/Profiler/Controller/Profiler.Controller.csproj @@ -173,7 +173,7 @@ - {600D7F63-DACE-4933-BE8C-B51A948A86D4} + {fe88fe17-d9fb-4fcc-9a35-6bffb6b26cc6} Profiler.X64Converter false diff --git a/src/AddIns/Analysis/UnitTesting/Test/UnitTesting.Tests.csproj b/src/AddIns/Analysis/UnitTesting/Test/UnitTesting.Tests.csproj index 95fc8bef73..bc766505b4 100644 --- a/src/AddIns/Analysis/UnitTesting/Test/UnitTesting.Tests.csproj +++ b/src/AddIns/Analysis/UnitTesting/Test/UnitTesting.Tests.csproj @@ -104,7 +104,7 @@ - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj index 848785d6fb..acc35ef79a 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj @@ -256,7 +256,7 @@ False - {9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} + {7d7e92df-aceb-4b69-92c8-8ac7a703cd57} FormsDesigner False diff --git a/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj b/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj index 1a16e6f6fc..8fb7b71dd2 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/CSharpBinding/Tests/CSharpBinding.Tests.csproj @@ -82,7 +82,7 @@ ICSharpCode.AvalonEdit - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil diff --git a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj index 348ec9064b..b06fa68c2e 100644 --- a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj +++ b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj @@ -253,7 +253,7 @@ False - {9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} + {7d7e92df-aceb-4b69-92c8-8ac7a703cd57} FormsDesigner False diff --git a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj index d2ecd43381..943b10c1c1 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj @@ -323,7 +323,7 @@ ICSharpCode.Core.WinForms - {9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} + {7d7e92df-aceb-4b69-92c8-8ac7a703cd57} FormsDesigner diff --git a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj index 08f6639296..8fb11dcd56 100644 --- a/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj @@ -94,7 +94,7 @@ ICSharpCode.AvalonEdit - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil diff --git a/src/AddIns/Debugger/Debugger.Core/Debugger.Core.csproj b/src/AddIns/Debugger/Debugger.Core/Debugger.Core.csproj index 339f3f07b8..82e5a671a8 100644 --- a/src/AddIns/Debugger/Debugger.Core/Debugger.Core.csproj +++ b/src/AddIns/Debugger/Debugger.Core/Debugger.Core.csproj @@ -132,7 +132,7 @@ False - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil False diff --git a/src/AddIns/Misc/PackageManagement/Cmdlets/Project/PackageManagement.Cmdlets.csproj b/src/AddIns/Misc/PackageManagement/Cmdlets/Project/PackageManagement.Cmdlets.csproj index 751e9f54e6..5898e1a48f 100644 --- a/src/AddIns/Misc/PackageManagement/Cmdlets/Project/PackageManagement.Cmdlets.csproj +++ b/src/AddIns/Misc/PackageManagement/Cmdlets/Project/PackageManagement.Cmdlets.csproj @@ -87,7 +87,7 @@ False - {6FB1260D-68A2-41A0-BB09-F5F710842E99} + {1b753d7f-7c77-4d5e-b928-02982690879c} SharpDevelop.EnvDTE False diff --git a/src/AddIns/Misc/PackageManagement/Cmdlets/Test/PackageManagement.Cmdlets.Tests.csproj b/src/AddIns/Misc/PackageManagement/Cmdlets/Test/PackageManagement.Cmdlets.Tests.csproj index f080ea140e..49e818bb80 100644 --- a/src/AddIns/Misc/PackageManagement/Cmdlets/Test/PackageManagement.Cmdlets.Tests.csproj +++ b/src/AddIns/Misc/PackageManagement/Cmdlets/Test/PackageManagement.Cmdlets.Tests.csproj @@ -86,7 +86,7 @@ PackageManagement - {6FB1260D-68A2-41A0-BB09-F5F710842E99} + {1b753d7f-7c77-4d5e-b928-02982690879c} SharpDevelop.EnvDTE diff --git a/src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj b/src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj index 4492f3f264..3a9259c3fb 100644 --- a/src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj +++ b/src/AddIns/Misc/PackageManagement/Project/PackageManagement.csproj @@ -569,7 +569,7 @@ PackageManagement.PowerShell - {6FB1260D-68A2-41A0-BB09-F5F710842E99} + {1b753d7f-7c77-4d5e-b928-02982690879c} SharpDevelop.EnvDTE False diff --git a/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj b/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj index 651acc6173..91ebb9fb02 100644 --- a/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj +++ b/src/AddIns/Misc/PackageManagement/Test/PackageManagement.Tests.csproj @@ -393,7 +393,7 @@ PackageManagement - {6FB1260D-68A2-41A0-BB09-F5F710842E99} + {1b753d7f-7c77-4d5e-b928-02982690879c} SharpDevelop.EnvDTE diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index 9b6aae22e8..5d66a4ac4e 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -946,7 +946,7 @@ False - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil False diff --git a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj index c61d9534b4..92321c0b2e 100644 --- a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj +++ b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj @@ -161,7 +161,7 @@ ICSharpCode.AvalonEdit - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil diff --git a/src/Main/SharpDevelop/SharpDevelop.csproj b/src/Main/SharpDevelop/SharpDevelop.csproj index c28c87fe62..02db097b4f 100644 --- a/src/Main/SharpDevelop/SharpDevelop.csproj +++ b/src/Main/SharpDevelop/SharpDevelop.csproj @@ -277,7 +277,7 @@ Mono.Cecil - {B2BBC7BC-837C-40ED-A6DB-D5AE8626212F} + {2b8f4f83-c2b3-4e84-a27b-8dee1be0e006} ICSharpCode.NRefactory.Cecil