@@ -23,7 +23,7 @@ namespace FourSlash {
2323 ts . disableIncrementalParsing = false ;
2424
2525 // Represents a parsed source file with metadata
26- export interface FourSlashFile {
26+ interface FourSlashFile {
2727 // The contents of the file (with markers, etc stripped out)
2828 content : string ;
2929 fileName : string ;
@@ -34,7 +34,7 @@ namespace FourSlash {
3434 }
3535
3636 // Represents a set of parsed source files and options
37- export interface FourSlashData {
37+ interface FourSlashData {
3838 // Global options (name/value pairs)
3939 globalOptions : Harness . TestCaseParser . CompilerSettings ;
4040
@@ -59,7 +59,7 @@ namespace FourSlash {
5959 export interface Marker {
6060 fileName : string ;
6161 position : number ;
62- data ?: any ;
62+ data ?: { } ;
6363 }
6464
6565 export interface Range {
@@ -89,21 +89,6 @@ namespace FourSlash {
8989 end : number ;
9090 }
9191
92- export import IndentStyle = ts . IndentStyle ;
93-
94- const entityMap = ts . createMapFromTemplate ( {
95- "&" : "&" ,
96- "\"" : """ ,
97- "'" : "'" ,
98- "/" : "/" ,
99- "<" : "<" ,
100- ">" : ">"
101- } ) ;
102-
103- export function escapeXmlAttributeValue ( s : string ) {
104- return s . replace ( / [ & < > " ' \/ ] / g, ch => entityMap . get ( ch ) ) ;
105- }
106-
10792 // Name of testcase metadata including ts.CompilerOptions properties that will be used by globalOptions
10893 // To add additional option, add property into the testOptMetadataNames, refer the property in either globalMetadataNames or fileMetadataNames
10994 // Add cases into convertGlobalOptionsToCompilationsSettings function for the compiler to acknowledge such option from meta data
@@ -1079,7 +1064,7 @@ namespace FourSlash {
10791064 for ( const reference of expectedReferences ) {
10801065 const { fileName, start, end } = reference ;
10811066 if ( reference . marker && reference . marker . data ) {
1082- const { isWriteAccess, isDefinition } = reference . marker . data ;
1067+ const { isWriteAccess, isDefinition } = reference . marker . data as { isWriteAccess ?: boolean , isDefinition ?: boolean } ;
10831068 this . verifyReferencesWorker ( actualReferences , fileName , start , end , isWriteAccess , isDefinition ) ;
10841069 }
10851070 else {
@@ -1108,7 +1093,16 @@ namespace FourSlash {
11081093 }
11091094 const fullExpected = ts . map < FourSlashInterface . ReferenceGroup , ReferenceGroupJson > ( parts , ( { definition, ranges } ) => ( {
11101095 definition : typeof definition === "string" ? definition : { ...definition , range : textSpanFromRange ( definition . range ) } ,
1111- references : ranges . map ( rangeToReferenceEntry ) ,
1096+ references : ranges . map < ts . ReferenceEntry > ( r => {
1097+ const { isWriteAccess = false , isDefinition = false , isInString } = ( r . marker && r . marker . data || { } ) as { isWriteAccess ?: boolean , isDefinition ?: boolean , isInString ?: true } ;
1098+ return {
1099+ isWriteAccess,
1100+ isDefinition,
1101+ fileName : r . fileName ,
1102+ textSpan : textSpanFromRange ( r ) ,
1103+ ...( isInString ? { isInString : true } : undefined ) ,
1104+ } ;
1105+ } ) ,
11121106 } ) ) ;
11131107
11141108 for ( const startRange of toArray ( startRanges ) ) {
@@ -1122,15 +1116,6 @@ namespace FourSlash {
11221116 } ) ;
11231117 this . assertObjectsEqual ( fullActual , fullExpected ) ;
11241118 }
1125-
1126- function rangeToReferenceEntry ( r : Range ) : ts . ReferenceEntry {
1127- const { isWriteAccess, isDefinition, isInString } = ( r . marker && r . marker . data ) || { isWriteAccess : false , isDefinition : false , isInString : undefined } ;
1128- const result : ts . ReferenceEntry = { fileName : r . fileName , textSpan : textSpanFromRange ( r ) , isWriteAccess : ! ! isWriteAccess , isDefinition : ! ! isDefinition } ;
1129- if ( isInString !== undefined ) {
1130- result . isInString = isInString ;
1131- }
1132- return result ;
1133- }
11341119 }
11351120
11361121 public verifyNoReferences ( markerNameOrRange ?: string | Range ) {
@@ -2587,12 +2572,10 @@ Actual: ${stringify(fullActual)}`);
25872572 actualTextArray . push ( text ) ;
25882573 scriptInfo . updateContent ( originalContent ) ;
25892574 }
2590- const sortedExpectedArray = expectedTextArray . sort ( ) ;
2591- const sortedActualArray = actualTextArray . sort ( ) ;
2592- if ( sortedExpectedArray . length !== sortedActualArray . length ) {
2593- this . raiseError ( `Expected ${ sortedExpectedArray . length } import fixes, got ${ sortedActualArray . length } ` ) ;
2575+ if ( expectedTextArray . length !== actualTextArray . length ) {
2576+ this . raiseError ( `Expected ${ expectedTextArray . length } import fixes, got ${ actualTextArray . length } ` ) ;
25942577 }
2595- ts . zipWith ( sortedExpectedArray , sortedActualArray , ( expected , actual , index ) => {
2578+ ts . zipWith ( expectedTextArray , actualTextArray , ( expected , actual , index ) => {
25962579 if ( expected !== actual ) {
25972580 this . raiseError ( `Import fix at index ${ index } doesn't match.\n${ showTextDiff ( expected , actual ) } ` ) ;
25982581 }
0 commit comments