Browse Source

Fixed code completion bug "Bug 1932 - [new resolver] fields don't show

up unless prefixed with 'this.'".
newNRvisualizers
Mike Krüger 15 years ago
parent
commit
4a41972dfa
  1. 1
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 33
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

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

@ -691,7 +691,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -691,7 +691,6 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
void AddTypesAndNamespaces (CompletionDataWrapper wrapper, CSharpResolver state, AstNode node, Predicate<ITypeDefinition> typePred = null, Predicate<IMember> memberPred = null)
{
var currentType = state.CurrentTypeDefinition ?? this.currentType;
var currentMember = state.CurrentMember ?? this.currentMember;
if (currentType != null) {
for (var ct = currentType; ct != null; ct = ct.DeclaringTypeDefinition) {

33
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

@ -892,6 +892,39 @@ namespace MyNamespace @@ -892,6 +892,39 @@ namespace MyNamespace
Assert.IsNotNull (provider.Find ("Bar"), "method 'Bar' not found.");
}
/// <summary>
/// Bug 1932 - [new resolver] fields don't show up unless prefixed with 'this.'
/// </summary>
[Test()]
public void TestBug1932 ()
{
CombinedProviderTest (
@"
namespace MyNamespace
{
partial class FormMain
{
int field1;
string field2;
}
}
namespace MyNamespace
{
public partial class FormMain
{
private void Bar()
{
$f$
}
}
}
", provider => {
Assert.IsNotNull (provider.Find ("field1"), "field 'field1' not found.");
Assert.IsNotNull (provider.Find ("field2"), "field 'field2' not found.");
});
}
/// <summary>
/// Bug 432434 - Code completion doesn't work with subclasses
/// </summary>

Loading…
Cancel
Save