Skip to content

Commit 6e7237e

Browse files
committed
added AsTypeName to the context-sensitive commandbar (#1578)
1 parent 9094707 commit 6e7237e

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

RetailCoder.VBE/UI/Command/MenuItems/RubberduckCommandBar.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Diagnostics;
3+
using Castle.Core.Internal;
34
using Microsoft.Office.Core;
45
using Microsoft.Vbe.Interop;
56
using Rubberduck.Parsing.Symbols;
@@ -58,25 +59,28 @@ public void SetSelectionText(Declaration declaration)
5859
}
5960
else if (declaration != null && !declaration.IsBuiltIn && declaration.DeclarationType != DeclarationType.ClassModule && declaration.DeclarationType != DeclarationType.ProceduralModule)
6061
{
61-
_selectionButton.Caption = string.Format("{0} ({1}): {2} ({3})",
62-
declaration.QualifiedName.QualifiedModuleName,
62+
_selectionButton.Caption = string.Format("{0}|{1}: {2} ({3}{4})",
6363
declaration.QualifiedSelection.Selection,
64+
declaration.QualifiedName.QualifiedModuleName,
6465
declaration.IdentifierName,
65-
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType));
66+
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType),
67+
string.IsNullOrEmpty(declaration.AsTypeName) ? string.Empty : ": " + declaration.AsTypeName);
6668
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
6769
? _selectionButton.Caption
6870
: declaration.DescriptionString;
6971
}
7072
else if (declaration != null)
7173
{
74+
// todo: confirm this is what we want, and then refator
7275
var selection = _vbe.ActiveCodePane.GetQualifiedSelection();
7376
if (selection.HasValue)
7477
{
75-
_selectionButton.Caption = string.Format("{0}: {1} ({2}) {3}",
78+
_selectionButton.Caption = string.Format("{0}|{1}: {2} ({3}{4})",
79+
selection.Value.Selection,
7680
declaration.QualifiedName.QualifiedModuleName,
7781
declaration.IdentifierName,
7882
RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType),
79-
selection.Value.Selection);
83+
string.IsNullOrEmpty(declaration.AsTypeName) ? string.Empty : ": " + declaration.AsTypeName);
8084
}
8185
_selectionButton.TooltipText = string.IsNullOrEmpty(declaration.DescriptionString)
8286
? _selectionButton.Caption

0 commit comments

Comments
 (0)