67 lines
3.9 KiB
Cheetah
67 lines
3.9 KiB
Cheetah
{{- 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)
|
|
# * [Visual Studio Code `extensions.json`](https://github.com/megabyte-labs/install.doctor/blob/master/home/dot_config/Code/User/extensions.json)
|
|
|
|
{{ includeTemplate "universal/profile" }}
|
|
{{ includeTemplate "universal/logg" }}
|
|
|
|
# @description Install Visual Studio Code extensions if they are not already installed (by checking the `code --list-extensions` output)
|
|
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
|
|
|
|
# @description Check for the presence of the `codium` command in the `PATH` and install extensions for VSCodium if it is present
|
|
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 -}}
|