Move individual duration properties into a performanceData object (#36210)

This commit is contained in:
Andrew Casey 2020-01-15 16:48:00 -08:00 committed by GitHub
parent f220e62ce7
commit f99072593d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View File

@ -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;
}

View File

@ -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) {

View File

@ -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", () => {