@@ -93,6 +93,7 @@ namespace ts.server {
93
93
export const Geterr = "geterr" ;
94
94
export const GeterrForProject = "geterrForProject" ;
95
95
export const Implementation = "implementation" ;
96
+ export const ImplementationFull = "implementation-full" ;
96
97
export const SemanticDiagnosticsSync = "semanticDiagnosticsSync" ;
97
98
export const SyntacticDiagnosticsSync = "syntacticDiagnosticsSync" ;
98
99
export const NavBar = "navbar" ;
@@ -421,19 +422,24 @@ namespace ts.server {
421
422
} ) ;
422
423
}
423
424
424
- private getImplementation ( args : protocol . FileLocationRequestArgs ) : protocol . FileSpan [ ] {
425
+ private getImplementation ( args : protocol . FileLocationRequestArgs , simplifiedResult : boolean ) : protocol . FileSpan [ ] | ImplementationLocation [ ] {
425
426
const { file, project } = this . getFileAndProject ( args ) ;
426
427
const scriptInfo = project . getScriptInfoForNormalizedPath ( file ) ;
427
428
const position = this . getPosition ( args , scriptInfo ) ;
428
429
const implementations = project . getLanguageService ( ) . getImplementationAtPosition ( file , position ) ;
429
430
if ( ! implementations ) {
430
431
return [ ] ;
431
432
}
432
- return implementations . map ( impl => ( {
433
- file : impl . fileName ,
434
- start : scriptInfo . positionToLineOffset ( impl . textSpan . start ) ,
435
- end : scriptInfo . positionToLineOffset ( ts . textSpanEnd ( impl . textSpan ) )
436
- } ) ) ;
433
+ if ( simplifiedResult ) {
434
+ return implementations . map ( impl => ( {
435
+ file : impl . fileName ,
436
+ start : scriptInfo . positionToLineOffset ( impl . textSpan . start ) ,
437
+ end : scriptInfo . positionToLineOffset ( ts . textSpanEnd ( impl . textSpan ) )
438
+ } ) ) ;
439
+ }
440
+ else {
441
+ return implementations ;
442
+ }
437
443
}
438
444
439
445
private getOccurrences ( args : protocol . FileLocationRequestArgs ) : protocol . OccurrencesResponseItem [ ] {
@@ -1329,7 +1335,10 @@ namespace ts.server {
1329
1335
return this . requiredResponse ( this . getTypeDefinition ( request . arguments ) ) ;
1330
1336
} ,
1331
1337
[ CommandNames . Implementation ] : ( request : protocol . Request ) => {
1332
- return this . requiredResponse ( this . getImplementation ( request . arguments ) ) ;
1338
+ return this . requiredResponse ( this . getImplementation ( request . arguments , /*simplifiedResult*/ true ) ) ;
1339
+ } ,
1340
+ [ CommandNames . ImplementationFull ] : ( request : protocol . Request ) => {
1341
+ return this . requiredResponse ( this . getImplementation ( request . arguments , /*simplifiedResult*/ false ) ) ;
1333
1342
} ,
1334
1343
[ CommandNames . References ] : ( request : protocol . FileLocationRequest ) => {
1335
1344
return this . requiredResponse ( this . getReferences ( request . arguments , /*simplifiedResult*/ true ) ) ;
0 commit comments