提交 52f6acff 编写于 作者: C CyrusNajmabadi

Inline method.

上级 01351b1d
......@@ -12,8 +12,8 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.FindReferences
internal sealed class DefinitionItem
{
/// <summary>
/// Descriptive tags from <see cref="CompletionTags"/>.
/// These tags may influence how the item is displayed.
/// Descriptive tags from <see cref="CompletionTags"/>. These tags may influence how the
/// item is displayed.
/// </summary>
public ImmutableArray<string> Tags { get; }
......@@ -23,21 +23,20 @@ internal sealed class DefinitionItem
public ImmutableArray<TaggedText> DisplayParts { get; }
/// <summary>
/// The locations to present in the UI. A definition may have multiple locations
/// for cases like partial types/members.
/// The locations to present in the UI. A definition may have multiple locations for cases
/// like partial types/members.
/// </summary>
public ImmutableArray<DefinitionLocation> Locations { get; }
/// <summary>
/// Whether or not this definition should be presented if we never found any
/// references to it. For example, when searching for a property, the Find
/// References enginer will cascade to the accessors in case any code specifically
/// called those accessors (can happen in cross language cases). However, in the
/// normal case where there were no calls specifically to the accessor, we would
/// not want to display them in the UI.
/// Whether or not this definition should be presented if we never found any references to
/// it. For example, when searching for a property, the FindReferences engine will cascade
/// to the accessors in case any code specifically called those accessors (can happen in
/// cross-language cases). However, in the normal case where there were no calls specifically
/// to the accessor, we would not want to display them in the UI.
///
/// For most definitions we will want to display them, even if no references were
/// found. This property allows for this customization in behavior.
/// For most definitions we will want to display them, even if no references were found.
/// This property allows for this customization in behavior.
/// </summary>
public bool DisplayIfNoReferences { get; }
......
......@@ -60,8 +60,8 @@ public void PresentDefinitionsAndReferences(DefinitionsAndReferences definitions
// Each definition item may end up as several top nodes (because of partials).
// Add the references to the last item actually in the list.
var definitionTreeItem = i == n - 1
? new DefinitionTreeItem(definitionItem, location)
: new DefinitionTreeItem(definitionItem, location, referenceItems);
? new DefinitionTreeItem(definitionItem, location, referenceItems)
: new DefinitionTreeItem(definitionItem, location);
result.Add(definitionTreeItem);
}
......
......@@ -45,18 +45,14 @@ private string CreateDisplayText()
// results that tell us about their definition location, but not any additional
// reference. We don't want to say '0' references in that case as that can
// be misleading.
return HasOrigination()
var hasOrigination = _definitionLocation.OriginationParts.Length > 0;
return hasOrigination
? $"[{_definitionLocation.OriginationParts.JoinText()}] {displayString} ({referenceCountDisplay})"
: referenceCount > 0
? $"{displayString} ({referenceCountDisplay})"
: displayString;
}
private bool HasOrigination()
{
return _definitionLocation.OriginationParts.Length > 0;
}
public override int GoToSource()
{
return _definitionLocation.TryNavigateTo()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册