Skip to content

Commit fce0913

Browse files
author
Andy Hanson
committed
Make API changes internal
1 parent 79c0150 commit fce0913

File tree

5 files changed

+26
-51
lines changed

5 files changed

+26
-51
lines changed

src/server/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,8 @@ namespace ts.server {
559559
const request = this.processRequest<protocol.CodeFixRequest>(CommandNames.GetCodeFixes, args);
560560
const response = this.processResponse<protocol.CodeFixResponse>(request);
561561

562-
return response.body.map(({ description, changes, fixId }) => ({ description, changes: this.convertChanges(changes, file), fixId }));
562+
// TODO: GH#20538 shouldn't need cast
563+
return (response.body as protocol.CodeFixAction[]).map(({ description, changes, fixId }) => ({ description, changes: this.convertChanges(changes, file), fixId }));
563564
}
564565

565566
getCombinedCodeFix = notImplemented;

src/server/protocol.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,15 @@ namespace ts.server.protocol {
536536
arguments: CodeFixRequestArgs;
537537
}
538538

539+
// TODO: GH#20538
540+
/* @internal */
539541
export interface GetCombinedCodeFixRequest extends Request {
540542
command: CommandTypes.GetCombinedCodeFix;
541543
arguments: GetCombinedCodeFixRequestArgs;
542544
}
543545

546+
// TODO: GH#20538
547+
/* @internal */
544548
export interface GetCombinedCodeFixResponse extends Response {
545549
body: CombinedCodeActions;
546550
}
@@ -597,11 +601,15 @@ namespace ts.server.protocol {
597601
errorCodes?: number[];
598602
}
599603

604+
// TODO: GH#20538
605+
/* @internal */
600606
export interface GetCombinedCodeFixRequestArgs {
601607
scope: GetCombinedCodeFixScope;
602608
fixId: {};
603609
}
604610

611+
// TODO: GH#20538
612+
/* @internal */
605613
export interface GetCombinedCodeFixScope {
606614
type: "file";
607615
args: FileRequestArgs;
@@ -1590,7 +1598,7 @@ namespace ts.server.protocol {
15901598

15911599
export interface CodeFixResponse extends Response {
15921600
/** The code actions that are available */
1593-
body?: CodeFixAction[];
1601+
body?: CodeAction[]; // TODO: GH#20538 CodeFixAction[]
15941602
}
15951603

15961604
export interface CodeAction {
@@ -1607,6 +1615,8 @@ namespace ts.server.protocol {
16071615
commands?: {}[];
16081616
}
16091617

1618+
// TODO: GH#20538
1619+
/* @internal */
16101620
export interface CodeFixAction extends CodeAction {
16111621
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
16121622
fixId?: {};

src/services/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ namespace ts {
294294

295295
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
296296

297-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeFixAction[];
297+
// TODO: GH#20538 return `CodeFixAction[]`
298+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[];
299+
// TODO: GH#20538
300+
/* @internal */
298301
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings): CombinedCodeActions;
299302
applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
300303
applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
@@ -323,6 +326,8 @@ namespace ts {
323326
dispose(): void;
324327
}
325328

329+
// TODO: GH#20538
330+
/* @internal */
326331
export interface CombinedCodeFixScope { type: "file"; fileName: string; }
327332

328333
export interface GetCompletionsAtPositionOptions {
@@ -412,11 +417,15 @@ namespace ts {
412417
commands?: CodeActionCommand[];
413418
}
414419

420+
// TODO: GH#20538
421+
/* @internal */
415422
export interface CodeFixAction extends CodeAction {
416423
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
417424
fixId?: {};
418425
}
419426

427+
// TODO: GH#20538
428+
/* @internal */
420429
export interface CombinedCodeActions {
421430
changes: FileTextChanges[];
422431
commands: CodeActionCommand[] | undefined;

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,8 +3983,7 @@ declare namespace ts {
39833983
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
39843984
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
39853985
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
3986-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeFixAction[];
3987-
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings): CombinedCodeActions;
3986+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[];
39883987
applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
39893988
applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
39903989
applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
@@ -4000,10 +3999,6 @@ declare namespace ts {
40003999
getProgram(): Program;
40014000
dispose(): void;
40024001
}
4003-
interface CombinedCodeFixScope {
4004-
type: "file";
4005-
fileName: string;
4006-
}
40074002
interface GetCompletionsAtPositionOptions {
40084003
includeExternalModuleExports: boolean;
40094004
}
@@ -4080,14 +4075,6 @@ declare namespace ts {
40804075
*/
40814076
commands?: CodeActionCommand[];
40824077
}
4083-
interface CodeFixAction extends CodeAction {
4084-
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
4085-
fixId?: {};
4086-
}
4087-
interface CombinedCodeActions {
4088-
changes: FileTextChanges[];
4089-
commands: CodeActionCommand[] | undefined;
4090-
}
40914078
type CodeActionCommand = InstallPackageAction;
40924079
interface InstallPackageAction {
40934080
}
@@ -5277,13 +5264,6 @@ declare namespace ts.server.protocol {
52775264
command: CommandTypes.GetCodeFixes;
52785265
arguments: CodeFixRequestArgs;
52795266
}
5280-
interface GetCombinedCodeFixRequest extends Request {
5281-
command: CommandTypes.GetCombinedCodeFix;
5282-
arguments: GetCombinedCodeFixRequestArgs;
5283-
}
5284-
interface GetCombinedCodeFixResponse extends Response {
5285-
body: CombinedCodeActions;
5286-
}
52875267
interface ApplyCodeActionCommandRequest extends Request {
52885268
command: CommandTypes.ApplyCodeActionCommand;
52895269
arguments: ApplyCodeActionCommandRequestArgs;
@@ -5317,14 +5297,6 @@ declare namespace ts.server.protocol {
53175297
*/
53185298
errorCodes?: number[];
53195299
}
5320-
interface GetCombinedCodeFixRequestArgs {
5321-
scope: GetCombinedCodeFixScope;
5322-
fixId: {};
5323-
}
5324-
interface GetCombinedCodeFixScope {
5325-
type: "file";
5326-
args: FileRequestArgs;
5327-
}
53285300
interface ApplyCodeActionCommandRequestArgs {
53295301
/** May also be an array of commands. */
53305302
command: {};
@@ -6067,7 +6039,7 @@ declare namespace ts.server.protocol {
60676039
}
60686040
interface CodeFixResponse extends Response {
60696041
/** The code actions that are available */
6070-
body?: CodeFixAction[];
6042+
body?: CodeAction[];
60716043
}
60726044
interface CodeAction {
60736045
/** Description of the code action to display in the UI of the editor */
@@ -6081,10 +6053,6 @@ declare namespace ts.server.protocol {
60816053
changes: FileCodeEdits[];
60826054
commands?: {}[];
60836055
}
6084-
interface CodeFixAction extends CodeAction {
6085-
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
6086-
fixId?: {};
6087-
}
60886056
/**
60896057
* Format and format on key response message.
60906058
*/

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3983,8 +3983,7 @@ declare namespace ts {
39833983
getDocCommentTemplateAtPosition(fileName: string, position: number): TextInsertion;
39843984
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
39853985
getSpanOfEnclosingComment(fileName: string, position: number, onlyMultiLine: boolean): TextSpan;
3986-
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeFixAction[];
3987-
getCombinedCodeFix(scope: CombinedCodeFixScope, fixId: {}, formatOptions: FormatCodeSettings): CombinedCodeActions;
3986+
getCodeFixesAtPosition(fileName: string, start: number, end: number, errorCodes: number[], formatOptions: FormatCodeSettings): CodeAction[];
39883987
applyCodeActionCommand(action: CodeActionCommand): Promise<ApplyCodeActionCommandResult>;
39893988
applyCodeActionCommand(action: CodeActionCommand[]): Promise<ApplyCodeActionCommandResult[]>;
39903989
applyCodeActionCommand(action: CodeActionCommand | CodeActionCommand[]): Promise<ApplyCodeActionCommandResult | ApplyCodeActionCommandResult[]>;
@@ -4000,10 +3999,6 @@ declare namespace ts {
40003999
getProgram(): Program;
40014000
dispose(): void;
40024001
}
4003-
interface CombinedCodeFixScope {
4004-
type: "file";
4005-
fileName: string;
4006-
}
40074002
interface GetCompletionsAtPositionOptions {
40084003
includeExternalModuleExports: boolean;
40094004
}
@@ -4080,14 +4075,6 @@ declare namespace ts {
40804075
*/
40814076
commands?: CodeActionCommand[];
40824077
}
4083-
interface CodeFixAction extends CodeAction {
4084-
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
4085-
fixId?: {};
4086-
}
4087-
interface CombinedCodeActions {
4088-
changes: FileTextChanges[];
4089-
commands: CodeActionCommand[] | undefined;
4090-
}
40914078
type CodeActionCommand = InstallPackageAction;
40924079
interface InstallPackageAction {
40934080
}

0 commit comments

Comments
 (0)