Browse Source

[Completion] Types with different type parameters are now added as

overloads again.
newNRvisualizers
Mike Krüger 14 years ago
parent
commit
43641dc5a1
  1. 16
      ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs

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

@ -80,7 +80,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
result.Add (Factory.CreateLiteralCompletionData (alias)); result.Add (Factory.CreateLiteralCompletionData (alias));
} }
Dictionary<IType, ICompletionData> usedTypes = new Dictionary<IType, ICompletionData> (); Dictionary<string, ICompletionData> usedTypes = new Dictionary<string, ICompletionData> ();
public ICompletionData AddType(IType type, bool showFullName, bool isInAttributeContext = false) public ICompletionData AddType(IType type, bool showFullName, bool isInAttributeContext = false)
{ {
@ -93,14 +93,16 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable()) if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable())
return null; return null;
ICompletionData usedType; ICompletionData usedType;
if (usedTypes.TryGetValue (type, out usedType)) { var data = Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext);
usedType.AddOverload (Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext)); var text = data.DisplayText;
if (usedTypes.TryGetValue(text, out usedType)) {
usedType.AddOverload(data);
return usedType; return usedType;
} }
var iCompletionData = Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext); usedTypes [text] = data;
usedTypes[type] = iCompletionData; result.Add(data);
result.Add(iCompletionData); return data;
return iCompletionData;
} }
Dictionary<string, List<ICompletionData>> data = new Dictionary<string, List<ICompletionData>> (); Dictionary<string, List<ICompletionData>> data = new Dictionary<string, List<ICompletionData>> ();

Loading…
Cancel
Save