@@ -186,11 +186,14 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined {
186186 return [ parseBaselineSignatureHelp ( callExpression . arguments ) ] ;
187187 case "baselineGoToDefinition" :
188188 case "baselineGetDefinitionAtPosition" :
189- // Both of these take the same arguments, but differ in that...
189+ case "baselineGoToType" :
190+ // Both `baselineGoToDefinition` and `baselineGetDefinitionAtPosition` take the same
191+ // arguments, but differ in that...
190192 // - `verify.baselineGoToDefinition(...)` called getDefinitionAndBoundSpan
191193 // - `verify.baselineGetDefinitionAtPosition(...)` called getDefinitionAtPosition
192- // LSP doesn't have two separate commands though. It's unclear how we would model bound spans though.
193- return parseBaselineGoToDefinitionArgs ( callExpression . arguments ) ;
194+ // LSP doesn't have two separate commands though.
195+ // It's unclear how we would model bound spans though.
196+ return parseBaselineGoToDefinitionArgs ( func . text , callExpression . arguments ) ;
194197 case "baselineRename" :
195198 case "baselineRenameAtRangesWithText" :
196199 // `verify.baselineRename...(...)`
@@ -817,7 +820,20 @@ function parseBaselineDocumentHighlightsArgs(args: readonly ts.Expression[]): [V
817820 } ] ;
818821}
819822
820- function parseBaselineGoToDefinitionArgs ( args : readonly ts . Expression [ ] ) : [ VerifyBaselineGoToDefinitionCmd ] | undefined {
823+ function parseBaselineGoToDefinitionArgs (
824+ funcName : "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition" ,
825+ args : readonly ts . Expression [ ] ,
826+ ) : [ VerifyBaselineGoToDefinitionCmd ] | undefined {
827+ let kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" ;
828+ switch ( funcName ) {
829+ case "baselineGoToDefinition" :
830+ case "baselineGetDefinitionAtPosition" :
831+ kind = "verifyBaselineGoToDefinition" ;
832+ break ;
833+ case "baselineGoToType" :
834+ kind = "verifyBaselineGoToType" ;
835+ break ;
836+ }
821837 const newArgs = [ ] ;
822838 for ( const arg of args ) {
823839 let strArg ;
@@ -829,19 +845,19 @@ function parseBaselineGoToDefinitionArgs(args: readonly ts.Expression[]): [Verif
829845 }
830846 else if ( arg . getText ( ) === "...test.ranges()" ) {
831847 return [ {
832- kind : "verifyBaselineGoToDefinition" ,
848+ kind,
833849 markers : [ ] ,
834850 ranges : true ,
835851 } ] ;
836852 }
837853 else {
838- console . error ( `Unrecognized argument in verify.baselineGoToDefinition : ${ arg . getText ( ) } ` ) ;
854+ console . error ( `Unrecognized argument in verify.${ funcName } : ${ arg . getText ( ) } ` ) ;
839855 return undefined ;
840856 }
841857 }
842858
843859 return [ {
844- kind : "verifyBaselineGoToDefinition" ,
860+ kind,
845861 markers : newArgs ,
846862 } ] ;
847863}
@@ -1293,7 +1309,7 @@ interface VerifyBaselineFindAllReferencesCmd {
12931309}
12941310
12951311interface VerifyBaselineGoToDefinitionCmd {
1296- kind : "verifyBaselineGoToDefinition" ;
1312+ kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" ;
12971313 markers : string [ ] ;
12981314 ranges ?: boolean ;
12991315}
@@ -1393,11 +1409,20 @@ function generateBaselineDocumentHighlights({ args, preferences }: VerifyBaselin
13931409 return `f.VerifyBaselineDocumentHighlights(t, ${ preferences } , ${ args . join ( ", " ) } )` ;
13941410}
13951411
1396- function generateBaselineGoToDefinition ( { markers, ranges } : VerifyBaselineGoToDefinitionCmd ) : string {
1412+ function generateBaselineGoToDefinition ( { markers, ranges, kind } : VerifyBaselineGoToDefinitionCmd ) : string {
1413+ let goFunc ;
1414+ switch ( kind ) {
1415+ case "verifyBaselineGoToDefinition" :
1416+ goFunc = "VerifyBaselineGoToDefinition" ;
1417+ break ;
1418+ case "verifyBaselineGoToType" :
1419+ goFunc = "VerifyBaselineGoToTypeDefinition" ;
1420+ break ;
1421+ }
13971422 if ( ranges || markers . length === 0 ) {
1398- return `f.VerifyBaselineGoToDefinition (t)` ;
1423+ return `f.${ goFunc } (t)` ;
13991424 }
1400- return `f.VerifyBaselineGoToDefinition (t, ${ markers . join ( ", " ) } )` ;
1425+ return `f.${ goFunc } (t, ${ markers . join ( ", " ) } )` ;
14011426}
14021427
14031428function generateGoToCommand ( { funcName, args } : GoToCmd ) : string {
@@ -1436,6 +1461,7 @@ function generateCmd(cmd: Cmd): string {
14361461 case "verifyBaselineDocumentHighlights" :
14371462 return generateBaselineDocumentHighlights ( cmd ) ;
14381463 case "verifyBaselineGoToDefinition" :
1464+ case "verifyBaselineGoToType" :
14391465 return generateBaselineGoToDefinition ( cmd ) ;
14401466 case "verifyBaselineQuickInfo" :
14411467 // Quick Info -> Hover
0 commit comments