@@ -10,8 +10,6 @@ import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;
1010
1111export const enum FourSlashTestType {
1212 Native ,
13- Shims ,
14- ShimsWithPreprocess ,
1513 Server ,
1614}
1715
@@ -202,6 +200,32 @@ const enum CallHierarchyItemDirection {
202200 Outgoing ,
203201}
204202
203+ interface RealizedDiagnostic {
204+ message : string ;
205+ start : number ;
206+ length : number ;
207+ category : string ;
208+ code : number ;
209+ reportsUnnecessary ?: { } ;
210+ reportsDeprecated ?: { } ;
211+ }
212+
213+ function realizeDiagnostics ( diagnostics : readonly ts . Diagnostic [ ] , newLine : string ) : RealizedDiagnostic [ ] {
214+ return diagnostics . map ( d => realizeDiagnostic ( d , newLine ) ) ;
215+ }
216+
217+ function realizeDiagnostic ( diagnostic : ts . Diagnostic , newLine : string ) : RealizedDiagnostic {
218+ return {
219+ message : ts . flattenDiagnosticMessageText ( diagnostic . messageText , newLine ) ,
220+ start : diagnostic . start ! , // TODO: GH#18217
221+ length : diagnostic . length ! , // TODO: GH#18217
222+ category : ts . diagnosticCategoryName ( diagnostic ) ,
223+ code : diagnostic . code ,
224+ reportsUnnecessary : diagnostic . reportsUnnecessary ,
225+ reportsDeprecated : diagnostic . reportsDeprecated ,
226+ } ;
227+ }
228+
205229export class TestState {
206230 // Language service instance
207231 private languageServiceAdapterHost : Harness . LanguageService . LanguageServiceAdapterHost ;
@@ -267,10 +291,6 @@ export class TestState {
267291 switch ( testType ) {
268292 case FourSlashTestType . Native :
269293 return new Harness . LanguageService . NativeLanguageServiceAdapter ( cancellationToken , compilationOptions ) ;
270- case FourSlashTestType . Shims :
271- return new Harness . LanguageService . ShimLanguageServiceAdapter ( /*preprocessToResolve*/ false , cancellationToken , compilationOptions ) ;
272- case FourSlashTestType . ShimsWithPreprocess :
273- return new Harness . LanguageService . ShimLanguageServiceAdapter ( /*preprocessToResolve*/ true , cancellationToken , compilationOptions ) ;
274294 case FourSlashTestType . Server :
275295 return new Harness . LanguageService . ServerLanguageServiceAdapter ( cancellationToken , compilationOptions ) ;
276296 default :
@@ -1764,8 +1784,8 @@ export class TestState {
17641784
17651785 private testDiagnostics ( expected : readonly FourSlashInterface . Diagnostic [ ] , diagnostics : readonly ts . Diagnostic [ ] , category : string ) {
17661786 assert . deepEqual (
1767- ts . realizeDiagnostics ( diagnostics , "\n" ) ,
1768- expected . map ( ( e ) : ts . RealizedDiagnostic => {
1787+ realizeDiagnostics ( diagnostics , "\n" ) ,
1788+ expected . map ( ( e ) : RealizedDiagnostic => {
17691789 const range = e . range || this . getRangesInFile ( ) [ 0 ] ;
17701790 if ( ! range ) {
17711791 this . raiseError ( "Must provide a range for each expected diagnostic, or have one range in the fourslash source." ) ;
0 commit comments