@@ -911,17 +911,28 @@ function parseBaselineRenameArgs(funcName: string, args: readonly ts.Expression[
911
911
} ] ;
912
912
}
913
913
914
+ function stringToTristate ( s : string ) : string {
915
+ switch ( s ) {
916
+ case "true" :
917
+ return "core.TSTrue" ;
918
+ case "false" :
919
+ return "core.TSFalse" ;
920
+ default :
921
+ return "core.TSUnknown" ;
922
+ }
923
+ }
924
+
914
925
function parseUserPreferences ( arg : ts . ObjectLiteralExpression ) : string | undefined {
915
926
const preferences : string [ ] = [ ] ;
916
927
for ( const prop of arg . properties ) {
917
928
if ( ts . isPropertyAssignment ( prop ) ) {
918
929
switch ( prop . name . getText ( ) ) {
919
930
// !!! other preferences
920
931
case "providePrefixAndSuffixTextForRename" :
921
- preferences . push ( `UseAliasesForRename: PtrTo( ${ prop . initializer . getText ( ) } ) ` ) ;
932
+ preferences . push ( `UseAliasesForRename: ${ stringToTristate ( prop . initializer . getText ( ) ) } ` ) ;
922
933
break ;
923
934
case "quotePreference" :
924
- preferences . push ( `QuotePreference: PtrTo( ls.QuotePreference(${ prop . initializer . getText ( ) } ) )` ) ;
935
+ preferences . push ( `QuotePreference: ls.QuotePreference(${ prop . initializer . getText ( ) } )` ) ;
925
936
break ;
926
937
}
927
938
}
@@ -1465,13 +1476,16 @@ function generateGoTest(failingTests: Set<string>, test: GoTest): string {
1465
1476
const commands = test . commands . map ( cmd => generateCmd ( cmd ) ) . join ( "\n" ) ;
1466
1477
const imports = [ `"github.com/microsoft/typescript-go/internal/fourslash"` ] ;
1467
1478
// Only include these imports if the commands use them to avoid unused import errors.
1479
+ if ( commands . includes ( "core." ) ) {
1480
+ imports . unshift ( `"github.com/microsoft/typescript-go/internal/core"` ) ;
1481
+ }
1468
1482
if ( commands . includes ( "ls." ) ) {
1469
1483
imports . push ( `"github.com/microsoft/typescript-go/internal/ls"` ) ;
1470
1484
}
1471
1485
if ( commands . includes ( "lsproto." ) ) {
1472
1486
imports . push ( `"github.com/microsoft/typescript-go/internal/lsp/lsproto"` ) ;
1473
1487
}
1474
- if ( usesHelper ( commands ) ) {
1488
+ if ( usesFourslashUtil ( commands ) ) {
1475
1489
imports . push ( `. "github.com/microsoft/typescript-go/internal/fourslash/tests/util"` ) ;
1476
1490
}
1477
1491
imports . push ( `"github.com/microsoft/typescript-go/internal/testutil"` ) ;
@@ -1494,7 +1508,7 @@ func Test${testName}(t *testing.T) {
1494
1508
return template ;
1495
1509
}
1496
1510
1497
- function usesHelper ( goTxt : string ) : boolean {
1511
+ function usesFourslashUtil ( goTxt : string ) : boolean {
1498
1512
for ( const [ _ , constant ] of completionConstants ) {
1499
1513
if ( goTxt . includes ( constant ) ) {
1500
1514
return true ;
0 commit comments