diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs b/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs index b0dd18918a..16368ae4fe 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs @@ -80,7 +80,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion result.Add (Factory.CreateLiteralCompletionData (alias)); } - Dictionary usedTypes = new Dictionary (); + Dictionary usedTypes = new Dictionary (); 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()) return null; ICompletionData usedType; - if (usedTypes.TryGetValue (type, out usedType)) { - usedType.AddOverload (Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext)); + var data = Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext); + var text = data.DisplayText; + + if (usedTypes.TryGetValue(text, out usedType)) { + usedType.AddOverload(data); return usedType; } - var iCompletionData = Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext); - usedTypes[type] = iCompletionData; - result.Add(iCompletionData); - return iCompletionData; + usedTypes [text] = data; + result.Add(data); + return data; } Dictionary> data = new Dictionary> ();