Visual Studio Code

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.
https://github.com/microsoft/vscode || code, code-gitAUR
  • Visual Studio Code Proprietary Microsoft-branded release.
https://code.visualstudio.com/ || visual-studio-code-binAUR, visual-studio-code-insiders-binAUR
  • VSCodium Community open-source release. Nullifies telemetry in the source code , also ships configuration with Open VSX.
https://vscodium.com/ || vscodiumAUR, vscodium-binAUR, vscodium-gitAUR, vscodium-electronAUR

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.

Warning: Though Microsoft has 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 FS#67780.

Known workarounds are:

Tip: It is useful to enable a keyboard shortcut to reload the IDE when experimenting with changing product.json.

Usage

Run to start the application (or if you are using other releases, run for or for /vscodiumAUR/vscodium-gitAUR).

If for any reason you wish to launch multiple instances of Visual Studio Code, the flag can be used.

Configuration

stores settings in .
stores settings in .

vscodiumAUR and related packages store their settings in .

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 opens up an integrated terminal. By default, Bash is used with no additional arguments, although this can be changed.

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: , you can change the terminal that will be used by Visual Studio to another terminal (e.g. ).

sets the default terminal to be used for exec debug.

Example:

Running natively under Wayland

Visual Studio code uses Electron, see Wayland#Electron for more information on how to run it natively under Wayland.

Troubleshooting

Visual Studio Code uses DBus to pass the menu to Plasma, try installing .

Unable to move items to trash

By default, Electron applications use to delete files. is automatically selected instead if Plasma is detected. Different trash implementations can be used by setting the environment variable.

For example, for deleting files using trash-cli:

$ ELECTRON_TRASH=trash-cli code

At the time of writing, Electron supports , kioclient, , (default) and (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:

For debugging with the open-source package can be used. To run it in VS Code, add this configuration to .NET Core launch configuration of the project:

Unable to open .csproj with OmniSharp server, invalid Microsoft.Common.props location

You have to switch from mono to proper SDK version props.

Modify import to look like this:

Error from OmniSharp that MSBuild cannot be located

It is noted in the OmniSharp introduction that Arch Linux users should install the package. Without it, you might get an error like:

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 package, because Microsoft does not support the way the Arch package is packaged (native instead of bundled Electron). See and the upstream bug report for more information.

The binary release 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:

  1. make sure returns as the first keyboard layout the one you want to work with in VS Code.
  2. use 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 .

This issue can be resolved by installing a Pacman hook that patches the file on every package update:

You can also manually add the relevant entries to the section in the product.json file:

  • For , edit
  • For vscodiumAUR, edit
  • For , edit

An example of a manual configuration that would make Live Share work is :

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.

VS Live Share missing API

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 .

Command 'remote-containers.openFolder' not found

Open VS Code enabling remote-containers API as commented in :

$ 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 like for KDE.

One thing to note is that for e.g. ksshaskpass you would need to link it from to get VSCode to find it:

# ln /usr/bin/ksshaskpass /usr/lib/ssh/ssh-askpass

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.

No such interface“org.freedesktop.Secret.Collection”

See settings-sync#_troubleshooting-keychain-issues

Authentification 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 or create a new keyring as mentioned here in the Visual Studio Code docs and here on Github.

gollark: <@290217153293189120> psi, ψ, possibly. Why?
gollark: <@235768051683950593> What's between Xyzzy and Untilted?
gollark: I really should have just designed the road network as a grid.
gollark: What's the blue line at the end of Menger? There should be a road there.
gollark: I mean, strictly speaking I could, but no.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.