Visual Studio Code: Difference between revisions
imported>Jmarmstrong1207 Move out of installation section. Makes more sense. |
Option renamed: extensions -> profiles.default.extensions |
||
(8 intermediate revisions by 7 users not shown) | |||
Line 37: | Line 37: | ||
Some examples here: [https://github.com/search?q=extensionFromVscodeMarketplace&type=code GitHub search for "extensionFromVscodeMarketplace"] | Some examples here: [https://github.com/search?q=extensionFromVscodeMarketplace&type=code GitHub search for "extensionFromVscodeMarketplace"] | ||
{{ic|extensionsFromVscodeMarketplace}} is a manual way to fetch extensions. However, to keep updated from upstream, [https://github.com/nix-community/nix-vscode-extensions nix-community/nix-vscode-extensions] provides the Nix expressions for the majority of available extensions from Open VSX and VSCode Marketplace. A GitHub Action updates the extensions daily. | Note: For fetching the sha256 string you can use the following command. Make sure to replace the author, the package name and version!<syntaxhighlight lang="bash"> | ||
nix-prefetch-url https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ms-vscode-remote/vsextensions/remote-ssh-edit/0.47.2/vspackage | |||
</syntaxhighlight>{{ic|extensionsFromVscodeMarketplace}} is a manual way to fetch extensions. However, to keep updated from upstream, [https://github.com/nix-community/nix-vscode-extensions nix-community/nix-vscode-extensions] provides the Nix expressions for the majority of available extensions from Open VSX and VSCode Marketplace. A GitHub Action updates the extensions daily. | |||
It's also possible to install VS Code via [[Home Manager]]: | It's also possible to install VS Code via [[Home Manager]]: | ||
Line 44: | Line 46: | ||
programs.vscode = { | programs.vscode = { | ||
enable = true; | enable = true; | ||
extensions = with pkgs.vscode-extensions; [ | profiles.default.extensions = with pkgs.vscode-extensions; [ | ||
dracula-theme.theme-dracula | dracula-theme.theme-dracula | ||
vscodevim.vim | vscodevim.vim | ||
Line 52: | Line 54: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* See for more options: [https://nix-community.github.io/home-manager/options. | * See for more options: [https://nix-community.github.io/home-manager/options.xhtml#opt-programs.vscode.enable Home Manager Manual: Options - programs.vscode] | ||
* Search for extensions with configurations: [https://search.nixos.org/packages?type=packages&query=vscode-extensions NixOS Search: vscode-extensions] | * Search for extensions with configurations: [https://search.nixos.org/packages?type=packages&query=vscode-extensions NixOS Search: vscode-extensions] | ||
Line 149: | Line 151: | ||
== Creating development environments using nix-shell == | == Creating development environments using nix-shell == | ||
Instead of using configuration.nix to add packages (e.g. Python or NodeJS) for developing code on VSCode, you can instead use nix-shell. This will allow you to seamlessly create development environments with the correct packages for your project, without rebuilding and restarting NixOS. See [ | Instead of using configuration.nix to add packages (e.g. Python or NodeJS) for developing code on VSCode, you can instead use nix-shell. This will allow you to seamlessly create development environments with the correct packages for your project, without rebuilding and restarting NixOS. See [[Development_environment_with_nix-shell | this page]] for further instructions in building nix-shell development environments. | ||
The extension [https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector nix-env-selector] will make switching between different nix-shell environments within VSCode so you can switch between different coding projects easily. It has a guide for setting up nix-shell environments for VSCode. | === Automatically switch nix shells when switching projects === | ||
You can do this by using [https://github.com/nix-community/nix-direnv nix-direnv] and [https://marketplace.visualstudio.com/items?itemName=mkhl.direnv the VSCode extension direnv] for integration. View the nix-direnv github page linked for a guide on setting it up. | |||
=== Alternative for manually switching shells === | |||
The extension [https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector nix-env-selector] will make switching between different nix-shell environments within VSCode so you can switch between different coding projects easily and manually. It has a guide for setting up nix-shell environments for VSCode. | |||
== Wayland == | == Wayland == | ||
Line 263: | Line 269: | ||
== Troubleshooting == | == Troubleshooting == | ||
=== | === Writing login information to the keychain failed === | ||
Writing login information to the keychain failed | |||
If you get an error similar to the following, enable a [[Secret Service]] provider. | |||
<pre>Writing login information to the keychain failed with error 'The name org.freedesktop.secret was not provided by any .service files'.</pre> | |||
=== Server did not start successfully === | === Server did not start successfully === | ||
Line 323: | Line 316: | ||
fi | fi | ||
</syntaxHighlight> | </syntaxHighlight> | ||
[[Category:Applications]] | |||
[[Category:IDE]] |