@@ -68,11 +68,11 @@ export default class DefinitionAdapter {
68
68
* @param locationResult Either a single {Location} object or an {Array} of {Locations}.
69
69
* @returns An {Array} of {Location}s or {null} if the locationResult was null.
70
70
*/
71
- public static normalizeLocations ( locationResult : Location | Location [ ] | LocationLink [ ] ) : Location [ ] | LocationLink [ ] | null {
71
+ public static normalizeLocations ( locationResult : Location | ( Location | LocationLink ) [ ] ) : ( Location | LocationLink ) [ ] | null {
72
72
if ( locationResult == null ) {
73
73
return null
74
74
}
75
- return ( Array . isArray ( locationResult ) ? locationResult : [ locationResult ] ) . filter ( ( d ) => ( d . range || d . targetRange ) . start != null )
75
+ return ( Array . isArray ( locationResult ) ? locationResult : [ locationResult ] ) . filter ( ( d ) => ( 'range' in d ? d . range : d . targetRange ) . start != null )
76
76
}
77
77
78
78
/**
@@ -82,11 +82,11 @@ export default class DefinitionAdapter {
82
82
* @param languageName The name of the language these objects are written in.
83
83
* @returns An {Array} of {Definition}s that represented the converted {Location}s.
84
84
*/
85
- public static convertLocationsToDefinitions ( locations : Location [ ] | LocationLink [ ] , languageName : string ) : atomIde . Definition [ ] {
85
+ public static convertLocationsToDefinitions ( locations : ( Location | LocationLink ) [ ] , languageName : string ) : atomIde . Definition [ ] {
86
86
return locations . map ( ( d ) => ( {
87
- path : Convert . uriToPath ( d . uri || d . targetUri ) ,
88
- position : Convert . positionToPoint ( ( d . range || d . targetRange ) . start ) ,
89
- range : Range . fromObject ( Convert . lsRangeToAtomRange ( d . range || d . targetRange ) ) ,
87
+ path : Convert . uriToPath ( 'uri' in d ? d . uri : d . targetUri ) ,
88
+ position : Convert . positionToPoint ( ( 'range' in d ? d . range : d . targetRange ) . start ) ,
89
+ range : Range . fromObject ( Convert . lsRangeToAtomRange ( 'range' in d ? d . range : d . targetRange ) ) ,
90
90
language : languageName ,
91
91
} ) )
92
92
}
0 commit comments