@@ -65,8 +65,9 @@ function parseTypeScriptFiles(failingTests: Set<string>, manualTests: Set<string
6565 else if ( file . endsWith ( ".ts" ) && ! manualTests . has ( file . slice ( 0 , - 3 ) ) ) {
6666 const content = fs . readFileSync ( filePath , "utf-8" ) ;
6767 const test = parseFileContent ( file , content ) ;
68+ const isServer = filePath . split ( path . sep ) . includes ( "server" ) ;
6869 if ( test ) {
69- const testContent = generateGoTest ( failingTests , test ) ;
70+ const testContent = generateGoTest ( failingTests , test , isServer ) ;
7071 const testPath = path . join ( outputDir , `${ test . name } _test.go` ) ;
7172 fs . writeFileSync ( testPath , testContent , "utf-8" ) ;
7273 }
@@ -198,6 +199,7 @@ function parseFourslashStatement(statement: ts.Statement): Cmd[] | undefined {
198199 case "baselineGoToDefinition" :
199200 case "baselineGetDefinitionAtPosition" :
200201 case "baselineGoToType" :
202+ case "baselineGoToImplementation" :
201203 // Both `baselineGoToDefinition` and `baselineGetDefinitionAtPosition` take the same
202204 // arguments, but differ in that...
203205 // - `verify.baselineGoToDefinition(...)` called getDefinitionAndBoundSpan
@@ -1130,14 +1132,14 @@ function parseBaselineDocumentHighlightsArgs(args: readonly ts.Expression[]): [V
11301132}
11311133
11321134function parseBaselineGoToDefinitionArgs (
1133- funcName : "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition" ,
1135+ funcName : "baselineGoToDefinition" | "baselineGoToType" | "baselineGetDefinitionAtPosition" | "baselineGoToImplementation" ,
11341136 args : readonly ts . Expression [ ] ,
11351137) : [ VerifyBaselineGoToDefinitionCmd ] | undefined {
11361138 let boundSpan : true | undefined ;
11371139 if ( funcName === "baselineGoToDefinition" ) {
11381140 boundSpan = true ;
11391141 }
1140- let kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" ;
1142+ let kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" | "verifyBaselineGoToImplementation" ;
11411143 switch ( funcName ) {
11421144 case "baselineGoToDefinition" :
11431145 case "baselineGetDefinitionAtPosition" :
@@ -1146,6 +1148,9 @@ function parseBaselineGoToDefinitionArgs(
11461148 case "baselineGoToType" :
11471149 kind = "verifyBaselineGoToType" ;
11481150 break ;
1151+ case "baselineGoToImplementation" :
1152+ kind = "verifyBaselineGoToImplementation" ;
1153+ break ;
11491154 }
11501155 const newArgs = [ ] ;
11511156 for ( const arg of args ) {
@@ -1824,7 +1829,7 @@ interface VerifyBaselineFindAllReferencesCmd {
18241829}
18251830
18261831interface VerifyBaselineGoToDefinitionCmd {
1827- kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" ;
1832+ kind : "verifyBaselineGoToDefinition" | "verifyBaselineGoToType" | "verifyBaselineGoToImplementation" ;
18281833 markers : string [ ] ;
18291834 boundSpan ?: true ;
18301835 ranges ?: boolean ;
@@ -1984,6 +1989,11 @@ function generateBaselineGoToDefinition({ markers, ranges, kind, boundSpan }: Ve
19841989 return `f.VerifyBaselineGoToTypeDefinition(t)` ;
19851990 }
19861991 return `f.VerifyBaselineGoToTypeDefinition(t, ${ markers . join ( ", " ) } )` ;
1992+ case "verifyBaselineGoToImplementation" :
1993+ if ( ranges || markers . length === 0 ) {
1994+ return `f.VerifyBaselineGoToImplementation(t)` ;
1995+ }
1996+ return `f.VerifyBaselineGoToImplementation(t, ${ markers . join ( ", " ) } )` ;
19871997 }
19881998}
19891999
@@ -2038,6 +2048,7 @@ function generateCmd(cmd: Cmd): string {
20382048 return generateBaselineDocumentHighlights ( cmd ) ;
20392049 case "verifyBaselineGoToDefinition" :
20402050 case "verifyBaselineGoToType" :
2051+ case "verifyBaselineGoToImplementation" :
20412052 return generateBaselineGoToDefinition ( cmd ) ;
20422053 case "verifyBaselineQuickInfo" :
20432054 // Quick Info -> Hover
@@ -2083,7 +2094,7 @@ interface GoTest {
20832094 commands : Cmd [ ] ;
20842095}
20852096
2086- function generateGoTest ( failingTests : Set < string > , test : GoTest ) : string {
2097+ function generateGoTest ( failingTests : Set < string > , test : GoTest , isServer : boolean ) : string {
20872098 const testName = ( test . name [ 0 ] . toUpperCase ( ) + test . name . substring ( 1 ) ) . replaceAll ( "-" , "_" ) . replaceAll ( / [ ^ a - z A - Z 0 - 9 _ ] / g, "" ) ;
20882099 const content = test . content ;
20892100 const commands = test . commands . map ( cmd => generateCmd ( cmd ) ) . join ( "\n" ) ;
@@ -2119,7 +2130,7 @@ func Test${testName}(t *testing.T) {
21192130 defer testutil.RecoverAndFail(t, "Panic on fourslash test")
21202131 const content = ${ content }
21212132 f := fourslash.NewFourslash(t, nil /*capabilities*/, content)
2122- ${ commands }
2133+ ${ isServer ? `f.MarkTestAsStradaServer()\n` : "" } ${ commands }
21232134}` ;
21242135 return template ;
21252136}
0 commit comments