提交 39f9cdbb 编写于 作者: G Gen Lu

Mark unimported attribute item as "expanded" when in attribute context

上级 4a2d1466
......@@ -13,8 +13,8 @@ internal enum CompletionItemFlags
/// <summary>
/// Indicates this <see cref="CompletionItem"/> is cached and reused across completion sessions.
/// This might be used by completion system for things like deciding whether it can safaly cache and reuse
/// other data correspodning to this item.
/// This might be used by completion system for things like deciding whether it can safely cache and reuse
/// other data corresponding to this item.
///
/// TODO: Revisit the approach we used for caching VS items.
/// https://github.com/dotnet/roslyn/issues/35160
......
......@@ -87,7 +87,7 @@ static CompletionItem GetAppropriateAttributeItem(CompletionItem attributeItem,
if (attributeItem.DisplayText.TryGetWithoutAttributeSuffix(isCaseSensitive: isCaseSensitive, out var attributeNameWithoutSuffix))
{
// We don't want to cache this item.
return ImportCompletionItem.CreateAttributeItemWithoutSuffix(attributeItem, attributeNameWithoutSuffix);
return ImportCompletionItem.CreateAttributeItemWithoutSuffix(attributeItem, attributeNameWithoutSuffix, CompletionItemFlags.Expanded);
}
return attributeItem;
......
......@@ -68,7 +68,7 @@ public static CompletionItem Create(string name, int arity, string containingNam
return item;
}
public static CompletionItem CreateAttributeItemWithoutSuffix(CompletionItem attributeItem, string attributeNameWithoutSuffix)
public static CompletionItem CreateAttributeItemWithoutSuffix(CompletionItem attributeItem, string attributeNameWithoutSuffix, CompletionItemFlags flags)
{
Debug.Assert(!attributeItem.Properties.ContainsKey(AttributeFullName));
......@@ -78,7 +78,7 @@ public static CompletionItem CreateAttributeItemWithoutSuffix(CompletionItem att
var sortTextBuilder = PooledStringBuilder.GetInstance();
sortTextBuilder.Builder.AppendFormat(SortTextFormat, attributeNameWithoutSuffix, attributeItem.InlineDescription);
return CompletionItem.Create(
var item = CompletionItem.Create(
displayText: attributeNameWithoutSuffix,
sortText: sortTextBuilder.ToStringAndFree(),
properties: newProperties,
......@@ -87,6 +87,9 @@ public static CompletionItem CreateAttributeItemWithoutSuffix(CompletionItem att
displayTextPrefix: attributeItem.DisplayTextPrefix,
displayTextSuffix: attributeItem.DisplayTextSuffix,
inlineDescription: attributeItem.InlineDescription);
item.Flags = flags;
return item;
}
public static CompletionItem CreateItemWithGenericDisplaySuffix(CompletionItem item, string genericTypeSuffix)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册