How can I disable GPU rendering in Visual Studio Code - visual-studio-code

I'm with bad rendering issues... Seems that the Visual Studio Code window do not clean a screen area before redraw it. The same thing happens here with chrome browser, but in chrome I can start it with " --disable-gpu-rendering " and it goes well.
How can I disable GPU rendering in Visual Studio Code ?
I'm thinking it's a hardware specific problem, and I'm looking for a other way to solve it too.
May be useful know my hardware:
Machine: Notebook dell vostro 3500 (intel chipset)
CPU: Intel i5
RAM: 8G
linux kernel: 4.0
video graphics: intel i915 (latest)
X -version: X.Org X Server 1.14.0

Note that VSCode 1.40 (Oct. 2019) proposes an alternative to the parameter/flag --disable-gpu:
Disable GPU acceleration
We have heard issue reports from users that seem related to how the GPU is used to render VS Code's UI.
These users have a much better experience when running VS Code with the additional --disable-gpu command-line argument.
Running with this argument will disable the GPU hardware acceleration and fall back to a software renderer.
To make life easier, you can add this flag as a setting so that it does not have to be passed on the command line each time.
To add this flag:
Open the Command Palette (Ctrl+Shift+P).
Run the Preferences: Configure Runtime Arguments command.
This command will open a argv.json file to configure runtime arguments.
You might see some default arguments there already.
Add
"disable-hardware-acceleration": true
Restart VS Code.
Note: Do not use this setting unless you are seeing issues!
Note that Gilbert points out in the comments to "How To Fix Screen Flickering Issue On Mac, MacBook, And iMac" from Preeti Seth.
Gilbert adds:
I fixed the problem by disabling automatic graphics switching on my macbook pro.
The setting is located in system preferences -> battery.
It worked!

Under Windows, I can confirm that launching VSCode with --disable-gpu does not create a GPU process:
C:\Users\alex\AppData\Local\Code\app-0.1.0>Code.exe --disable-gpu
Perhaps the same flag works on Linux too?

On Ubuntu, the file to edit is /usr/share/applications/code.desktop.
Change:
Exec=/usr/share/code/code --unity-launch %F
to:
Exec=/usr/share/code/code --disable-gpu --unity-launch %F

For Windows users
Visual studio code is based on chrome, to make it work you'll have to disable hardware acceleration.
Add --disable-gpu --disable-gpu-compositing to the vs code shortcut on your desktop.
Example:
"C:\Program Files (x86)\Microsoft VS Code\Code.exe" --disable-gpu --disable-gpu-compositing

Inside settings.json you can write this:-
"terminal.integrated.gpuAcceleration": "off"

on Mac running in virtualbox you can edit the file in ~/.vscode/argv.json
Add
"disable-hardware-acceleration": true

macOS users can try the following commands in the terminal :
Goto Applications folder :
cd Applications
Open VS Code with GPU Disabled :
Visual\ Studio\ Code.app/Contents/MacOS/Electron --disable-gpu
Note : You might need to supply sudo with second command.

On Linux Mint I had to right click the lower left mint button, then choose configure, then press the menu button. Then press the "Open Menu Editor" button and find Visual Studio Code in the programming group. Click properties and find the command field. There you can set the --disable-gpu option.

If environment variables are mapped correctly, you can simply use cmd.exe to start an instance of code with --disable-gpu . See the screenshot. enter image description here

Sometimes the problem is caused by automatic graphic switching as the computer tries to save energy.
In my case my macbook pro has battery problems so they manifested as the screen flickering whenever I ran an intensive application like vscode.
To disable automatic graphic switching, go to system preferences -> battery and untick Automatic graphic switching.
Refer to this guide: https://wethegeek.com/how-to-fix-screen-flickering-issue-on-mac-macbook-and-imac/

Related

VS Code Powershell "←]633;P;IsWindows=True"

I am working on a web application using Angular in Vs code.
I ran into some errors while I am fixing them in the process my vscode is bricked after a couple of minutes it return to its normal state but some weird beep sounds raised so i restarted my Laptop.
When I opened VS code again beep sound repeated and my powershell is showing some weird text
So, I thought the error this is due to some misconfigurations in my vscode and I uninstalled VScode ,deleted all related data
After installation the same weird text with beep sounds appeared again
The weird text
←]633;P;IsWindows=True
633;A633;P;Cwd=D:\user\website\quizPS D:\chiru\website\quiz> 633;B
←]633;C```
As #meganrogge said in https://github.com/microsoft/vscode/issues/160419 setting terminal.integrated.shellIntegration.enabled to false fixes this
I had in the settings Terminal > Integrated: Windows Enable Conpty (setting ID terminal.integrated.windowsEnableConpty) disabled. After re-enabling it again (which is the default) the problem went away for me.
Do you have scala sbt installed? it does not work well with ms power shell. On Windows it can be used via git bash for example. Go to your user vs code settings and adjust so following terminal integration will be active
"terminal.integrated.profiles.windows":{"Git Bash":{"path":"C:\\Program Files\\Git\\bin\\bash.exe"}, },
"terminal.integrated.defaultProfile.windows": "Git Bash",
the close your ms power shell tab in vs code terminal panel and add new bash one.
looks like there is a problem with powershell so i reinstalled my powershell it worked
I solved in this way:
Ctrl + Mayus + P
I faced the same issue. I uninstalled VS Code and installed again and the issue was resolved for me

Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope

When I update my VSCode to v1.56.2 and open webview, I get these messages:
Error loading webview: Error: Could not register service workers:
TypeError: Failed to register a ServiceWorker for scope
('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/') with script
('vscode-webview://867f875b-c5a3-4504-8de2-2e8614bdc0f8/service-worker.js?platform=electron&id=867f875b-c5a3-4504-8de2-2e8614bdc0f8&vscode-resource-origin=https%3A%2F%2F867f875b-c5a3-4504-8de2-2e8614bdc0f8.vscode-webview-test.com'):
ServiceWorker cannot be started.
How can I solve this issue?
If you are using Ubuntu, there is probably another (maybe hidden) vscode process, which is causing the problem.
Close the vs code first and in terminal try: killall code.
In Windows, you can simply fix this error by clearing the cache for VSCode. Please follow the steps below:
Close VSCode and also kill any background processes running in the task manager.
Go to the file explorer and to the path C:\Users\<user_name>\AppData\Roaming\Code and clear the contents of the folders Cache, CachedData, CachedExtensions, CachedExtensionVSIXs (if this folder exists) and Code Cache.
Open VSCode and you are good to go.
I encountered this issue and am not a Windows user, so this is my resolution:
I found that there was an instance of VS Code open that was erroneously not shown on my dock. I closed this instance and opened a new instance. The problem was gone.
I think the issue happened because I had a VS Code instance open, allowed a software update to run in the background, postponed the restart, opened a new and updated VS Code instance, and the old instance remained open causing conflicts.
OS: Ubuntu 20.04.2 LTS
#tritemio on GitHub has a great answer:
https://github.com/microsoft/vscode/issues/125993#issuecomment-912439561
in short, delete cache folder:
rm -rf ~/.config/Code/Cache
This is a known bug in VS Code 1.56. It happens for some Windows users when running VS Code as an administrator
As a workaround, you can try launching VS Code with the --no-sandbox command line flag:
$ code --no-sandbox
#tritemio, thanks for sharing.
This also seemed to solve my issues on Windows for "Extensions - Details View", "VS Code Release Notes View", "Gitlab integrated Interactive Rebase Editor", etc.
I followed your suggestion and deleted the following folders;
%appdata%\Code - Insiders\Cache
%appdata%\Code - Insiders\Code Cache
On *nix systems, first close VS Code app then run pgrep -f '/Applications/Visual Studio Code.app' | xargs kill to clean up vscode's processes. Reopen vscode and the issue will be gone.
If on macOS, you can run the above command verbatim. If you're not on macOS or installed vscode on a different location, you need to change the argument passed to pgrep. You can run ps auxww | command grep -i --color code to find the path of vscode's running processes.
Happened to me when started code in windows cmd. Closed vs code and opened it from my taskbar shortcut instead, and the error was gone
The simplest solution for this problem in any version of Linux is simply to close other instances of VS code and use only one instance of VS code.
OS: Linux 20.04.3 LTS
I've also encountered the same "Error loading web view" Error.
I've solved this issue by moving "vscode.app" into "Application folder" instead of "Download folder" on macOS.
I'll describe my "symptom" here.
OS: macOS 12.0.1
Installed 2 versions of vscode somehow, 1 under "Application folder", another under "download folder"
Run both vscode at the same time, the "download folder" version has no error display plugin pages, the "Application folder" version has the "Error loading webview" error
Checked and see 2 vscode instances running in the background
What I tried to solve this issue:
Tried to kill "download folder" instance, and the error remains for "application folder" instance
Moved "download folder" to "application folder" and both vscode works correctly on plugin page!
What I suspect on what the problem is?
Maybe these 2 vscode are sharing the same resource(could be some shared file), however they have different permissions since one is under application folder and another is under download folder.
This answer applies if using VSCode in GitHub Codespaces in Firefox or Brave browsers. I had to disable "Enhanced Tracking Protection" for the site, and that is all. To do so, click on the shield icon which is to the left of the displayed web address.
If anyone is using Brave, please turn off the brave shields as well.
For Mac/Apple computer Monteray version the following steps worked for me:
Delete VSCode from downloads folder.
Turn off VSCode
Open Activity Monitor and delete VSCode "Code" process.
Try closing all the process cmd+qof vscode and reopen vscode and everything should work well.
I have just restarted VS code and it worked for me. OS was Windows 10.

VSCode on Linux Mint, integrated terminal not able to type anything

Hi I'm running Linux Mint 19 and I have just installed vscode using the snapd package manager. I've not used vscode on linux before as my usual editor is emacs. However, on a fresh new install of vscode, the integrated terminal does not work, there is just a non blinking cursor in the top left of the screen, but no prompt and no keyboard strokes are registering. This appears to be a common problem as there are a lot of posts about it if googled, but they are all for Windows versions and none of the solutions that I'm able to try do anything. I've tried to open a new terminal window, but the same thing happens I just get two terminal windows that I now cannot use. I've also tried checking the box that says Code-runner: Run In Terminal, but that does nothing either. What can I do to get this to work please, I looks to me like it is just not connected to either a bash or Zsh(which I normally use). Any help on this would be appreciated.
Instead of starting vscode with its default shell script (usually located on /usr/share/code/bin/code), the integrated terminal only works for me when starting it directly from the compiled binary (typically found on /usr/share/code/code, which is the same as the launcher created by the installer:
/usr/share/code/code --no-sandbox --unity-launch %F
While I searched for a solution in the past I've also noticed that lots of folks solved similar problems just by adding --disable-gpu flag, so might be worth checking out as well.

Getting black screen in visual studio after Installation completed

I was getting black screen after opening Visual studio each time. I got a solution from Stack overflow i.e code --disable-gpu. It is working fine but my main issue is when I use to code in vs code. I am not getting suggestions as intellisense is not working and I am unable to install any extensions from Visual studio code.
to disable hardware acceleration permanently (without adding --disable-gpu argument) open folder "C:\Users\your_username_here\.vscode" than open file argv.json with any editor and look for
"//disable-hardware-acceleration": true, and just remove the tow slashes before disable. i think there is a similar workaround in linux
Hit Ctrl Shift P to open the command palette,
Type Developer and choose Developer: Toggle Developer Tools.
switch to the Network tab in Dev tools.
Search for extensions now
Go to properties of visual studio
change target . Add --disable-gpu
make sure to add a space before --
it will resolve your issue.

How can I make the vscode gui visible?

I am using CentOS 7.7.1909 version.
I installed vscode via yum, the window pops up but nothing comes up like the screenshot. What should I do?
Try running it from the command line with the following flag:
code --disable-gpu
The Electron shell used by Visual Studio has trouble with some GPU hardware acceleration.