Skip to content
This repository was archived by the owner on Mar 6, 2022. It is now read-only.

Commit 799bd1f

Browse files
committed
move the sort to the Locations class
1 parent dad6447 commit 799bd1f

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

lib/LanguageServerReferenceFinder/Handler/ReferencesHandler.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,7 @@ public function references(
161161
*/
162162
private function toLocations(array $locations): array
163163
{
164-
usort($locations, function (Location $first, Location $second) {
165-
$order = strcmp((string) $first->uri(), (string) $second->uri());
166-
if (0 !== $order) {
167-
return $order;
168-
}
169-
170-
return $first->offset()->toInt() - $second->offset()->toInt();
171-
});
172-
173-
$lspLocations = $this->locationConverter->toLspLocations(new Locations($locations));
174-
175-
return $lspLocations;
164+
return $this->locationConverter->toLspLocations(Locations::bySorting($locations));
176165
}
177166

178167
public function registerCapabiltiies(ServerCapabilities $capabilities): void

0 commit comments

Comments
 (0)