Skip to content

Commit ddac387

Browse files
authored
Deprecate CommandNames in favor of protocol.CommandTypes, direct import for better bundler output (#52208)
1 parent 5b18979 commit ddac387

23 files changed

+447
-443
lines changed

src/harness/client.ts

Lines changed: 40 additions & 41 deletions
Large diffs are not rendered by default.

src/server/editorServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import {
3636
ProjectFilesWithTSDiagnostics,
3737
ProjectKind,
3838
ProjectOptions,
39-
protocol,
4039
ScriptInfo,
4140
ScriptInfoVersion,
4241
ServerHost,
@@ -179,6 +178,7 @@ import {
179178
WatchType,
180179
WildcardDirectoryWatcher,
181180
} from "./_namespaces/ts";
181+
import * as protocol from "./protocol";
182182

183183
export const maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
184184
/** @internal */

src/server/project.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
ProjectOptions,
1515
ProjectReferenceProjectLoadKind,
1616
ProjectService,
17-
protocol,
1817
ScriptInfo,
1918
ServerHost,
2019
Session,
@@ -148,6 +147,7 @@ import {
148147
WatchOptions,
149148
WatchType,
150149
} from "./_namespaces/ts";
150+
import * as protocol from "./protocol";
151151

152152
export enum ProjectKind {
153153
Inferred,

src/server/scriptInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
NormalizedPath,
1212
Project,
1313
ProjectKind,
14-
protocol,
1514
ScriptVersionCache,
1615
ServerHost,
1716
} from "./_namespaces/ts.server";
@@ -52,6 +51,7 @@ import {
5251
TextSpan,
5352
unorderedRemoveItem,
5453
} from "./_namespaces/ts";
54+
import * as protocol from "./protocol";
5555

5656
export interface ScriptInfoVersion {
5757
svc: number;

src/server/scriptVersionCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {
1111
} from "./_namespaces/ts";
1212
import {
1313
emptyArray,
14-
protocol,
1514
} from "./_namespaces/ts.server";
15+
import * as protocol from "./protocol";
1616

1717
const lineCollectionCapacity = 4;
1818

src/server/session.ts

Lines changed: 176 additions & 174 deletions
Large diffs are not rendered by default.

src/testRunner/unittests/tsserver/compileOnSave.ts

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

src/testRunner/unittests/tsserver/declarationFileMaps.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references
194194
it("goToDefinition -- target does not exist", () => {
195195
const session = makeSampleProjects();
196196
session.executeCommandSeq<ts.server.protocol.DefinitionRequest>({
197-
command: ts.server.CommandNames.Definition,
197+
command: ts.server.protocol.CommandTypes.Definition,
198198
arguments: protocolFileLocationFromSubstring(userTs, "fnB()")
199199
});
200200
verifySingleInferredProject(session);
@@ -204,7 +204,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references
204204
it("navigateTo", () => {
205205
const session = makeSampleProjects();
206206
session.executeCommandSeq<ts.server.protocol.NavtoRequest>({
207-
command: ts.server.CommandNames.Navto,
207+
command: ts.server.protocol.CommandTypes.Navto,
208208
arguments: { file: userTs.path, searchValue: "fn" }
209209
});
210210
verifySingleInferredProject(session);
@@ -214,7 +214,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references
214214
it("navigateToAll -- when neither file nor project is specified", () => {
215215
const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true);
216216
session.executeCommandSeq<ts.server.protocol.NavtoRequest>({
217-
command: ts.server.CommandNames.Navto,
217+
command: ts.server.protocol.CommandTypes.Navto,
218218
arguments: { file: undefined, searchValue: "fn" }
219219
});
220220
baselineTsserverLogs("declarationFileMaps", "navigateToAll neither file not project is specified", session);
@@ -223,7 +223,7 @@ describe("unittests:: tsserver:: with declaration file maps:: project references
223223
it("navigateToAll -- when file is not specified but project is", () => {
224224
const session = makeSampleProjects(/*addUserTsConfig*/ true, /*keepAllFiles*/ true);
225225
session.executeCommandSeq<ts.server.protocol.NavtoRequest>({
226-
command: ts.server.CommandNames.Navto,
226+
command: ts.server.protocol.CommandTypes.Navto,
227227
arguments: { projectFileName: bTsconfig.path, file: undefined, searchValue: "fn" }
228228
});
229229
baselineTsserverLogs("declarationFileMaps", "navigateToAll file is not specified but project is", session);

src/testRunner/unittests/tsserver/events/projectUpdatedInBackground.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => {
2929
function createVerifyInitialOpen(session: TestSession, verifyProjectsUpdatedInBackgroundEventHandler: (events: ts.server.ProjectsUpdatedInBackgroundEvent[]) => void) {
3030
return (file: File) => {
3131
session.executeCommandSeq({
32-
command: ts.server.CommandNames.Open,
32+
command: ts.server.protocol.CommandTypes.Open,
3333
arguments: {
3434
file: file.path
3535
}
@@ -237,7 +237,7 @@ describe("unittests:: tsserver:: events:: ProjectsUpdatedInBackground", () => {
237237

238238
function updateContentOfOpenFile(file: File, newContent: string) {
239239
session.executeCommandSeq<ts.server.protocol.ChangeRequest>({
240-
command: ts.server.CommandNames.Change,
240+
command: ts.server.protocol.CommandTypes.Change,
241241
arguments: {
242242
file: file.path,
243243
insertString: newContent,

src/testRunner/unittests/tsserver/getEditsForFileRename.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe("unittests:: tsserver:: getEditsForFileRename", () => {
8282
openFilesForSession([aUserTs, bUserTs], session);
8383

8484
session.executeCommandSeq<ts.server.protocol.GetEditsForFileRenameRequest>({
85-
command: ts.server.CommandNames.GetEditsForFileRename,
85+
command: ts.server.protocol.CommandTypes.GetEditsForFileRename,
8686
arguments: {
8787
oldFilePath: aOldTs.path,
8888
newFilePath: "/a/new.ts",
@@ -101,7 +101,7 @@ describe("unittests:: tsserver:: getEditsForFileRename", () => {
101101
openFilesForSession([aTs, cTs], session);
102102

103103
session.executeCommandSeq<ts.server.protocol.GetEditsForFileRenameRequest>({
104-
command: ts.server.CommandNames.GetEditsForFileRename,
104+
command: ts.server.protocol.CommandTypes.GetEditsForFileRename,
105105
arguments: {
106106
oldFilePath: "/b.ts",
107107
newFilePath: cTs.path,

0 commit comments

Comments
 (0)