Browse Source

[Completion] Fixed type 'overloads'.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
4e8b01df03
  1. 13
      ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs

13
ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs

@ -80,12 +80,11 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -80,12 +80,11 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
result.Add (Factory.CreateLiteralCompletionData (alias));
}
HashSet<string> usedTypes = new HashSet<string> ();
Dictionary<string, ICompletionData> usedTypes = new Dictionary<string, ICompletionData> ();
public ICompletionData AddType(IType type, string shortType)
{
if (type == null || string.IsNullOrEmpty(shortType) || usedTypes.Contains(shortType))
if (type == null || string.IsNullOrEmpty(shortType))
return null;
if (type.Name == "Void" && type.Namespace == "System")
return null;
@ -93,9 +92,13 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -93,9 +92,13 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
var def = type.GetDefinition();
if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable())
return null;
usedTypes.Add(shortType);
ICompletionData usedType;
if (usedTypes.TryGetValue (shortType, out usedType)) {
usedType.AddOverload (Factory.CreateTypeCompletionData(type, shortType));
return usedType;
}
var iCompletionData = Factory.CreateTypeCompletionData(type, shortType);
usedTypes[shortType] = iCompletionData;
result.Add(iCompletionData);
return iCompletionData;
}

Loading…
Cancel
Save