feat: support heap profile and snapshot capture for tsserver#299003
feat: support heap profile and snapshot capture for tsserver#299003deepak1556 wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring heap profiling and heap snapshot capture for the TypeScript language server (tsserver) running on Electron (desktop). It exposes three new VS Code settings to control Node.js diagnostic flags passed to the tsserver process.
Changes:
- Adds
TsServerHeapProfileConfigurationinterface and three new fields (diagnosticDir,heapSnapshot,heapProfile) toTypeScriptServiceConfiguration, with corresponding reader methods inBaseServiceConfigurationProvider - Passes the new Node.js flags (
--diagnostic-dir,--heapsnapshot-near-heap-limit,--heap-prof,--heap-prof-dir,--heap-prof-interval) to the tsserver process based on configuration - Registers three new VS Code settings (
js/ts.tsserver.diagnosticDir,js/ts.tsserver.heapSnapshot,js/ts.tsserver.heapProfile) with schema definitions and NLS descriptions
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
extensions/typescript-language-features/src/tsServer/serverProcess.electron.ts |
Adds code to append new diagnostic/profiling flags to the Node.js exec args for tsserver |
extensions/typescript-language-features/src/configuration/configuration.ts |
Adds TsServerHeapProfileConfiguration interface, three new config fields, and reader methods |
extensions/typescript-language-features/package.nls.json |
Adds NLS string descriptions for the three new settings |
extensions/typescript-language-features/package.json |
Registers three new VS Code configuration settings with schema and metadata |
| if (configuration.heapProfile.enabled) { | ||
| args.push('--heap-prof'); | ||
| if (configuration.heapProfile.dir) { | ||
| args.push(`--heap-prof-dir=${configuration.heapProfile.dir}`); |
There was a problem hiding this comment.
Does this work correctly if the path has spaces or special characters in it?
There was a problem hiding this comment.
Yes arguments are preserved, also Node.js does not perform any file path checks on the value so what we have here is good enough.
|
However, testing it found the current shutdown sequence is a forceful one with |
Screen.Recording.2026-03-04.at.13.11.28.mov |
No description provided.