Skip to content

Commit 7b893d6

Browse files
Trace the performance of interested lsp requests (#1170)
1 parent 4aa81d4 commit 7b893d6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/daemon/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import * as vscode from "vscode";
66
import { sendError, sendInfo } from "vscode-extension-telemetry-wrapper";
77
import { LSDaemon } from "./daemon";
88

9+
const INTERESTED_REQUESTS: Set<string> = new Set([
10+
"initialize",
11+
"textDocument/completion",
12+
]);
913
const delay = promisify(setTimeout);
1014

1115
let daemon: LSDaemon;
@@ -46,6 +50,17 @@ async function checkJavaExtActivated(_context: vscode.ExtensionContext): Promise
4650
return false;
4751
}
4852

53+
// Trace the interested LSP requests performance
54+
javaExt.exports?.onDidRequestEnd((traceEvent: any) => {
55+
if (INTERESTED_REQUESTS.has(traceEvent.type)) {
56+
sendInfo("", {
57+
name: "lsp",
58+
kind: traceEvent.type,
59+
duration: Math.trunc(traceEvent.duration),
60+
});
61+
}
62+
});
63+
4964
// on ServiceReady
5065
javaExt.exports.onDidServerModeChange(async (mode: string) => {
5166
if (mode === "Hybrid") { // begin to start standard language server

0 commit comments

Comments
 (0)