@@ -1192,36 +1192,36 @@ namespace ts.server {
1192
1192
}
1193
1193
1194
1194
private getDefinitionAndBoundSpan ( args : protocol . FileLocationRequestArgs , simplifiedResult : boolean ) : protocol . DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan {
1195
- // const { file, project } = this.getFileAndProject(args);
1196
- // const position = this.getPositionInFile(args, file);
1197
- // const scriptInfo = Debug.checkDefined(project.getScriptInfo(file));
1198
-
1199
- // const unmappedDefinitionAndBoundSpan = project.getLanguageService().getDefinitionAndBoundSpan(file, position);
1200
-
1201
- // if (!unmappedDefinitionAndBoundSpan || !unmappedDefinitionAndBoundSpan.definitions) {
1202
- // return {
1203
- // definitions: emptyArray,
1204
- // textSpan: undefined! // TODO: GH#18217
1205
- // };
1206
- // }
1207
-
1208
- // const definitions = this.mapDefinitionInfoLocations(unmappedDefinitionAndBoundSpan.definitions, project);
1209
- // const { textSpan } = unmappedDefinitionAndBoundSpan;
1210
-
1211
- // if (simplifiedResult) {
1212
- // return {
1213
- // definitions: this.mapDefinitionInfo(definitions, project),
1214
- // textSpan: toProtocolTextSpan(textSpan, scriptInfo)
1215
- // };
1216
- // }
1217
-
1218
- // return {
1219
- // definitions: definitions.map(Session.mapToOriginalLocation),
1220
- // textSpan,
1221
- // };
1222
- // }
1223
-
1224
- // private getSourceDefinitionAndBoundSpan(args: protocol.FileLocationRequestArgs, simplifiedResult: boolean): protocol.DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan {
1195
+ const { file, project } = this . getFileAndProject ( args ) ;
1196
+ const position = this . getPositionInFile ( args , file ) ;
1197
+ const scriptInfo = Debug . checkDefined ( project . getScriptInfo ( file ) ) ;
1198
+
1199
+ const unmappedDefinitionAndBoundSpan = project . getLanguageService ( ) . getDefinitionAndBoundSpan ( file , position ) ;
1200
+
1201
+ if ( ! unmappedDefinitionAndBoundSpan || ! unmappedDefinitionAndBoundSpan . definitions ) {
1202
+ return {
1203
+ definitions : emptyArray ,
1204
+ textSpan : undefined ! // TODO: GH#18217
1205
+ } ;
1206
+ }
1207
+
1208
+ const definitions = this . mapDefinitionInfoLocations ( unmappedDefinitionAndBoundSpan . definitions , project ) ;
1209
+ const { textSpan } = unmappedDefinitionAndBoundSpan ;
1210
+
1211
+ if ( simplifiedResult ) {
1212
+ return {
1213
+ definitions : this . mapDefinitionInfo ( definitions , project ) ,
1214
+ textSpan : toProtocolTextSpan ( textSpan , scriptInfo )
1215
+ } ;
1216
+ }
1217
+
1218
+ return {
1219
+ definitions : definitions . map ( Session . mapToOriginalLocation ) ,
1220
+ textSpan,
1221
+ } ;
1222
+ }
1223
+
1224
+ private getSourceDefinitionAndBoundSpan ( args : protocol . FileLocationRequestArgs , simplifiedResult : boolean ) : protocol . DefinitionInfoAndBoundSpan | DefinitionInfoAndBoundSpan {
1225
1225
const { file, project } = this . getFileAndProject ( args ) ;
1226
1226
const position = this . getPositionInFile ( args , file ) ;
1227
1227
const scriptInfo = Debug . checkDefined ( project . getScriptInfo ( file ) ) ;
@@ -2800,12 +2800,12 @@ namespace ts.server {
2800
2800
[ CommandNames . DefinitionAndBoundSpanFull ] : ( request : protocol . DefinitionAndBoundSpanRequest ) => {
2801
2801
return this . requiredResponse ( this . getDefinitionAndBoundSpan ( request . arguments , /*simplifiedResult*/ false ) ) ;
2802
2802
} ,
2803
- // [CommandNames.SourceDefinitionAndBoundSpan]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => {
2804
- // return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ true));
2805
- // },
2806
- // [CommandNames.SourceDefinitionAndBoundSpanFull]: (request: protocol.SourceDefinitionAndBoundSpanRequest) => {
2807
- // return this.requiredResponse(this.getSourceDefinitionAndBoundSpan(request.arguments, /*simplifiedResult*/ false));
2808
- // },
2803
+ [ CommandNames . SourceDefinitionAndBoundSpan ] : ( request : protocol . SourceDefinitionAndBoundSpanRequest ) => {
2804
+ return this . requiredResponse ( this . getSourceDefinitionAndBoundSpan ( request . arguments , /*simplifiedResult*/ true ) ) ;
2805
+ } ,
2806
+ [ CommandNames . SourceDefinitionAndBoundSpanFull ] : ( request : protocol . SourceDefinitionAndBoundSpanRequest ) => {
2807
+ return this . requiredResponse ( this . getSourceDefinitionAndBoundSpan ( request . arguments , /*simplifiedResult*/ false ) ) ;
2808
+ } ,
2809
2809
[ CommandNames . EmitOutput ] : ( request : protocol . EmitOutputRequest ) => {
2810
2810
return this . requiredResponse ( this . getEmitOutput ( request . arguments ) ) ;
2811
2811
} ,
0 commit comments