Skip to content

Commit

Permalink
devonfw#934: devonfw#943: improve vscode plugin installation
Browse files Browse the repository at this point in the history
  • Loading branch information
hohwille committed Oct 25, 2022
1 parent 628aa71 commit c058b67
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions scripts/src/main/resources/scripts/command/vscode
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function cleanupPlugins() {

function doAddPlugins() {
local file
local pluginsToInstall
local pluginsToInstall=()
for file in "${SETTINGS_PATH}"/vscode/plugins/*.properties
do
if [ -f "${file}" ]
Expand All @@ -60,20 +60,30 @@ function doAddPlugins() {
doWarning "Invalid vscode plugin config: ${file}"
elif [ "${plugin_active}" = "true" ]
then
pluginsToInstall="${pluginsToInstall} --install-extension ${plugin_id}"
pluginsToInstall+=("${plugin_id}")
fi
fi
done
doAddPlugin "${pluginsToInstall}"
if [ "${#pluginsToInstall}" -gt 0 ]
then
doAddPlugin "${pluginsToInstall[@]}"
fi
}

function doAddPlugin() {
if [ -n "${1}" ]
local plugins="${*}"
local args=()
while [ -n "${1}" ]
do
args+=("--install-extension" "${1}")
shift
done
if [ "${#args}" = 0 ]
then
doEchoAttention "Execute plugin installation with following parameters (${1}) into VS code...\nPlease wait until VSCode has successfully installed all plugins.\nYou may then use or close VSCode as you like."
doRunVsCode --force "${1}"
else
doEcho "No plugins to be installed / uninstalled"
else
doEchoAttention "Starting installation of the following plugins into VS code:\n${plugins}\nPlease wait until VSCode has successfully installed all plugins."
doRunVsCode --force "${args[@]}"
fi
}

Expand Down Expand Up @@ -150,6 +160,7 @@ while [ -n "${1}" ]
do
if [ "${1}" = "run" ] || [ "${1}" = "start" ]
then
shift
doSetup silent
doStartVsCode "${@}"
elif [ "${1}" = "ws-up" ] || [ "${1}" = "ws-update" ]
Expand All @@ -166,7 +177,8 @@ do
doCreateIdeScript vscode
elif [ "${1}" = "add-plugin" ]
then
doAddPlugin "--install-extension ${2}"
shift
doAddPlugin "${@}"
exit ${?}
else
doFail "Undefined argument: ${1}"
Expand Down

0 comments on commit c058b67

Please sign in to comment.