Browse Source

[Completion] Fixed bug in indexer context.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
057818f135
  1. 2
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 18
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs

2
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs

@ -1058,7 +1058,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -1058,7 +1058,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
node = node.Parent;
}
var contextList = new CompletionDataWrapper(this);
if (node is PropertyDeclaration) {
if (node is PropertyDeclaration || node is IndexerDeclaration) {
contextList.AddCustom("get");
contextList.AddCustom("set");
AddKeywords(contextList, accessorModifierKeywords);

18
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs

@ -145,11 +145,27 @@ class Test @@ -145,11 +145,27 @@ class Test
public void GetSetKeywordTest ()
{
CodeCompletionBugTests.CombinedProviderTest (
@"class Test
@"class Test
{
public int MyProperty {
$g$
}
", provider => {
Assert.IsNotNull (provider.Find ("public"), "keyword 'public' not found.");
Assert.IsNotNull (provider.Find ("get"), "keyword 'get' not found.");
Assert.IsNotNull (provider.Find ("set"), "keyword 'set' not found.");
});
}
[Test()]
public void GetSetKeywordIndexerCaseTest ()
{
CodeCompletionBugTests.CombinedProviderTest (
@"class Test
{
public int this[int i] {
$g$
}
", provider => {
Assert.IsNotNull (provider.Find ("public"), "keyword 'public' not found.");
Assert.IsNotNull (provider.Find ("get"), "keyword 'get' not found.");

Loading…
Cancel
Save