Skip to content

Commit 83e94b2

Browse files
authored
Merge pull request #4519 from retailcoder/bugfix
Include property accessor type in the "search results" tab
2 parents 1991a0c + 685204a commit 83e94b2

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

Rubberduck.Core/UI/Command/FindAllImplementationsCommand.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,15 @@ private SearchResultsViewModel CreateViewModel(Declaration target)
180180
new NavigateCodeEventArgs(declaration.QualifiedName.QualifiedModuleName, declaration.Selection),
181181
GetModuleLine(declaration.QualifiedName.QualifiedModuleName, declaration.Selection.StartLine)));
182182

183+
var accessor = target.DeclarationType.HasFlag(DeclarationType.PropertyGet) ? "(get)"
184+
: target.DeclarationType.HasFlag(DeclarationType.PropertyLet) ? "(let)"
185+
: target.DeclarationType.HasFlag(DeclarationType.PropertySet) ? "(set)"
186+
: string.Empty;
187+
188+
var tabCaption = $"{target.IdentifierName} {accessor}".Trim();
189+
183190
var viewModel = new SearchResultsViewModel(_navigateCommand,
184-
string.Format(RubberduckUI.SearchResults_AllImplementationsTabFormat, target.IdentifierName), target, results);
191+
string.Format(RubberduckUI.SearchResults_AllImplementationsTabFormat, tabCaption), target, results);
185192

186193
return viewModel;
187194
}

Rubberduck.Core/UI/Command/FindAllReferencesCommand.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,17 @@ private SearchResultsViewModel CreateViewModel(Declaration declaration)
169169
reference.ParentNonScoping,
170170
new NavigateCodeEventArgs(reference.QualifiedModuleName, reference.Selection),
171171
GetModuleLine(reference.QualifiedModuleName, reference.Selection.StartLine)));
172-
172+
173+
var accessor = declaration.DeclarationType.HasFlag(DeclarationType.PropertyGet) ? "(get)"
174+
: declaration.DeclarationType.HasFlag(DeclarationType.PropertyLet) ? "(let)"
175+
: declaration.DeclarationType.HasFlag(DeclarationType.PropertySet) ? "(set)"
176+
: string.Empty;
177+
178+
var tabCaption = $"{declaration.IdentifierName} {accessor}".Trim();
179+
180+
173181
var viewModel = new SearchResultsViewModel(_navigateCommand,
174-
string.Format(RubberduckUI.SearchResults_AllReferencesTabFormat, declaration.IdentifierName), declaration, results);
182+
string.Format(RubberduckUI.SearchResults_AllReferencesTabFormat, tabCaption), declaration, results);
175183

176184
return viewModel;
177185
}

0 commit comments

Comments
 (0)