diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs index 37d82e974b..4d2f7c69cc 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs @@ -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); diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs index f71373e9a7..727919a030 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/KeywordTests.cs @@ -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.");