Skip to content

Commit 9208239

Browse files
authored
Remove shims.ts and related infra (#55868)
1 parent 284cd45 commit 9208239

File tree

73 files changed

+30
-7009
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+30
-7009
lines changed

src/harness/fourslashImpl.ts

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import ArrayOrSingle = FourSlashInterface.ArrayOrSingle;
1010

1111
export 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+
205229
export 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.");

src/harness/harnessLanguageService.ts

Lines changed: 0 additions & 461 deletions
Large diffs are not rendered by default.

src/harness/runnerbase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as ts from "./_namespaces/ts";
77

88
export type TestRunnerKind = CompilerTestKind | FourslashTestKind | "project";
99
export type CompilerTestKind = "conformance" | "compiler";
10-
export type FourslashTestKind = "fourslash" | "fourslash-shims" | "fourslash-shims-pp" | "fourslash-server";
10+
export type FourslashTestKind = "fourslash" | "fourslash-server";
1111

1212
export let shards = 1;
1313
export let shardId = 1;

src/services/_namespaces/ts.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export * from "../suggestionDiagnostics";
1616
export * from "../transpile";
1717
export * from "../services";
1818
export * from "../transform";
19-
export * from "../shims";
2019
import * as BreakpointResolver from "./ts.BreakpointResolver";
2120
export { BreakpointResolver };
2221
import * as CallHierarchy from "./ts.CallHierarchy";

0 commit comments

Comments
 (0)