Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed enum context.

  • Loading branch information...
commit e69e9f13f53f9ba87e0eea9422a795587952f627 1 parent bf3a1d7
@mkrueger mkrueger authored
View
2  ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
@@ -575,7 +575,7 @@ IEnumerable<ICompletionData> MagicKeyCompletion (char completionChar, bool contr
IEnumerable<ICompletionData> HandleEnumContext ()
{
- var cu = ParseStub ("enumMefwefwefwember", false);
+ var cu = ParseStub ("a", false);
if (cu == null)
return null;
var member = cu.GetNodeAt<EnumMemberDeclaration> (location);
View
4 ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs
@@ -312,15 +312,13 @@ protected CompilationUnit ParseStub (string continuation, bool appendSemicolon =
wrapper.Append ('}');
TextLocation memberLocation;
- if (currentMember != null) {
+ if (currentMember != null && currentType.Kind != TypeKind.Enum) {
memberLocation = currentMember.Region.Begin;
} else if (currentType != null) {
memberLocation = currentType.Region.Begin;
} else {
memberLocation = new TextLocation (1, 1);
}
- Console.WriteLine ("--");
- Console.WriteLine (wrapper);
using (var stream = new System.IO.StringReader (wrapper.ToString ())) {
try {
var parser = new CSharpParser ();
View
18 ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/EnumContextTests.cs
@@ -77,5 +77,23 @@ enum Name {
Assert.IsNotNull (provider.Find ("Name"), "type 'Name' not found.");
});
}
+
+
+ [Test()]
+ public void TestEnumInitializerContinuation ()
+ {
+ CodeCompletionBugTests.CombinedProviderTest (
+@"using System;
+[Flags]
+enum Name {
+ Flag1,
+ Flag2,
+ Combined $= Name.$
+}
+", provider => {
+ Assert.IsNotNull (provider.Find ("Flag1"), "value 'Flag1' not found.");
+ Assert.IsNotNull (provider.Find ("Flag2"), "value 'Flag2' not found.");
+ });
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.