Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 3e5b969

Browse files
committed
Reduced unneeded lookup iterations when several symbol searches have the same search term.
1 parent 8485318 commit 3e5b969

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void FindReferencesInFile(SymbolSearchArgs args, IList<IFindReferenceSearchScope
131131
if (textSource == null)
132132
return;
133133
if (searchScopeList != null) {
134-
if (!searchScopeList.Any(
134+
if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any(
135135
scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0)))
136136
return;
137137
}
@@ -216,7 +216,7 @@ void RenameReferencesInFile(SymbolRenameArgs args, IList<IFindReferenceSearchSco
216216
if (textSource == null)
217217
return;
218218
if (searchScopeList != null) {
219-
if (!searchScopeList.Any(
219+
if (!searchScopeList.DistinctBy(scope => scope.SearchTerm ?? String.Empty).Any(
220220
scope => (scope.SearchTerm == null) || (textSource.IndexOf(scope.SearchTerm, 0, textSource.TextLength, StringComparison.Ordinal) >= 0)))
221221
return;
222222
}

0 commit comments

Comments
 (0)