Skip to content

Commit 256575a

Browse files
authored
Merge pull request #6041 from tommy9/PublicEnumNotUpdatinginCE#5849
Change enum signature to be updatable in code explorer
2 parents 9453e46 + 04f0ea5 commit 256575a

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Rubberduck.Core/Navigation/CodeExplorer/CodeExplorerSubMemberViewModel.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ public sealed class CodeExplorerSubMemberViewModel : CodeExplorerItemViewModel
1111
DeclarationType.UserDefinedTypeMember
1212
};
1313

14-
private readonly string _signature = string.Empty;
14+
private string _signature = string.Empty;
1515

1616
public CodeExplorerSubMemberViewModel(ICodeExplorerNode parent, Declaration declaration) : base(parent, declaration)
1717
{
18-
if (Declaration is ValuedDeclaration value && !string.IsNullOrEmpty(value.Expression))
19-
{
20-
_signature = $" = {value.Expression}";
21-
}
18+
UpdateSignature();
2219
}
2320

2421
public override string Name => Declaration?.IdentifierName ?? string.Empty;
@@ -30,6 +27,7 @@ public override void Synchronize(ref List<Declaration> updated)
3027
var signature = _signature;
3128

3229
base.Synchronize(ref updated);
30+
UpdateSignature();
3331
if (Declaration is null || _signature.Equals(signature))
3432
{
3533
return;
@@ -39,6 +37,18 @@ public override void Synchronize(ref List<Declaration> updated)
3937
OnNameChanged();
4038
}
4139

40+
private void UpdateSignature()
41+
{
42+
if (Declaration is ValuedDeclaration value && !string.IsNullOrEmpty(value.Expression))
43+
{
44+
_signature = $" = {value.Expression}";
45+
}
46+
else
47+
{
48+
_signature = "";
49+
}
50+
}
51+
4252
public override Comparer<ICodeExplorerNode> SortComparer =>
4353
SortOrder.HasFlag(CodeExplorerSortOrder.Name)
4454
? CodeExplorerItemComparer.Name

0 commit comments

Comments
 (0)