VSCode Freezes With High CPU Usage When Using Intelephense Extension
===========================================================
Describe the Bug
VSCode frequently freezes completely when using the Intelephense extension. During these freezes, one CPU core reaches 100% utilization, causing fans to spin at full speed. The IDE becomes completely unresponsive - unable to select text, change files, or interact with the editor in any way. If the freeze lasts long enough, VSCode prompts to restart, wait, or shut down the application. Freezes can last between 2-40 seconds, the longer I work the longer the freezes will be it seems.
To Reproduce
The freezes occur randomly during normal development activities, with no consistent pattern for immediate reproduction. However, the following actions have been observed to trigger freezes:
- Changing active file tabs (including non-PHP files)
- Renaming files (including non-PHP files)
- Editing files
- Refactoring code using F2 (Rename Symbol)
The freezes don't occur immediately after opening a project but become more frequent over time. Sometimes I can work for hours before experiencing issues, other times only 10 minutes.
Expected Behavior
VSCode should remain responsive during all normal development activities without freezing or causing excessive CPU utilization.
Platform and Version
- Intelephense version: v1.14.3 (Attempted rollback to older versions without success)
- VSCode versions:
- Laptop: 1.92.0
- PC: 1.98.1
- OS and Hardware:
- Laptop: NixOS with 32GB RAM, AMD Ryzen 9 7940HS w/ Radeon 780M Graphics, M.2 SSD
- Desktop: Ubuntu with 64GB RAM, AMD Ryzen 7 7800XD 8-core, M.2 SSD
- Project size: 1203 PHP files (excluding vendor directory)
- Laravel versions: Tested with both Laravel 10 and 11 (in different projects)
- Using VSCode Devcontainers with PHP 8.3
Additional Information
- The issue affects different machines with different operating systems and RAM configurations
- Disabling the Intelephense extension resolves the freezing issues entirely
- Issue began occurring approximately 3-4 months ago
- Memory usage does not appear to spike during freezes (only CPU utilization increases)
- Attempted solutions that did not work:
- Updating the extension settings:
"intelephense.files.exclude": [ "**/.git/**", "**/.svn/**", "**/.hg/**", "**/CVS/**", "**/.DS_Store/**", "**/node_modules/**", "**/bower_components/**", "**/vendor/**/{Test,test,Tests,tests}/**", "*.twig", "*.js", ], "intelephense.files.maxSize": 1000000, "intelephense.maxMemory": 2048,
- Increasing
intelephense.maxMemory
to higher values - Running Devcontainer in
--privileged
mode - No visible errors in VSCode logs related to Intelephense
- Using the Extension Host Profiler did not reveal any obvious issues
- Updating the extension settings:
I am using the paid version of the extension with a valid license.
Devcontainer Configuration Details
devcontainer.json:
{
"name": "Debian",
"build": {
"dockerfile": "Dockerfile",
"args": {
"INSTALL_ZSH": "true",
"USER_UID": "1000",
"USER_GID": "1000"
}
},
"mounts": [
"source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
"source=${localWorkspaceFolderBasename}-vendor,target=${containerWorkspaceFolder}/vendor,type=volume",
],
"workspaceFolder": "/home/vscode/project",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/vscode/project,type=bind,consistency=delegated",
"runArgs": [
"--init",
"--privileged"
],
"forwardPorts": [
8080,
],
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"bradlc.vscode-tailwindcss",
"Vue.volar",
"xdebug.php-debug",
"amiralizadeh9480.laravel-extra-intellisense",
"bmewburn.vscode-intelephense-client"
],
}
},
"remoteUser": "vscode",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/node:1": {},
},
"containerEnv": {
"APP_PORT": "8080"
}
}
Possible Causes and Solutions
The issue of VSCode freezing with high CPU usage when using the Intelephense extension can be caused by several factors, including:
- Insufficient system resources: If the system has limited resources, it can cause the IDE to freeze.
- Extension conflicts: Conflicts between extensions can cause the IDE to freeze.
- Intelephense configuration issues: Issues with the Intelephense configuration can cause the IDE to freeze.
To resolve the issue, you can try the following solutions:
- Disable the Intelephense extension: Disabling the Intelephense extension can resolve the freezing issues entirely.
- Update the extension settings: Updating the extension settings to exclude certain files or increase the maximum memory can help resolve the issue.
- Increase the maximum memory: Increasing the maximum memory allocated to the Intelephense extension can help resolve the issue.
- Run Devcontainer in privileged mode: Running the Devcontainer in privileged mode can help resolve the issue.
- Check for extension conflicts: Checking for extension conflicts and resolving them can help resolve the issue.
Conclusion
The issue of VSCode freezing with high CPU usage when using the Intelephense extension can be caused by several factors, including insufficient system resources, extension conflicts, and Intelephense configuration issues. To resolve the issue, you can try disabling the Intelephense extension, updating the extension settings, increasing the maximum memory, running the Devcontainer in privileged mode, and checking for extension conflicts. By following these solutions, you can help resolve the issue and ensure that your IDE remains responsive and efficient.
Q: What is the Intelephense extension and why is it causing VSCode to freeze?
A: The Intelephense extension is a popular extension for VSCode that provides advanced code completion and code analysis features for PHP developers. However, in some cases, it can cause VSCode to freeze due to high CPU usage.
Q: What are the symptoms of the issue?
A: The symptoms of the issue include VSCode freezing completely, one CPU core reaching 100% utilization, and the IDE becoming unresponsive. The freeze can last between 2-40 seconds, and the longer you work, the longer the freezes will be.
Q: What actions have been observed to trigger freezes?
A: The following actions have been observed to trigger freezes:
- Changing active file tabs (including non-PHP files)
- Renaming files (including non-PHP files)
- Editing files
- Refactoring code using F2 (Rename Symbol)
Q: What is the expected behavior of VSCode?
A: The expected behavior of VSCode is to remain responsive during all normal development activities without freezing or causing excessive CPU utilization.
Q: What are the system requirements for the Intelephense extension?
A: The system requirements for the Intelephense extension are not explicitly stated, but it is recommended to have a minimum of 4 GB of RAM and a multi-core processor.
Q: Can the issue be resolved by disabling the Intelephense extension?
A: Yes, disabling the Intelephense extension can resolve the freezing issues entirely.
Q: What are some possible causes of the issue?
A: Some possible causes of the issue include:
- Insufficient system resources
- Extension conflicts
- Intelephense configuration issues
Q: What are some possible solutions to the issue?
A: Some possible solutions to the issue include:
- Disabling the Intelephense extension
- Updating the extension settings
- Increasing the maximum memory
- Running Devcontainer in privileged mode
- Checking for extension conflicts
Q: Can the issue be resolved by updating the extension settings?
A: Yes, updating the extension settings to exclude certain files or increase the maximum memory can help resolve the issue.
Q: Can the issue be resolved by increasing the maximum memory?
A: Yes, increasing the maximum memory allocated to the Intelephense extension can help resolve the issue.
Q: Can the issue be resolved by running Devcontainer in privileged mode?
A: Yes, running the Devcontainer in privileged mode can help resolve the issue.
Q: Can the issue be resolved by checking for extension conflicts?
A: Yes, checking for extension conflicts and resolving them can help resolve the issue.
Q: What is the best course of action to resolve the issue?
A: The best course of action to resolve the issue is to try disabling the Intelephense extension, updating the extension settings, increasing the maximum memory, running Devcontainer in privileged mode, and checking for extension conflicts. If none of these solutions work, it may be necessary to seek further assistance from the VSCode community or the Intelephense extension developers.
Q: Is there a known fix for the issue?
A: There is no known fix for the issue, but the solutions mentioned above may help resolve the issue.
Q: Can the issue be resolved by updating to the latest version of VSCode?
A: Updating to the latest version of VSCode may help resolve the issue, but it is not a guaranteed solution.
Q: Can the issue be resolved by updating to the latest version of the Intelephense extension?
A: Updating to the latest version of the Intelephense extension may help resolve the issue, but it is not a guaranteed solution.
Q: What is the best way to troubleshoot the issue?
A: The best way to troubleshoot the issue is to try disabling the Intelephense extension, updating the extension settings, increasing the maximum memory, running Devcontainer in privileged mode, and checking for extension conflicts. If none of these solutions work, it may be necessary to seek further assistance from the VSCode community or the Intelephense extension developers.