Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit eac118a

Browse files
kyliauKeen Yee Liau
authored andcommitted
feat: enable tracing of LSP messages and payload
This commit adds a new configuration `angular.trace.server` to enable tracing of the messages sent between the LSP client and LSP server. This configuration is not used by Angular itself. Rather, it's read by the `vscode-languageclient` package. See https://github.com/microsoft/vscode-languageserver-node/blob/adb52f1276291b5bf8eaa97e053db8bb699b6872/client/src/common/client.ts#L3431 Once enabled, the request name, request duration, and optionally the request payload will be logged to the Output console in vscode. Example log: ``` [Trace - 3:58:03 PM] Received notification 'window/logMessage'. [Trace - 3:58:03 PM] Received response 'initialize - (0)' in 777ms. [Trace - 3:58:03 PM] Sending notification 'initialized'. [Trace - 3:58:03 PM] Sending notification 'textDocument/didOpen'. [Trace - 3:58:03 PM] Received notification 'angular/projectLoadingStart'. [Trace - 3:58:08 PM] Received notification 'angular/projectLoadingFinish'. [Trace - 3:58:09 PM] Received notification '$/progress'. [Trace - 3:58:09 PM] Received notification 'window/logMessage'. [Trace - 3:58:10 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 3:58:14 PM] Sending request 'textDocument/hover - (2)'. [Trace - 3:58:14 PM] Received response 'textDocument/hover - (2)' in 39ms. [Trace - 3:58:15 PM] Sending request 'textDocument/definition - (3)'. [Trace - 3:58:15 PM] Received response 'textDocument/definition - (3)' in 3ms. [Trace - 3:58:15 PM] Sending notification 'textDocument/didOpen'. [Trace - 3:58:15 PM] Received notification 'textDocument/publishDiagnostics'. [Trace - 3:58:16 PM] Sending notification 'textDocument/didClose'. [Trace - 3:58:17 PM] Sending request 'textDocument/hover - (4)'. [Trace - 3:58:17 PM] Received response 'textDocument/hover - (4)' in 13ms. ```
1 parent b470c9c commit eac118a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

client/src/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class AngularLanguageClient implements vscode.Disposable {
6464
// Create the language client and start the client.
6565
const forceDebug = process.env['NG_DEBUG'] === 'true';
6666
this.client = new lsp.LanguageClient(
67+
// This is the ID for Angular-specific configurations, like angular.log,
68+
// angular.ngdk, etc. See contributes.configuration in package.json.
69+
'angular',
6770
this.name,
6871
serverOptions,
6972
this.clientOptions,

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@
5656
"type": "boolean",
5757
"default": false,
5858
"description": "This is an experimental feature that enables the Ivy language service."
59+
},
60+
"angular.trace.server": {
61+
"type": "string",
62+
"scope": "window",
63+
"enum": [
64+
"off",
65+
"messages",
66+
"verbose"
67+
],
68+
"default": "off",
69+
"description": "Traces the communication between VS Code and the Angular language server."
5970
}
6071
}
6172
},

0 commit comments

Comments
 (0)