Browse Source

Fixed pre processor completion bug.

pull/32/merge
Mike Krüger 13 years ago
parent
commit
320f93990b
  1. 3
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs
  2. 11
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs

3
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs

@ -349,8 +349,9 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
if (nextCh == '/') { if (nextCh == '/') {
i++; i++;
IsInSingleComment = true; IsInSingleComment = true;
IsInPreprocessorDirective = false;
} }
if (nextCh == '*') if (nextCh == '*' && !IsInPreprocessorDirective)
IsInMultiLineComment = true; IsInMultiLineComment = true;
break; break;
case '*': case '*':

11
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs

@ -90,5 +90,16 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion
provider = CodeCompletionBugTests.CreateProvider (@"$#if TRUE && $", true); provider = CodeCompletionBugTests.CreateProvider (@"$#if TRUE && $", true);
Assert.IsNotNull (provider.Find ("DEBUG"), "define 'DEBUG' not found."); Assert.IsNotNull (provider.Find ("DEBUG"), "define 'DEBUG' not found.");
} }
/// <summary>
/// Bug 10294 - Comments in preprocessor directives are not handler correctly
/// </summary>
[Test]
public void TestBug10294 ()
{
var provider = CodeCompletionBugTests.CreateProvider (@"$#if TRUE // D$",true);
Assert.IsTrue (provider == null || provider.Count == 0);
}
} }
} }

Loading…
Cancel
Save