Skip to content

Commit 080f4ce

Browse files
committed
fix: should check only the first of the array / Moved isLocationLinkArray function
1 parent 5d132b0 commit 080f4ce

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/adapters/definition-adapter.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default class DefinitionAdapter {
7474
if (locationResult == null) {
7575
return null
7676
}
77-
if (this.isLocationLinkArray(locationResult)) {
77+
if (isLocationLinkArray(locationResult)) {
7878
return locationResult.filter((d) => d.targetRange.start != null)
7979
}
8080
return (Array.isArray(locationResult) ? locationResult : [locationResult]).filter((d) => d.range.start != null)
@@ -91,7 +91,7 @@ export default class DefinitionAdapter {
9191
locations: Location[] | LocationLink[],
9292
languageName: string
9393
): atomIde.Definition[] {
94-
if (this.isLocationLinkArray(locations)) {
94+
if (isLocationLinkArray(locations)) {
9595
return locations.map((d) => ({
9696
path: Convert.uriToPath(d.targetUri),
9797
position: Convert.positionToPoint(d.targetRange.start),
@@ -106,7 +106,8 @@ export default class DefinitionAdapter {
106106
language: languageName,
107107
}))
108108
}
109-
private static isLocationLinkArray(value: any): value is LocationLink[] {
110-
return Array.isArray(value) && value.every((v) => LocationLink.is(v))
111-
}
109+
}
110+
111+
function isLocationLinkArray(value: any): value is LocationLink[] {
112+
return Array.isArray(value) && LocationLink.is(value[0])
112113
}

0 commit comments

Comments
 (0)