diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs b/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs index af3fdd5217..c4eff72e6a 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CompletionDataWrapper.cs @@ -95,13 +95,15 @@ namespace ICSharpCode.NRefactory.CSharp.Completion } Dictionary typeDisplayText = new Dictionary (); - Dictionary addedTypes = new Dictionary (); + Dictionary addedTypes = new Dictionary (); public ICompletionData AddType(IType type, bool showFullName, bool isInAttributeContext = false) { if (type == null) throw new ArgumentNullException("type"); if (type.Name == "Void" && type.Namespace == "System" || type.Kind == TypeKind.Unknown) return null; + if (addedTypes.ContainsKey (type)) + return addedTypes[type]; var def = type.GetDefinition(); if (def != null && def.ParentAssembly != completion.ctx.CurrentAssembly && !def.IsBrowsable()) @@ -110,18 +112,13 @@ namespace ICSharpCode.NRefactory.CSharp.Completion var data = Factory.CreateTypeCompletionData(type, showFullName, isInAttributeContext); var text = data.DisplayText; - var reflectionName = text + "~" + type.TypeParameterCount; - if (addedTypes.ContainsKey(reflectionName)) - return addedTypes[reflectionName]; - - if (typeDisplayText.TryGetValue(text, out usedType)) { usedType.AddOverload(data); return usedType; } typeDisplayText [text] = data; result.Add(data); - addedTypes[reflectionName] = data; + addedTypes[type] = data; return data; }