-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
Does this issue occur when all extensions are disabled?: No
(Requires 'GitHub Copilot Chat' and 'TypeScript and JavaScript Language Features' enabled)
- VS Code Version: 1.106.1 (Universal)
- OS Version: macOS 15.7.1 (24G231)
Steps to Reproduce:
- Open a TypeScript project in VS Code.
- Open the GitHub Copilot Chat extension panel.
- Request code generation that includes imports (e.g., "Create a service class that imports User entity from local files").
- Observe the status bar getting stuck on "Loading IntelliSense status" indefinitely.
- The
tsserverCPU usage spikes. - If left running, VS Code eventually displays the error:
"The JS/TS language service crashed 5 times in the last 5 Minutes. This may be caused by a plugin contributed by one of these extensions: GitHub.copilot-chat..."
Root Cause Analysis
The issue appears to be a conflict between the typescript-language-features extension and the virtual documents generated by Copilot Chat (vscode-chat-code-block scheme).
- The TS Server creates an
InferredProjectfor the code block in the chat window. - Since the virtual file contains imports (
import ... from ...) but has no physical path, the module resolution logic falls back to a recursive directory search. - Evidence in Logs: The
DirectoryWatcherattaches to the virtual path and then escalates to system root folders, creating an infinite loop/memory leak as it tries to findnode_modulesin parent directories relative to a virtual root.
Log Snippets:
// Watcher starts at the virtual chat block
Info DirectoryWatcher:: Added:: WatchInfo: ^/vscode-chat-code-block/... Project: /dev/null/inferredProject1* WatchType: Failed Lookup Locations
// Watcher escapes workspace and scans system/app directories attempting to resolve dependencies
Info DirectoryWatcher:: Added:: WatchInfo: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules
Attempted Workarounds (All Failed)
I attempted to exclude these virtual paths using standard VS Code settings, but the issue persists. It strongly suggests that the @vscode/copilot-typescript-server-plugin injects the document into the server with elevated permissions, bypassing user-level exclusions.
Failed attempts:
- Adding /vscode-chat-code-block/ to files.watcherExclude.
- Adding /.copilot/ and /.github/ to files.exclude.
- Configuring tsconfig.json with strict include (only src) and explicit exclude (ignoring .github).
- Setting files.associations for chat blocks/instructions to plaintext (The extension seems to force the context back to TypeScript).
- I tried using all these settings to prevent the TS Server from crashing loop. But nothing worked:
{
// I tried using all these settings to prevent the TS Server from crashing loop. But nothing worked
/* --------------------------------------- */
/* --- TS Server Crash Loop Prevention --- */
/* --------------------------------------- */
"typescript.tsserver.experimental.enableProjectDiagnostics": false, // Disable project diagnostics (experimental)
"typescript.disableAutomaticTypeAcquisition": true, // Disable automatic type acquisition
"typescript.tsserver.maxTsServerMemory": 8192, // TS Server 8GB RAM
"markdown.validate.enabled": false, // Disable markdown validation
"files.watcherExclude": {
"**/.github/**": true, // Exclude GitHub instructions from file watcher
"**/.github/instructions/**": true, // Exclude GitHub instructions from file watcher
"**/copilot.instructions.md": true // Exclude Copilot instructions from file watcher
},
"typescript.preferences.includePackageJsonAutoImports": "off", // Disable auto imports from package.json
"typescript.preferences.importModuleSpecifierEnding": "minimal", // Use the shortest possible path for imports
"files.associations": {
"**/copilot.instructions.md": "plaintext", // Disable TS Server for this file
"**/.github/instructions/*.md": "plaintext" // Disable TS Server for GitHub instruction files
"**/vscode-chat-code-block/**": "plaintext", // Disable TS Server for VSCode Chat code block files
"**/copilot/**": "plaintext" // Disable TS Server for Copilot files
},
"js/ts.implicitProjectConfig.checkJs": false, // Disable error checking in loose JS files
"js/ts.implicitProjectConfig.experimentalDecorators": false, // Disable experimental decorators in loose JS files
}The "Nuclear" Proof
The only setting that stops the crash immediately is:
"typescript.tsserver.useSyntaxServer": "always"
When this is enabled, the crash stops instantly, and CPU usage normalizes. This confirms that the Semantic Analysis of the chat buffer (Inferred Project) is the root cause. However, this is not a viable solution as it completely disables project-wide IntelliSense and Go-to-Definition features.
Proposed Solution
The typescript-language-features extension should explicitly treat vscode-chat-code-block (and similar virtual schemes used by Copilot) as Syntax Only documents.
They should be explicitly blocked from triggering InferredProject logic or invoking the Semantic Server watcher, preventing the recursive directory resolution loop on virtual files.