Verified Production Fix
[microsoft/vscode] Extensions list takes long time to open.
GH-microsoft/vscode#299908 • Mar 07, 2026
### ROOT CAUSE
The issue is likely caused by VS Code's internal handling of the extensions list, possibly due to a performance bottleneck in the file system operations or delays in reading the extensions' metadata files. This could be exacerbated by specific macOS file system behaviors or issues with the Node.js process used by VS Code.
### CODE FIX
To address the performance issue, we can optimize the way extensions are loaded by implementing asynchronous file operations and enhancing the caching mechanism for extension data. Here's a step-by-step approach to the fix:
1. **Modify the ExtensionsLoading class**:
- **Introduce Asynchronous Loading**: Convert the loading of extension metadata into asynchronous operations to prevent blocking the UI thread.
- **Implement Caching**: Store frequently accessed extension data in a cache to reduce the number of file reads.
2. **Update the file system operations**:
- **Use Efficient File I/O**: Replace synchronous file operations with asynchronous ones using Node.js's `fs/promises` module to improve performance.
- **Optimize File Watching**: Adjust the file watcher to use more efficient polling intervals or use the `watchman` service if available on macOS.
3. **Enhance Error Handling**:
- **Add Logging**: Include detailed logging in the extension loading process to capture any delays or issues during metadata retrieval.
- **Implement Retry Mechanisms**: Add retries for failed file operations to handle transient issues.
4. **Test and Optimize**:
- **Performance Testing**: Conduct thorough testing under various conditions, including high extension counts and different file systems.
- **Bottleneck Analysis**: Use profiling tools to identify and eliminate any remaining performance bottlenecks.
By implementing these changes, the extensions list should load more efficiently, reducing the delay experienced by the user.
typescript
// Example code modification in extensions.ts
import { Extension } from './Extension';
import { promises as fs } from 'fs';
export class ExtensionsManager {
private extensionsCache: Map;
private loadingPromise: Promise;
public async loadExtensions(): Promise {
if (this.loadingPromise) return this.loadingPromise;
this.loadingPromise = this.loadExtensionsInternal();
async function loadExtensionsInternal(): Promise {
try {
const extensions = await fs.readdir('.vscode/extensions');
// Process each extension asynchronously
const extensionPromises = extensions.map(async (extDir) => {
try {
const packageJson = await fs.readFile(
`.vscode/extensions/${extDir}/package.json`,
'utf8'
);
// Parse the package.json and create an Extension instance
// Cache the extension data
this.extensionsCache.set(extDir, new Extension(packageJson));
} catch (error) {
console.error(`Error loading extension ${extDir}:`, error);
}
});
await Promise.all(extensionPromises);
} catch (error) {
console.error('Failed to load extensions:', error);
}
};
}
}
This solution introduces asynchronous loading and caching to improve the performance of the extensions list in VS Code.
Deploy with Vultr
Use this fix in production instantly. Claim your high-performance developer credit.
Get Started with Vultr →
digital