{{- if (ne .host.distro.family "windows") -}} #!/usr/bin/env bash # @file run_onchange_after_26-vscode-extensions.tmpl # @brief Installs all of the Visual Studio Code extensions specified in the [`home/dot_config/Code/User/extensions.json`](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User/extensions.json) file. # @description # This script loops through all the extensions listed in the [`home/dot_config/Code/User/extensions.json`](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User/extensions.json) # file. It installs the extensions when either Visual Studio Code or VSCodium is installed. If both are installed, then both will # have the plugins automatically installed. # # The `extensions.json` file is used to house the plugin list so that if you decide to remove this auto-installer script then # VSCode will retain some functionality from the file. It will show a popover card that recommends installing any plugins in the # list that are not already installed. # # ## Plugin Settings # # Most of the plugin settings have been configured and optimized to work properly with the other default settings # included by Install Doctor. These settings can be found in the [`home/dot_config/Code/User/settings.json` file](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User/settings.json). # If you manage to come up with an improvement, please open a pull request so other users can benefit from your work. # # ## Default Extensions # # The default plugins in the `extensions.json` list are catered mostly towards full-stack web development. The technologies # that are catered to by the default extensions relate to TypeScript, JavaScript, Go, Python, Rust, and many more technologies. # Most of the plugins are not language-specific. # # ## Links # # * [`run_onchange_after_26-vscode-extensions.tmpl`](https://github.com/megabyte-labs/install.doctor/blob/master/home/.chezmoiscripts/universal/run_onchange_after_26-vscode-extensions.tmpl) # * [Visual Studio Code settings folder](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User) {{ includeTemplate "universal/profile" }} {{ includeTemplate "universal/logg" }} ### Install Visual Studio Code extensions if command -v code > /dev/null; then EXTENSIONS="$(code --list-extensions)" jq -r '.recommendations[]' "${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/extensions.json" | while read EXTENSION; do if ! echo "$EXTENSIONS" | grep -iF "$EXTENSION" > /dev/null; then logg info 'Installing Visual Studio Code extension `'"$EXTENSION"'`' code --install-extension "$EXTENSION" logg success 'Installed `'"$EXTENSION"'`' else logg info '`'"$EXTENSION"'` already installed' fi done else logg warn '`code` executable not available' fi ### Install VSCodium extensions if command -v codium > /dev/null; then EXTENSIONS="$(codium --list-extensions)" jq -r '.recommendations[]' "${XDG_CONFIG_HOME:-$HOME/.config}/Code/User/extensions.json" | while read EXTENSION; do if ! echo "$EXTENSIONS" | grep -iF "$EXTENSION" > /dev/null; then logg info 'Installing VSCodium extension `'"$EXTENSION"'`' codium --install-extension "$EXTENSION" logg success 'Installed `'"$EXTENSION"'`' else logg info '`'"$EXTENSION"'` already installed' fi done else logg warn '`codium` executable not available' fi {{ end -}}