提交 3c04bf0a 编写于 作者: C Cyrus Najmabadi

If an item has child items, then use its display name, otherwise use the standard display.

上级 7cf4e3b1
......@@ -22,7 +22,9 @@ where IsValidSourceLocation(item.Document, item.SourceSpan)
private AbstractTreeItem CreateTreeItem(INavigableItem item)
{
var result = new SourceReferenceTreeItem(item.Document, item.SourceSpan, item.Glyph.GetGlyphIndex());
var displayText = !item.ChildItems.IsEmpty ? item.DisplayName : null;
var result = new SourceReferenceTreeItem(item.Document, item.SourceSpan, item.Glyph.GetGlyphIndex(), displayText);
if (!item.ChildItems.IsEmpty)
{
var childItems = CreateGoToDefinitionItems(item.ChildItems);
......
......@@ -8,27 +8,24 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Library.FindRes
{
internal class SourceReferenceTreeItem : AbstractSourceTreeItem, IComparable<SourceReferenceTreeItem>
{
public SourceReferenceTreeItem(Location location, Solution solution, ushort glyphIndex)
: this(solution.GetDocument(location.SourceTree), location.SourceSpan, glyphIndex)
{
}
public SourceReferenceTreeItem(Document document, TextSpan sourceSpan, ushort glyphIndex)
: this(document, sourceSpan, glyphIndex, includeProjectNameDisambiguator: false)
{
}
public SourceReferenceTreeItem(Document document, TextSpan sourceSpan, ushort glyphIndex, bool includeProjectNameDisambiguator)
public SourceReferenceTreeItem(Document document, TextSpan sourceSpan, ushort glyphIndex, string displayText = null)
: base(document, sourceSpan, glyphIndex)
{
SetDisplayProperties(
_filePath,
_mappedLineNumber,
_mappedOffset,
_offset,
_textLineString,
sourceSpan.Length,
projectNameDisambiguator: string.Empty);
if (displayText != null)
{
this.DisplayText = displayText;
}
else
{
SetDisplayProperties(
_filePath,
_mappedLineNumber,
_mappedOffset,
_offset,
_textLineString,
sourceSpan.Length,
projectNameDisambiguator: string.Empty);
}
}
public override bool UseGrayText
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册