Browse Source

[Completion] Fixed type 'overloads'.

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

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

@ -80,22 +80,25 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -80,22 +80,25 @@ 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;
var def = type.GetDefinition ();
if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable ())
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