You are not alone if you use Visual Studio Code on your PC and notice a rapid battery drain. Many users experience high power consumption due to various reasons, often background processes or improper settings. In this article, we will explore the reasons that are affecting the VS code’s battery usage and share practical tips to extend the PC’s battery life. So, if VSCode is consuming too much battery on your computer, this guide is for you.
VSCode consuming too much battery on Windows PC
If VSCode is consuming too much battery on a Windows PC, check out the troubleshooting solutions mentioned below:
- Check how the battery reacts to other heavy apps
- Disable extensions
- Check if a code is running in the background
- Lower the auto-save frequency
- Enable Workplace Trust
- Use a Lightweight theme
- Disable Minimap
- Update VSCode
Let’s get started with the troubleshooting guide.
1] Check how the battery reacts to other heavy apps
First and foremost, check how the battery reacts to other heavy apps to determine whether this issue is specific to VS Code or a general system problem.
- Press Win + I to open Settings, click on the System tab, and then go to the Power and Battery section.
- Here, look for apps apart from VS Code that consume the most battery.
- Users can also navigate to the Task Manager, in the Processes tab, under the Power Usage and Power Usage Trend Columns to find apps that show a Very High status (these options are not visible by default, right-click on Name, and select Power Usage and Power Usage Trend).
If comparing VS Code’s usage with other similar apps is significantly higher, proceed to the next solution.
2] Disable Extensions
Extensions in VS Code can run background tasks, real-time analysis, or other processes that drain the battery faster. Some of them are resource-intensive and keep the CPU and RAM busy even if it is not in use. Therefore, it is highly recommended to disable unnecessary extensions if Visual Studio Code is causing battery drain.
- Launch VS Code and click Ctrl + Shift + X to open the Extensions view.
- Find the extension that needs to be disabled and click on the Settings icon beside it.
- Select the Disable option or Disable Workplace to disable it for the current project.
- Alternatively, users can also open the Command Palette by clicking the Ctrl+ Shift+ P, typing Disable Extension, and selecting Extensions: Disable All Installed Extensions or choose a specific one.
Verify if the issue is resolved. If not, see the next solution.
3] Check if a code is running in the background
Code may still run in the background, even after closing a file or stopping execution. This can happen with active terminals, background tasks, or processes started by extensions, and checking for these running processes helps identify what’s consuming power unnecessarily. Follow the steps mentioned below to check if a code is running in the background.
- Open VS Code and click Ctrl + `(backtick) to open the Integrated Terminal.
- Look for any running resources and click Ctrl + C to stop it.
- Alternatively, click Ctrl + Shift + P to open the Command Palette, type Tasks: Show running tasks, and select it. Select the Task that is running, and click the Terminate Task option.
Check if VS Code is still consuming too much energy. If the answer is yes, move to the next solution.
4] Lower the auto-save frequency
Frequent auto-saving increases CPU and disk activity, which then drains the battery. It is more likely to happen when working on large projects or slower storage devices. In this case, we are going to tweak the autosave settings to prevent excessive resource consumption.
- Launch VS Code, click Ctrl + , to open Settings, or go to Files > Preferences > Settings.
- Search for autosave/ Files: Auto Save Delay, and increase the value to a higher number to reduce autosave frequency.
- Now, search for File: Autosave and select the AfterDelay option from the drop-down menu.
Ensure that the app is working normally, and proceed to the next step accordingly.
5] Enable Workplace Trust
An untrusted Workplace can run potentially harmful or unnecessary extensions, tasks, or scripts in the background. Enabling the Workplace Trust ensures that only trusted code executes and helps reduce CPU and RAM usage.
- Launch the app, click Ctrl + , to open Settings, or go to Files> Preferences > Settings.
- In the Search bar, type Workspace trust or look for security.workspace.trust.enabled, and ensure that the setting is enabled.
- Alternatively, users can enable Workspace Trust via Command Palette by clicking Ctrl + Shift + P. Type Workspaces: Manage Workspace Trust, select it, and click Trust this Workspace if prompted.
Hopefully, this will reduce the consumption; however, if it continues to drain the battery, execute the next solution.
6] Use a lightweight theme
A lightweight theme can also reduce the load on your resources. Check out the steps mentioned below to do the same.
- Click Ctrl + Shift + P to open the command palette and type Preferences: Color Theme.
- Select it and choose a lightweight theme like Light, Dark, or Monokai for lightweight with good contrast.
- Users can also opt for a minimal theme like Visual Studio Light by opening Settings and searching Workbench. colorTheme.
This will make VS Code consume less battery and resources while maintaining a clean UI.
7] Disable Minimap
The minimap in VS Code uses extra resources to constantly update the visual representation of the code as users scroll through it, especially on the larger files. To save battery, turning off the Minimap is a simple yet effective solution. For that, open Settings, search for Minimap, uncheck Editor > Minimap: Enabled option, and save the changes. Alternatively, we can also use the Command Palette by clicking Ctrl + Shift + P, typing and opening the Toggle Minimap, and automatically disabling it. Now, check if Visual Studio code is causing battery drain.
8] Update VSCode
Older versions may have bugs, inefficiencies, or unresolved issues that can cause higher power consumption. Updating VS Code is necessary to ensure better compatibility with the system power’s management system.
- Open VS Code, navigate to the top panel, click on the Help tab, and select the Check for Updates option.
- If an update is available, VS Code will automatically download it.
- To manually update it, go to the VS Code official website, and click on Download for Windows. Get the latest version, run the downloaded .exe file, and follow the installation steps.
Once the installation process is complete, restart the app, and enjoy using VS Code without fretting about power consumption.
Hopefully, after following the suggestions mentioned here, you will be able to significantly reduce Visual Studio Code’s battery drain.
Read: How to fix Battery drain issues in Windows 11/10
How much RAM do I need for VS Code?
At least 4 GB RAM is recommended for smooth performance, especially with extensions and multiple files; however, 8GB or more is recommended to avoid putting too much pressure on the device.
Read: How to download Visual Studio Code Insider
Why is my PC battery draining so fast?
The PC battery may be draining fast due to resource-intensive apps, such as VS Code’s high power usage, background process, or outdated drivers. As mentioned in the article earlier, factors like system settings and inefficient extensions can also increase battery consumption. Optimizing VS Code and other apps is the first step to help extend battery life.
Also Read: Visual Studio Code crashing on Windows.