Visual Studio Code: Difference between revisions
m (→Troubleshooting: corrected an spelling error) |
(→Running natively under Wayland: - Mention the newly added env var in the second paragraph.) |
||
(133 intermediate revisions by 52 users not shown) | |||
Line 2: | Line 2: | ||
[[ja:Visual Studio Code]] | [[ja:Visual Studio Code]] | ||
[[pt:Visual Studio Code]] | [[pt:Visual Studio Code]] | ||
[[ru:Visual Studio Code]] | |||
[[zh-hans:Visual Studio Code]] | [[zh-hans:Visual Studio Code]] | ||
[https://code.visualstudio.com/ | [https://code.visualstudio.com/ Code] is a cross-platform text editor developed by Microsoft, built on the Electron framework. ''Visual Studio Code'' is a binary distribution of the MIT-licensed [https://github.com/microsoft/vscode/ Code - OSS] repository, with Microsoft specific customizations and released under a [https://code.visualstudio.com/license proprietary license]. For details on the mixed licensing, see [https://github.com/Microsoft/vscode/issues/60#issuecomment-161792005 this GitHub comment]. There is also a community-driven, MIT-licensed binary release called [https://vscodium.com/ VSCodium] with [https://code.visualstudio.com/docs/getstarted/telemetry telemetry] disabled by default. | ||
== Installation == | == Installation == | ||
The following | The following flavors of Visual Studio Code are available: | ||
* {{ | * {{App|Code - OSS|Official Arch Linux open-source release. Ships a configuration enabling [https://open-vsx.org/ Open VSX].|https://github.com/microsoft/vscode|{{Pkg|code}}}} | ||
* {{App|Visual Studio Code|Proprietary Microsoft-branded release.|https://code.visualstudio.com/|{{AUR|visual-studio-code-bin}}}} | |||
* {{App|VSCodium|Community open-source release. Nullifies telemetry in the source code [https://github.com/VSCodium/vscodium/issues/267#issuecomment-542462446], also ships configuration with Open VSX.|https://vscodium.com/|{{AUR|vscodium}}}} | |||
* {{ | |||
The | These different flavors are all built from the [https://github.com/VSCodium/vscodium/blob/master/README.md Code - OSS repository], but with different licensing and default configurations. Notably, only the proprietary builds are permitted to use Microsoft's marketplace and use Microsoft proprietary extensions such as the [https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger.md OmniSharp C# Debugger]. The latter is enforced by a handshake mechanism, and cannot be circumvented. For more info on the differences between open source and proprietary "Visual Studio Code" branded builds, consult the [https://github.com/microsoft/vscode/wiki/Differences-between-the-repository-and-Visual-Studio-Code Code - OSS GitHub wiki]. | ||
=== Extensions support === | |||
One of Code's main strengths is its flexible API and rich extension ecosystem hosted on the [https://marketplace.visualstudio.com/vscode Visual Studio Marketplace]. However, the [https://aka.ms/vsmarketplace-ToU terms of use of the marketplace] only permit it to be used with the Microsoft branded releases. As a result, the Code - OSS source does not include a configured marketplace. The open-source releases above add the Open VSIX extension registry, but this does not offer the same breadth of extensions. It is possible to bypass this limitation. | |||
{{Warning|Though Microsoft has [https://github.com/Microsoft/vscode/issues/31168 not directly commented on this issue], one can reasonably conclude that non-branded Code builds do not constitute "In-Scope Products and Services" as laid out by the terms of use. In other words, this activity is not permitted by the marketplace. Also see {{Bug|67780}}.}} | |||
Known workarounds are: | |||
* manually install the extension from its {{ic|.vsix}} file, which can be obtained from the [https://marketplace.visualstudio.com/vscode Microsoft Visual Studio Code Marketplace]; | |||
* ask the maintainer to upload its extension to the [https://open-vsx.org/ Open VSX registry]; | |||
* add the Microsoft Visual Studio Code Marketplace by using one of the following packages relative to the build you are using: {{AUR|code-marketplace}}/{{AUR|vscodium-bin-marketplace}}/{{AUR|vscodium-marketplace}}/{{AUR|code-oss-marketplace}}. Those packages install a [[Pacman hook]] that patches the file {{ic|product.json}} as shown in [https://github.com/VSCodium/vscodium/issues/418#issuecomment-643664182 this Github comment] after every package update. | |||
{{Tip|It is useful to enable a [https://stackoverflow.com/a/69985500 keyboard shortcut to reload the IDE] when experimenting with changing {{ic|product.json}}.}} | |||
== Usage == | == Usage == | ||
Run {{ic|code}} to start the application (or if you are using other releases, run {{ic|code-git}} for {{AUR|code-git}} or {{ic|codium}} for {{AUR|vscodium-bin}}). | Run {{ic|code}} to start the application (or if you are using other releases, run {{ic|code-git}} for {{AUR|code-git}} or {{ic|codium}} for {{AUR|vscodium-bin}}/{{AUR|vscodium}}/{{AUR|vscodium-git}}). | ||
If for any reason you wish to launch multiple instances of Visual Studio Code, the {{ic|-n}} flag can be used. | If for any reason you wish to launch multiple instances of Visual Studio Code, the {{ic|-n}} flag can be used. | ||
Line 25: | Line 37: | ||
== Configuration == | == Configuration == | ||
{{Pkg|code}} stores settings in {{ic|~/.config/Code - OSS/User/settings.json}}. | {{Note|Packages like {{AUR|code-features}} that patch {{ic|product.json}} can override the {{ic|nameShort}} and {{ic|dataFolderName}} variables, making the below section inaccurate.}} | ||
VSC stores settings in {{ic|$XDG_CONFIG_HOME/''nameShort''/User/settings.json}} and the extension data in an [https://github.com/microsoft/vscode/issues/3884 XDG-nonstandard] {{ic|$HOME/''dataFolderName''}} directory, using variables from {{ic|product.json}}. | |||
This translates to the following default paths in various versions: | |||
* {{Pkg|code}} stores settings in {{ic|~/.config/Code - OSS/User/settings.json}} and extensions in {{ic|~/.vscode-oss}} | |||
* {{AUR|visual-studio-code-bin}} stores settings in {{ic|~/.config/Code/User/settings.json}} and extensions in {{ic|~/.vscode}} | |||
* {{AUR|vscodium}} and related packages store settings in {{ic|~/.config/VSCodium/User/settings.json}} and extensions in {{ic|~/.vscode-oss}} | |||
When migrating from Code to Codium (or vice versa), the settings directory can be copied or moved, since they share most of their codebase, the settings are compatible. | |||
=== Integrated | === Integrated terminal === | ||
''View > Integrated Terminal'' or {{ic|Ctrl + `}} opens up an integrated terminal. | ''View > Integrated Terminal'' or {{ic|Ctrl + `}} opens up an integrated terminal. | ||
Line 43: | Line 65: | ||
}} | }} | ||
You might face weird prompts after setting the integrated shell arguments with external terminal | You might face weird prompts after setting the integrated shell arguments with an external terminal. Remove the line to solve the problem or use an external terminal. | ||
=== External terminal === | === External terminal === | ||
Line 56: | Line 78: | ||
"terminal.external.linuxExec": "gnome-terminal" | "terminal.external.linuxExec": "gnome-terminal" | ||
}} | }} | ||
=== Running natively under Wayland === | |||
Visual Studio Code uses Electron, see [[Wayland#Electron]] for more information on how to run it natively under Wayland. | |||
If you choose not to use the environment variable for it, you will need to keep in mind that some applications do not use system electron, but bring their own. Such applications will not read the standard Electron flags file. | |||
When using a per-user configuration, both {{AUR|visual-studio-code-bin}} and {{Pkg|code}} read {{ic|~/.config/code-flags.conf}}. Note that this is specific to these packages, as they use a [https://aur.archlinux.org/cgit/aur.git/tree/visual-studio-code-bin.sh?h=visual-studio-code-bin patched loader script] that reads these options. | |||
If using {{AUR|vscodium-bin}}, use the {{ic|~/.config/codium-flags.conf}} file. If running from terminal, make sure to run it as {{ic|codium}} (not {{ic|vscodium}}), otherwise, it will not use native Wayland window. | |||
{{AUR|vscodium}} does not load config files (as it does not use a patched loader script). It provides a dedicated {{ic|vscodium-wayland.desktop}} [[desktop entry]] file, which appears as "VSCodium - Wayland" in the menu. | |||
=== Native file dialog === | |||
If using Plasma, by default VS Codium opens GTK file dialogs. To fix that, ensure that KDE [[XDG Desktop Portal|desktop portal]] ({{Pkg|xdg-desktop-portal-kde}}) is installed and set the {{ic|1=GTK_USE_PORTAL=1}} [[environment variable]]. | |||
== Troubleshooting == | == Troubleshooting == | ||
Line 61: | Line 99: | ||
=== Global menu not working in KDE/Plasma === | === Global menu not working in KDE/Plasma === | ||
Visual Studio Code uses DBus to pass the menu to Plasma, try installing {{Pkg|libdbusmenu-glib}}. | Visual Studio Code uses DBus to pass the menu to Plasma, try installing {{Pkg|libdbusmenu-glib}}. [https://github.com/microsoft/vscode/issues/34510#issuecomment-364896975] | ||
=== Unable to move items to trash === | === Unable to move items to trash === | ||
By default, [https://electron.atom.io/ Electron] | By default, [https://electron.atom.io/ Electron] applications use {{ic|gio}} to delete files. {{ic|kioclient5}} is automatically selected instead if [[Plasma]] is detected. Different trash implementations can be used by setting the {{ic|ELECTRON_TRASH}} [[environment variable]]. | ||
For example, for deleting files | For example, for deleting files using {{Pkg|trash-cli}}: | ||
$ ELECTRON_TRASH= | $ ELECTRON_TRASH=trash-cli code | ||
At the time of writing, Electron supports {{ic|kioclient5}}, {{ic|kioclient}}, {{ic|trash-cli}}, {{ic|gio}} (default) and {{ic|gvfs-trash}} (deprecated). More info is available at this [https://github.com/electron/electron/blob/master/docs/api/environment-variables.md#electron_trash-linux documentation page]. | At the time of writing, Electron supports {{ic|kioclient5}}, {{ic|kioclient}}, {{ic|trash-cli}}, {{ic|gio}} (default) and {{ic|gvfs-trash}} (deprecated). More info is available at this [https://github.com/electron/electron/blob/master/docs/api/environment-variables.md#electron_trash-linux documentation page]. | ||
Line 75: | Line 113: | ||
=== Unable to debug C# === | === Unable to debug C# === | ||
If you want to debug C#[[ | If you want to debug C#[[.NET]] (using the [https://www.omnisharp.net OmniSharp extension]) then you need to install the Microsoft branded release (from the AUR). This is apparently because the .NET Core debugger is only licensed to be used with official Microsoft products - see [https://github.com/OmniSharp/omnisharp-vscode/issues/1431#issuecomment-297578930 this github discussion]. | ||
When using the open-source package, debugging fails fairly quietly. The debug console will just show the initial message: | When using the open-source package, debugging fails fairly quietly. The debug console will just show the initial message: | ||
Line 114: | Line 152: | ||
=== Error from OmniSharp that MSBuild cannot be located === | === Error from OmniSharp that MSBuild cannot be located === | ||
It is noted in the [https://github.com/OmniSharp/omnisharp-roslyn#introduction OmniSharp introduction] that Arch Linux users should install the {{ | It is noted in the [https://github.com/OmniSharp/omnisharp-roslyn#introduction OmniSharp introduction] that Arch Linux users should install the {{Pkg|mono-msbuild}} package. Without it, you might get an error like: | ||
{{hc|1=OmniSharp Log|2= | {{hc|1=OmniSharp Log|2= | ||
Line 128: | Line 166: | ||
...}} | ...}} | ||
You might be able to build anyway (possibly depending whether you have {{Pkg|mono}} installed too) | You might be able to build anyway (possibly depending whether you have {{Pkg|mono}} installed too). | ||
Omnisharp ships with its own mono version, so, if it is unable to locate the installed one, if you want to tell omnisharp to look for a "global" mono installed in your machine, put this in your settings.json: | |||
{{hc|1=settings.json|2="omnisharp.useGlobalMono:"always"}} | |||
=== Saving with "Retry as Sudo" does not work === | === Saving with "Retry as Sudo" does not work === | ||
Line 149: | Line 190: | ||
=== Command "..." not found === | === Command "..." not found === | ||
In the | In the Microsoft branded releases, the {{ic|product.json}} file lists the extensions that are allowed to use certain proposed APIs accessed by extensions. Code - OSS and VSCodium distributions lack these values, though this does not appear to be due to licensing. Unlike the forced Marketplace enabling, this workaround ''is'' endorsed by Microsoft [https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#vs-code-oss-issues]. | ||
This issue can be resolved by installing a Pacman hook that patches the file on every package update: | |||
* For {{Pkg|code}}, [[install]] {{AUR|code-features}} | |||
* For {{AUR|vscodium}}, install {{AUR|vscodium-features}} | |||
* For {{AUR|vscodium-bin}}, install {{AUR|vscodium-bin-features}} | |||
You can also manually add the relevant entries to the {{ic|extensionAllowedProposedApi}} section in the {{ic|product.json}} file: | |||
* For {{Pkg|code}}, edit {{ic|/usr/lib/code/product.json}} | |||
* For {{AUR|vscodium}}, edit {{ic|/usr/share/vscodium/resources/app/product.json}} | |||
* For {{AUR|vscodium-bin}}, edit {{ic|/opt/vscodium-bin/resources/app/product.json}} | |||
{{ | An example of a manual configuration that would make Live Share work is [https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#vs-code-oss-issues]: | ||
{{hc|product.json| | |||
... | |||
"extensionAllowedProposedApi": [ | |||
"ms-vsliveshare.vsliveshare", | "ms-vsliveshare.vsliveshare", | ||
"ms-vscode.node-debug", | "ms-vscode.node-debug", | ||
"ms-vscode.node-debug2" | "ms-vscode.node-debug2" | ||
]}} | ] | ||
... | |||
}} | |||
Finally, you can also enable these options using command line flags, [https://github.com/Microsoft/vscode-pull-request-github/wiki#3-why-isnt-the-extension-starting as described for the GitHub pull request extension]. | |||
==== VS Live Share missing API ==== | ==== VS Live Share missing API ==== | ||
Line 166: | Line 223: | ||
$ code --enable-proposed-api ms-vsliveshare.vsliveshare | $ code --enable-proposed-api ms-vsliveshare.vsliveshare | ||
Also note that for this extension to work, you need to install dependencies listed here [https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#tips-for-community-supported-distros]. | |||
==== Command 'remote-containers.openFolder' not found ==== | ==== Command 'remote-containers.openFolder' not found ==== | ||
Line 181: | Line 240: | ||
=== Git: ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory === | === Git: ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory === | ||
This error is a result of an encrypted ssh-key, | This error is a result of an encrypted ssh-key and inability to use ssh agent, see [https://github.com/microsoft/vscode/issues/57488 bug report]. The issue can be solved by installing a dialogue provider like [[SSH keys#x11-ssh-askpass]] or the alternatives listed there (e.g. {{Pkg|ksshaskpass}} for KDE). | ||
One thing to note is that for | One thing to note is that for ''ksshaskpass'' you would either need to link it from {{ic|/usr/lib/ssh/ssh-askpass}} to get VSCode to find it: | ||
# ln /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass | # ln /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass | ||
or set the following [[environment variables]] for your shell, see [https://github.com/microsoft/vscode/issues/57488#issuecomment-1413903793]: | |||
GIT_ASKPASS=ksshaskpass | |||
SSH_ASKPASS=ksshaskpass | |||
SSH_ASKPASS_REQUIRE=prefer | |||
To disable VSCode's internal ''git-askpass'', add: | |||
{{hc|~/.config/Code - OSS/User/settings.json|2= | |||
{ | |||
"git.useIntegratedAskPass": false | |||
} | |||
}} | |||
=== Cutoff characters in integrated Terminal === | |||
Characters that are too wide can end up clipping. For example the italic bold text of Deno stack-traces. | |||
This can be avoided by setting "terminal.integrated.rendererType" to "experimentalWebgl". | |||
=== Blurry text under Wayland === | |||
Visual Studio Code defaults to run under Xwayland, which may cause blurry text if you are using HiDPI screens. To fix this issue, try forcing Electron to run under Wayland—see [[#Running natively under Wayland]]. | |||
Alternatively, if your Wayland environment provides the option to run Xwayland applications unscaled, you can circumvent this issue. You may then run Visual Studio Code with the {{ic|1=--force-device-scale-factor=}} option to achieve an appropriate scale for your screen. | |||
For example, for a scaling factor of 2: | |||
$ code --force-device-scale-factor=2 | |||
=== No such interface“org.freedesktop.Secret.Collection” === | |||
See [https://code.visualstudio.com/docs/editor/settings-sync#_troubleshooting-keychain-issues settings-sync#_troubleshooting-keychain-issues] | |||
=== Authentication with Github failed while using VSCodium === | |||
When connecting a Github account, change "vscodium" to "vscode" in the URL as seen in [https://github.com/VSCodium/vscodium/issues/401#issuecomment-631502370 this comment]. Then copy the identification token into VSCodium. Should it still fail, install a keyring like {{pkg|gnome-keyring}} or create a new keyring as mentioned here [https://code.visualstudio.com/docs/editor/settings-sync#_troubleshooting-keychain-issues in the Visual Studio Code docs] and here [https://github.com/microsoft/vscode/issues/92972#issuecomment-625751232 on Github]. | |||
=== An OS keyring couldn't be identified === | |||
On some desktop environments like i3, VSCode fails to detect the keyring. If you are using gnome-keyring, you can add the following line to force VSCode to use that keyring: | |||
{{hc|~/.vscode-oss/argv.json|2= | |||
{ | |||
... | |||
"password-store": "gnome-libsecret", | |||
} | |||
}} | |||
The example path above is for the official {{pkg|code}} package. You might have to adjust the {{ic|.vscode-oss}} directory path depending if you have a different one installed. |
Latest revision as of 14:01, 10 April 2024
Code is a cross-platform text editor developed by Microsoft, built on the Electron framework. Visual Studio Code is a binary distribution of the MIT-licensed Code - OSS repository, with Microsoft specific customizations and released under a proprietary license. For details on the mixed licensing, see this GitHub comment. There is also a community-driven, MIT-licensed binary release called VSCodium with telemetry disabled by default.
Installation
The following flavors of Visual Studio Code are available:
- Code - OSS — Official Arch Linux open-source release. Ships a configuration enabling Open VSX.
- Visual Studio Code — Proprietary Microsoft-branded release.
- VSCodium — Community open-source release. Nullifies telemetry in the source code [1], also ships configuration with Open VSX.
These different flavors are all built from the Code - OSS repository, but with different licensing and default configurations. Notably, only the proprietary builds are permitted to use Microsoft's marketplace and use Microsoft proprietary extensions such as the OmniSharp C# Debugger. The latter is enforced by a handshake mechanism, and cannot be circumvented. For more info on the differences between open source and proprietary "Visual Studio Code" branded builds, consult the Code - OSS GitHub wiki.
Extensions support
One of Code's main strengths is its flexible API and rich extension ecosystem hosted on the Visual Studio Marketplace. However, the terms of use of the marketplace only permit it to be used with the Microsoft branded releases. As a result, the Code - OSS source does not include a configured marketplace. The open-source releases above add the Open VSIX extension registry, but this does not offer the same breadth of extensions. It is possible to bypass this limitation.
Known workarounds are:
- manually install the extension from its
.vsix
file, which can be obtained from the Microsoft Visual Studio Code Marketplace; - ask the maintainer to upload its extension to the Open VSX registry;
- add the Microsoft Visual Studio Code Marketplace by using one of the following packages relative to the build you are using: code-marketplaceAUR/vscodium-bin-marketplaceAUR/vscodium-marketplaceAUR/code-oss-marketplaceAUR. Those packages install a Pacman hook that patches the file
product.json
as shown in this Github comment after every package update.
product.json
.Usage
Run code
to start the application (or if you are using other releases, run code-git
for code-gitAUR or codium
for vscodium-binAUR/vscodiumAUR/vscodium-gitAUR).
If for any reason you wish to launch multiple instances of Visual Studio Code, the -n
flag can be used.
Configuration
product.json
can override the nameShort
and dataFolderName
variables, making the below section inaccurate.VSC stores settings in $XDG_CONFIG_HOME/nameShort/User/settings.json
and the extension data in an XDG-nonstandard $HOME/dataFolderName
directory, using variables from product.json
.
This translates to the following default paths in various versions:
- code stores settings in
~/.config/Code - OSS/User/settings.json
and extensions in~/.vscode-oss
- visual-studio-code-binAUR stores settings in
~/.config/Code/User/settings.json
and extensions in~/.vscode
- vscodiumAUR and related packages store settings in
~/.config/VSCodium/User/settings.json
and extensions in~/.vscode-oss
When migrating from Code to Codium (or vice versa), the settings directory can be copied or moved, since they share most of their codebase, the settings are compatible.
Integrated terminal
View > Integrated Terminal or Ctrl + `
opens up an integrated terminal.
By default, Bash is used with no additional arguments, although this can be changed.
terminal.integrated.shell.linux
sets the default shell to be used and
terminal.integrated.shellArgs.linux
sets the arguments to be passed to the shell.
Example:
~/.config/Code/User/settings.json
"terminal.integrated.shell.linux": "/usr/bin/fish", "terminal.integrated.shellArgs.linux": ["-l","-d 3"]
You might face weird prompts after setting the integrated shell arguments with an external terminal. Remove the line to solve the problem or use an external terminal.
External terminal
If you are using Terminator as default terminal for Arch and you have an error on Visual Studio Code: Unable to launch debugger worker process (vsdbg) through the terminal. spawn truecolor ENOENT
, you can change the terminal that will be used by Visual Studio to another terminal (e.g. gnome-terminal).
"terminal.external.linuxExec": "Your alternative terminal"
sets the default terminal to be used for exec debug.
Example:
~/.config/Code/User/settings.json
"terminal.external.linuxExec": "gnome-terminal"
Running natively under Wayland
Visual Studio Code uses Electron, see Wayland#Electron for more information on how to run it natively under Wayland.
If you choose not to use the environment variable for it, you will need to keep in mind that some applications do not use system electron, but bring their own. Such applications will not read the standard Electron flags file.
When using a per-user configuration, both visual-studio-code-binAUR and code read ~/.config/code-flags.conf
. Note that this is specific to these packages, as they use a patched loader script that reads these options.
If using vscodium-binAUR, use the ~/.config/codium-flags.conf
file. If running from terminal, make sure to run it as codium
(not vscodium
), otherwise, it will not use native Wayland window.
vscodiumAUR does not load config files (as it does not use a patched loader script). It provides a dedicated vscodium-wayland.desktop
desktop entry file, which appears as "VSCodium - Wayland" in the menu.
Native file dialog
If using Plasma, by default VS Codium opens GTK file dialogs. To fix that, ensure that KDE desktop portal (xdg-desktop-portal-kde) is installed and set the GTK_USE_PORTAL=1
environment variable.
Troubleshooting
Visual Studio Code uses DBus to pass the menu to Plasma, try installing libdbusmenu-glib. [2]
Unable to move items to trash
By default, Electron applications use gio
to delete files. kioclient5
is automatically selected instead if Plasma is detected. Different trash implementations can be used by setting the ELECTRON_TRASH
environment variable.
For example, for deleting files using trash-cli:
$ ELECTRON_TRASH=trash-cli code
At the time of writing, Electron supports kioclient5
, kioclient
, trash-cli
, gio
(default) and gvfs-trash
(deprecated). More info is available at this documentation page.
Unable to debug C#
If you want to debug C#.NET (using the OmniSharp extension) then you need to install the Microsoft branded release (from the AUR). This is apparently because the .NET Core debugger is only licensed to be used with official Microsoft products - see this github discussion.
When using the open-source package, debugging fails fairly quietly. The debug console will just show the initial message:
You may only use the Microsoft .NET Core Debugger (vsdbg) with Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you develop and test your applications.
For debugging with the open-source package netcoredbgAUR can be used. To run it in VS Code, add this configuration to .NET Core launch configuration of the project:
./.vscode/launch.json
"configurations": [ { ... "pipeTransport": { "pipeCwd": "${workspaceFolder}", "pipeProgram": "/usr/bin/bash", "pipeArgs": ["-c"], "debuggerPath": "/usr/bin/netcoredbg" } ...
Unable to open .csproj with OmniSharp server, invalid Microsoft.Common.props location
You have to switch from mono to proper SDK version props.
/opt/dotnet/sdk/{VERSION}/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props
Modify import to look like this:
/opt/dotnet/sdk/{VERSION}/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props
/opt/dotnet/sdk/{VERSION}/Current/Microsoft.Common.props
Error from OmniSharp that MSBuild cannot be located
It is noted in the OmniSharp introduction that Arch Linux users should install the mono-msbuild package. Without it, you might get an error like:
OmniSharp Log
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: StandAlone 15.0 - "~/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin" MSBuildExtensionsPath = /usr/lib/mono/xbuild BypassFrameworkInstallChecks = true CscToolPath = ~/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin/Roslyn CscToolExe = csc.exe MSBuildToolsPath = ~/.vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (13) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=4.5.24.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. ...
You might be able to build anyway (possibly depending whether you have mono installed too).
Omnisharp ships with its own mono version, so, if it is unable to locate the installed one, if you want to tell omnisharp to look for a "global" mono installed in your machine, put this in your settings.json:
settings.json
"omnisharp.useGlobalMono:"always"
Saving with "Retry as Sudo" does not work
This feature does not work in the code package, because Microsoft does not support the way the Arch package is packaged (native instead of bundled Electron). See FS#61516 and the upstream bug report for more information.
The binary release visual-studio-code-binAUR does not have this issue, and the feature works there.
Keyboard variants or keymappings do not map
As per the wiki on GitHub:
- Switching keyboard layouts under some Linux window managers does not result in a change in the low level X window APIs VS Code uses to read the current keyboard layout. This means that VS Code ends up sometimes reading one of the other configured keyboard layouts and not the current active one. PR welcome...
Per the wiki, there are two possible solutions:
- make sure
setxkbmap -query
returns as the first keyboard layout the one you want to work with in VS Code. - use
"keyboard.dispatch": "keyCode"
in your settings and restart VS Code. This will prevent VS Code from trying to determine your keyboard layout whatsoever.
Command "..." not found
In the Microsoft branded releases, the product.json
file lists the extensions that are allowed to use certain proposed APIs accessed by extensions. Code - OSS and VSCodium distributions lack these values, though this does not appear to be due to licensing. Unlike the forced Marketplace enabling, this workaround is endorsed by Microsoft [3].
This issue can be resolved by installing a Pacman hook that patches the file on every package update:
- For code, install code-featuresAUR
- For vscodiumAUR, install vscodium-featuresAUR
- For vscodium-binAUR, install vscodium-bin-featuresAUR
You can also manually add the relevant entries to the extensionAllowedProposedApi
section in the product.json
file:
- For code, edit
/usr/lib/code/product.json
- For vscodiumAUR, edit
/usr/share/vscodium/resources/app/product.json
- For vscodium-binAUR, edit
/opt/vscodium-bin/resources/app/product.json
An example of a manual configuration that would make Live Share work is [4]:
product.json
... "extensionAllowedProposedApi": [ "ms-vsliveshare.vsliveshare", "ms-vscode.node-debug", "ms-vscode.node-debug2" ] ...
Finally, you can also enable these options using command line flags, as described for the GitHub pull request extension.
Use either the solution above by editing the product.json
, or open VS Code with:
$ code --enable-proposed-api ms-vsliveshare.vsliveshare
Also note that for this extension to work, you need to install dependencies listed here [5].
Command 'remote-containers.openFolder' not found
Open VS Code enabling remote-containers API as commented in FS#63374:
$ code-oss --enable-proposed-api ms-vscode-remote.remote-containers
Command 'GitHub Pull Requests: Configure Remotes...' resulted in an error (command 'pr.configureRemotes' not found)
Open VS Code with:
$ code --enable-proposed-api GitHub.vscode-pull-request-github
Git: ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory
This error is a result of an encrypted ssh-key and inability to use ssh agent, see bug report. The issue can be solved by installing a dialogue provider like SSH keys#x11-ssh-askpass or the alternatives listed there (e.g. ksshaskpass for KDE).
One thing to note is that for ksshaskpass you would either need to link it from /usr/lib/ssh/ssh-askpass
to get VSCode to find it:
# ln /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass
or set the following environment variables for your shell, see [6]:
GIT_ASKPASS=ksshaskpass SSH_ASKPASS=ksshaskpass SSH_ASKPASS_REQUIRE=prefer
To disable VSCode's internal git-askpass, add:
~/.config/Code - OSS/User/settings.json
{ "git.useIntegratedAskPass": false }
Cutoff characters in integrated Terminal
Characters that are too wide can end up clipping. For example the italic bold text of Deno stack-traces.
This can be avoided by setting "terminal.integrated.rendererType" to "experimentalWebgl".
Blurry text under Wayland
Visual Studio Code defaults to run under Xwayland, which may cause blurry text if you are using HiDPI screens. To fix this issue, try forcing Electron to run under Wayland—see #Running natively under Wayland.
Alternatively, if your Wayland environment provides the option to run Xwayland applications unscaled, you can circumvent this issue. You may then run Visual Studio Code with the --force-device-scale-factor=
option to achieve an appropriate scale for your screen.
For example, for a scaling factor of 2:
$ code --force-device-scale-factor=2
No such interface“org.freedesktop.Secret.Collection”
See settings-sync#_troubleshooting-keychain-issues
Authentication with Github failed while using VSCodium
When connecting a Github account, change "vscodium" to "vscode" in the URL as seen in this comment. Then copy the identification token into VSCodium. Should it still fail, install a keyring like gnome-keyring or create a new keyring as mentioned here in the Visual Studio Code docs and here on Github.
An OS keyring couldn't be identified
On some desktop environments like i3, VSCode fails to detect the keyring. If you are using gnome-keyring, you can add the following line to force VSCode to use that keyring:
~/.vscode-oss/argv.json
{ ... "password-store": "gnome-libsecret", }
The example path above is for the official code package. You might have to adjust the .vscode-oss
directory path depending if you have a different one installed.