Skip to content

Commit 75e1b80

Browse files
author
Paul van Brenk
committed
Use just the errorcode, without the TS prefix
1 parent 163e758 commit 75e1b80

9 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/harness/fourslash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ namespace FourSlash {
20552055

20562056
const diagnostic = !errorCode ? diagnostics[0] : ts.find(diagnostics, d => d.code == errorCode);
20572057

2058-
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [`TS${diagnostic.code}`]);
2058+
return this.languageService.getCodeFixesAtPosition(fileName, diagnostic.start, diagnostic.length, [diagnostic.code]);
20592059
}
20602060

20612061
public verifyCodeFixAtPosition(expectedText: string, errorCode?: number) {

src/harness/harnessLanguageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ namespace Harness.LanguageService {
486486
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean {
487487
return unwrapJSONCallResult(this.shim.isValidBraceCompletionAtPosition(fileName, position, openingBrace));
488488
}
489-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: string[]): ts.CodeAction[] {
489+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): ts.CodeAction[] {
490490
return unwrapJSONCallResult(this.shim.getCodeFixesAtPosition(fileName, start, end, JSON.stringify(errorCodes)));
491491
}
492492
getEmitOutput(fileName: string): ts.EmitOutput {

src/server/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ namespace ts.server {
630630
throw new Error("Not Implemented Yet.");
631631
}
632632

633-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: string[]): ts.CodeAction[] {
633+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): ts.CodeAction[] {
634634
throw new Error("Not Implemented Yet.");
635635
}
636636

src/server/protocol.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ declare namespace ts.server.protocol {
247247
/**
248248
* Errorcodes we want to get the fixes for.
249249
*/
250-
errorCodes?: string[]
250+
errorCodes?: number[]
251251
}
252252

253253
/**

src/services/codefixes/codeFixProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* @internal */
1+
/* @internal */
22
namespace ts {
33
export interface CodeFix {
4-
errorCodes: string[];
4+
errorCodes: number[];
55
getCodeActions(context: CodeFixContext): CodeAction[];
66
}
77

88
export interface CodeFixContext {
9-
errorCode: string;
9+
errorCode: number;
1010
sourceFile: SourceFile;
1111
span: TextSpan;
1212
program: Program;

src/services/codefixes/superFixes.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
/* @internal */
1+
/* @internal */
22
namespace ts.codefix {
33
function getOpenBraceEnd(constructor: ConstructorDeclaration, sourceFile: SourceFile) {
44
// First token is the open curly, this is where we want to put the 'super' call.
55
return constructor.body.getFirstToken(sourceFile).getEnd();
66
}
77

88
registerCodeFix({
9-
errorCodes: [`TS${Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code}`],
9+
errorCodes: [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code],
1010
getCodeActions: (context: CodeFixContext) => {
1111
const sourceFile = context.sourceFile;
1212
const token = getTokenAtPosition(sourceFile, context.span.start);
@@ -24,7 +24,7 @@ namespace ts.codefix {
2424
});
2525

2626
registerCodeFix({
27-
errorCodes: [`TS${Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code}`],
27+
errorCodes: [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code],
2828
getCodeActions: (context: CodeFixContext) => {
2929
const sourceFile = context.sourceFile;
3030

@@ -43,7 +43,7 @@ namespace ts.codefix {
4343
// i.e. super(this.a), since in that case we won't suggest a fix
4444
if (superCall.expression && superCall.expression.kind == SyntaxKind.CallExpression) {
4545
const arguments = (<CallExpression>superCall.expression).arguments;
46-
for (let i = 0; i < arguments.length; i++){
46+
for (let i = 0; i < arguments.length; i++) {
4747
if ((<PropertyAccessExpression>arguments[i]).expression === token) {
4848
return undefined;
4949
}

src/services/services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ namespace ts {
16391639
return [];
16401640
}
16411641

1642-
function getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: string[]): CodeAction[] {
1642+
function getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[] {
16431643
synchronizeHostData();
16441644
const sourceFile = getValidSourceFile(fileName);
16451645
const span = { start, length: end - start };

src/services/shims.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ namespace ts {
961961
return this.forwardJSONCall(
962962
`getCodeFixesAtPosition( '${fileName}', ${start}, ${end}, ${errorCodes}')`,
963963
() => {
964-
const localErrors: string[] = JSON.parse(errorCodes);
964+
const localErrors: number[] = JSON.parse(errorCodes);
965965
return this.languageService.getCodeFixesAtPosition(fileName, start, end, localErrors);
966966
}
967967
);

src/services/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ namespace ts {
239239

240240
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
241241

242-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: string[]): CodeAction[];
242+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[]): CodeAction[];
243243

244244
getEmitOutput(fileName: string, emitOnlyDtsFiles?: boolean): EmitOutput;
245245

0 commit comments

Comments
 (0)