@@ -10,8 +10,6 @@ import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;
10
10
11
11
export const enum FourSlashTestType {
12
12
Native ,
13
- Shims ,
14
- ShimsWithPreprocess ,
15
13
Server ,
16
14
}
17
15
@@ -202,6 +200,32 @@ const enum CallHierarchyItemDirection {
202
200
Outgoing ,
203
201
}
204
202
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
+
205
229
export class TestState {
206
230
// Language service instance
207
231
private languageServiceAdapterHost : Harness . LanguageService . LanguageServiceAdapterHost ;
@@ -267,10 +291,6 @@ export class TestState {
267
291
switch ( testType ) {
268
292
case FourSlashTestType . Native :
269
293
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 ) ;
274
294
case FourSlashTestType . Server :
275
295
return new Harness . LanguageService . ServerLanguageServiceAdapter ( cancellationToken , compilationOptions ) ;
276
296
default :
@@ -1764,8 +1784,8 @@ export class TestState {
1764
1784
1765
1785
private testDiagnostics ( expected : readonly FourSlashInterface . Diagnostic [ ] , diagnostics : readonly ts . Diagnostic [ ] , category : string ) {
1766
1786
assert . deepEqual (
1767
- ts . realizeDiagnostics ( diagnostics , "\n" ) ,
1768
- expected . map ( ( e ) : ts . RealizedDiagnostic => {
1787
+ realizeDiagnostics ( diagnostics , "\n" ) ,
1788
+ expected . map ( ( e ) : RealizedDiagnostic => {
1769
1789
const range = e . range || this . getRangesInFile ( ) [ 0 ] ;
1770
1790
if ( ! range ) {
1771
1791
this . raiseError ( "Must provide a range for each expected diagnostic, or have one range in the fourslash source." ) ;
0 commit comments