Skip to content

Commit 8a61761

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

File tree

5 files changed

+30
-56
lines changed

5 files changed

+30
-56
lines changed

Diff for: src/server/client.ts

+2-1
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;

Diff for: src/server/protocol.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ namespace ts.server.protocol {
101101
GetCodeFixes = "getCodeFixes",
102102
/* @internal */
103103
GetCodeFixesFull = "getCodeFixes-full",
104+
// TODO: GH#20538
105+
/* @internal */
104106
GetCombinedCodeFix = "getCombinedCodeFix",
105107
/* @internal */
106108
GetCombinedCodeFixFull = "getCombinedCodeFix-full",
@@ -536,11 +538,15 @@ namespace ts.server.protocol {
536538
arguments: CodeFixRequestArgs;
537539
}
538540

541+
// TODO: GH#20538
542+
/* @internal */
539543
export interface GetCombinedCodeFixRequest extends Request {
540544
command: CommandTypes.GetCombinedCodeFix;
541545
arguments: GetCombinedCodeFixRequestArgs;
542546
}
543547

548+
// TODO: GH#20538
549+
/* @internal */
544550
export interface GetCombinedCodeFixResponse extends Response {
545551
body: CombinedCodeActions;
546552
}
@@ -597,11 +603,15 @@ namespace ts.server.protocol {
597603
errorCodes?: number[];
598604
}
599605

606+
// TODO: GH#20538
607+
/* @internal */
600608
export interface GetCombinedCodeFixRequestArgs {
601609
scope: GetCombinedCodeFixScope;
602610
fixId: {};
603611
}
604612

613+
// TODO: GH#20538
614+
/* @internal */
605615
export interface GetCombinedCodeFixScope {
606616
type: "file";
607617
args: FileRequestArgs;
@@ -1590,7 +1600,7 @@ namespace ts.server.protocol {
15901600

15911601
export interface CodeFixResponse extends Response {
15921602
/** The code actions that are available */
1593-
body?: CodeFixAction[];
1603+
body?: CodeAction[]; // TODO: GH#20538 CodeFixAction[]
15941604
}
15951605

15961606
export interface CodeAction {
@@ -1602,11 +1612,15 @@ namespace ts.server.protocol {
16021612
commands?: {}[];
16031613
}
16041614

1615+
// TODO: GH#20538
1616+
/* @internal */
16051617
export interface CombinedCodeActions {
16061618
changes: FileCodeEdits[];
16071619
commands?: {}[];
16081620
}
16091621

1622+
// TODO: GH#20538
1623+
/* @internal */
16101624
export interface CodeFixAction extends CodeAction {
16111625
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
16121626
fixId?: {};

Diff for: src/services/types.ts

+10-1
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;

Diff for: tests/baselines/reference/api/tsserverlibrary.d.ts

+2-39
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
}
@@ -4929,7 +4916,6 @@ declare namespace ts.server.protocol {
49294916
DocCommentTemplate = "docCommentTemplate",
49304917
CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects",
49314918
GetCodeFixes = "getCodeFixes",
4932-
GetCombinedCodeFix = "getCombinedCodeFix",
49334919
ApplyCodeActionCommand = "applyCodeActionCommand",
49344920
GetSupportedCodeFixes = "getSupportedCodeFixes",
49354921
GetApplicableRefactors = "getApplicableRefactors",
@@ -5277,13 +5263,6 @@ declare namespace ts.server.protocol {
52775263
command: CommandTypes.GetCodeFixes;
52785264
arguments: CodeFixRequestArgs;
52795265
}
5280-
interface GetCombinedCodeFixRequest extends Request {
5281-
command: CommandTypes.GetCombinedCodeFix;
5282-
arguments: GetCombinedCodeFixRequestArgs;
5283-
}
5284-
interface GetCombinedCodeFixResponse extends Response {
5285-
body: CombinedCodeActions;
5286-
}
52875266
interface ApplyCodeActionCommandRequest extends Request {
52885267
command: CommandTypes.ApplyCodeActionCommand;
52895268
arguments: ApplyCodeActionCommandRequestArgs;
@@ -5317,14 +5296,6 @@ declare namespace ts.server.protocol {
53175296
*/
53185297
errorCodes?: number[];
53195298
}
5320-
interface GetCombinedCodeFixRequestArgs {
5321-
scope: GetCombinedCodeFixScope;
5322-
fixId: {};
5323-
}
5324-
interface GetCombinedCodeFixScope {
5325-
type: "file";
5326-
args: FileRequestArgs;
5327-
}
53285299
interface ApplyCodeActionCommandRequestArgs {
53295300
/** May also be an array of commands. */
53305301
command: {};
@@ -6067,7 +6038,7 @@ declare namespace ts.server.protocol {
60676038
}
60686039
interface CodeFixResponse extends Response {
60696040
/** The code actions that are available */
6070-
body?: CodeFixAction[];
6041+
body?: CodeAction[];
60716042
}
60726043
interface CodeAction {
60736044
/** Description of the code action to display in the UI of the editor */
@@ -6077,14 +6048,6 @@ declare namespace ts.server.protocol {
60776048
/** A command is an opaque object that should be passed to `ApplyCodeActionCommandRequestArgs` without modification. */
60786049
commands?: {}[];
60796050
}
6080-
interface CombinedCodeActions {
6081-
changes: FileCodeEdits[];
6082-
commands?: {}[];
6083-
}
6084-
interface CodeFixAction extends CodeAction {
6085-
/** If present, one may call 'getCombinedCodeFix' with this fixId. */
6086-
fixId?: {};
6087-
}
60886051
/**
60896052
* Format and format on key response message.
60906053
*/

Diff for: tests/baselines/reference/api/typescript.d.ts

+1-14
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)