diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 973d1ddedb207..e4317934f08ef 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -237,10 +237,15 @@ namespace ts.server.protocol { */ metadata?: unknown; + /* @internal */ + performanceData?: PerformanceData; + } + + /* @internal */ + export interface PerformanceData { /** * Time spent updating the program graph, in milliseconds. */ - /* @internal */ updateGraphDurationMs?: number; } diff --git a/src/server/session.ts b/src/server/session.ts index 932598104e826..b256dfe139cef 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -807,7 +807,11 @@ namespace ts.server { command: cmdName, request_seq: reqSeq, success, - updateGraphDurationMs: this.updateGraphDurationMs, + performanceData: !this.updateGraphDurationMs + ? undefined + : { + updateGraphDurationMs: this.updateGraphDurationMs, + }, }; if (success) { diff --git a/src/testRunner/unittests/tsserver/session.ts b/src/testRunner/unittests/tsserver/session.ts index 68c5ff274fe5e..258ac29d26ffc 100644 --- a/src/testRunner/unittests/tsserver/session.ts +++ b/src/testRunner/unittests/tsserver/session.ts @@ -101,7 +101,7 @@ namespace ts.server { message: "Unrecognized JSON command: foobar", request_seq: 0, success: false, - updateGraphDurationMs: undefined, + performanceData: undefined, }; expect(lastSent).to.deep.equal(expected); }); @@ -128,7 +128,7 @@ namespace ts.server { request_seq: 0, seq: 0, body: undefined, - updateGraphDurationMs: undefined, + performanceData: undefined, }); }); it("should handle literal types in request", () => { @@ -329,7 +329,7 @@ namespace ts.server { request_seq: 0, seq: 0, body: undefined, - updateGraphDurationMs: undefined, + performanceData: undefined, }); }); }); @@ -420,7 +420,7 @@ namespace ts.server { command, body, success: true, - updateGraphDurationMs: undefined, + performanceData: undefined, }); }); }); @@ -540,7 +540,7 @@ namespace ts.server { command, body, success: true, - updateGraphDurationMs: undefined, + performanceData: undefined, }); }); it("can add and respond to new protocol handlers", () => {