Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#982: Add plugin recommendation feature to vscode #993

Merged
merged 30 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
76f5821
add recommendation feature
alfeilex Nov 22, 2022
40e7475
fix typo
alfeilex Nov 22, 2022
c7df866
modify feature
alfeilex Nov 24, 2022
a908822
update rm -fR to rm
alfeilex Nov 24, 2022
a67319d
update docs and changelog
alfeilex Nov 24, 2022
fbe8a3b
fix typo
alfeilex Nov 24, 2022
9d7e28f
Merge branch 'master' into feature/vscode-recommendations
alfeilex Dec 8, 2022
09bf643
Merge branch 'master' into feature/vscode-recommendations
alfeilex Dec 14, 2022
1037e58
Merge branch 'master' into feature/vscode-recommendations
hohwille Dec 19, 2022
3e4e62f
Merge branch 'devonfw:master' into feature/vscode-recommendations
alfeilex Jan 18, 2023
1f81c97
resolve review tasks
alfeilex Jan 18, 2023
c8f0945
Update CHANGELOG.asciidoc
alfeilex Jan 18, 2023
60be735
Update vscode
alfeilex Jan 18, 2023
00dff71
Update vscode.asciidoc
alfeilex Jan 18, 2023
a4e7e66
Update vscode.asciidoc
alfeilex Jan 18, 2023
637d00a
Merge branch 'master' into feature/vscode-recommendations
alfeilex Jan 23, 2023
e710417
redesign recommendation functionality
alfeilex Jan 23, 2023
f386ce5
Merge branch 'feature/vscode-recommendations' of https://github.com/a…
alfeilex Jan 23, 2023
b14db26
Merge branch 'master' into feature/vscode-recommendations
alfeilex Jan 31, 2023
935d904
Merge branch 'devonfw:master' into feature/vscode-recommendations
alfeilex Feb 2, 2023
07c5842
Merge branch 'master' into feature/vscode-recommendations
alfeilex Feb 6, 2023
3ffb2e4
Update CHANGELOG.asciidoc
alfeilex Feb 7, 2023
d346dba
Merge branch 'master' into feature/vscode-recommendations
alfeilex Feb 7, 2023
9e586f7
Merge branch 'master' into feature/vscode-recommendations
alfeilex Feb 7, 2023
90083b5
Merge branch 'master' into feature/vscode-recommendations
hohwille Feb 13, 2023
ddb836d
resolve review feedback
alfeilex Feb 27, 2023
5172502
add hint for main workspace
alfeilex Feb 28, 2023
4252749
#982: #993: improved doc
hohwille Mar 2, 2023
980bd54
Merge branch 'master' into feature/vscode-recommendations
hohwille Mar 2, 2023
5b93fcc
Merge branch 'master' into feature/vscode-recommendations
hohwille Mar 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The full list of changes for this release can be found in https://github.com/dev

Release with small but important bugfixes:

* https://github.com/devonfw/ide/issues/982[#982]: Add recommendation feature and clean setup option to vscode
alfeilex marked this conversation as resolved.
Show resolved Hide resolved
* https://github.com/devonfw/ide/issues/966[#966]: npm detection not reliable and redundant
* https://github.com/devonfw/ide/issues/954[#954]: First install removes all folders from user path
* https://github.com/devonfw/ide/issues/956[#956]: no matches found error if software folder missing
Expand Down
5 changes: 3 additions & 2 deletions documentation/vscode.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ You may also supply additional arguments as `devon vscode «args»`. These are e
|`ws-re[verse]` |reverse merge changes from workspace into settings
|`ws-reverse-add`|reverse merge adding new properties
|`create-script` |create launch script for this IDE, your current workspace and your OS
|`clean-setup` |clean VSCode setup without plugins and recommendations
|=======================


Expand All @@ -42,7 +43,7 @@ The variables are defined as following:

In general you should try to stick with the configuration pre-defined by your project. But some plugins may be considered as personal flavor and are typically not predefined by the project config. Such plugins should be shipped with your link:settings.asciidoc[settings] as described above with `plugin_active=false` allowing you to easily install it manually. Surely, you can easily add plugins via the UI of VS code. However, be aware that some plugins may collect sensitive data or could introduce other vulnerabilities. So consider the governance of your project and talk to your technical lead before installing additional plugins that are not pre-defined in your link:settings.asciidoc[settings].

As maintainer of the link:settings.asciidoc[settings] for your project you should avoid to ship too many plugins that may waste resources but are not used by every developer. By configuring additional plugins with `plugin_active=false` you can give your developers the freedom to install some additional plugins easily.
As maintainer of the link:settings.asciidoc[settings] for your project you should avoid to ship too many plugins that may waste resources but are not used by every developer. By configuring additional plugins with `plugin_active=false` you can give your developers the freedom to install some additional plugins easily. In addition, deactivated plugins are recommended to the user by an existing link:https://code.visualstudio.com/docs/editor/extension-marketplace#_workspace-recommended-extensions[feature] of VS Code via prompt.

=== cleaning plugins on update

Expand All @@ -51,4 +52,4 @@ If you want to strictly manage the plugins for `VS code` in your project, you ca
clean_plugins_on_update=true
```

This will wipe all plugins when an update of `VS code` is performed (e.g. via `devon ide update`) and reinstall all configured plugins. While this gives you more control over the governance of the plugins and allows to remove a plugin later during project lifecycle. However, this will delete all manually installed plugins automatically without asking.
This will wipe all plugins when an update of `VS code` is performed (e.g. via `devon ide update`) and reinstall all configured plugins. While this gives you more control over the governance of the plugins and allows to remove a plugin later during project lifecycle. However, this will delete all manually installed plugins automatically without asking.
30 changes: 30 additions & 0 deletions scripts/src/main/resources/scripts/command/vscode
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ function doSetup() {
fi
}

function doCleanSetup() {
doInstall "vscode" "${VSCODE_VERSION}" "${1}"
}

function cleanupPlugins() {
clean_plugins_on_update="false"
doLoadProperties "${SETTINGS_PATH}"/vscode/vscode.properties
Expand All @@ -48,6 +52,7 @@ function cleanupPlugins() {
function doAddPlugins() {
local file
local pluginsToInstall=()
local pluginsToRecommend=()
for file in "${SETTINGS_PATH}"/vscode/plugins/*.properties
do
if [ -f "${file}" ]
Expand All @@ -61,13 +66,20 @@ function doAddPlugins() {
elif [ "${plugin_active}" = "true" ]
then
pluginsToInstall+=("${plugin_id}")
else
pluginsToRecommend+=("\"${plugin_id}\"")
fi
fi
done
if [ "${#pluginsToInstall}" -gt 0 ]
then
doAddPlugin "${pluginsToInstall[@]}"
fi
if [ "${#pluginsToRecommend}" -gt 0 ]
then
local IFS=,
doAddRecommendations "${pluginsToRecommend[*]}"
fi
}

function doAddPlugin() {
Expand Down Expand Up @@ -126,6 +138,18 @@ function doStartVsCode() {
doRunVsCode "${WORKSPACE_PATH}"
}

function doAddRecommendations() {
doEcho "add recommendations..."
local extensions="${WORKSPACE_PATH}/.vscode/extensions.json"
if [ -f "${extensions}" ]
then
rm "${extensions}"
hohwille marked this conversation as resolved.
Show resolved Hide resolved
echo "{\"recommendations\":[${1}]}" >> "${extensions}"
else
echo "{\"recommendations\":[${1}]}" >> "${extensions}"
fi
}

# CLI
if [ "${1}" = "-h" ] || [ "${1}" = "help" ]
then
Expand All @@ -140,6 +164,7 @@ then
echo " ws-re[verse] reverse merge changes from workspace into settings"
echo " ws-reverse-add reverse merge adding new properties"
echo " create-script create vscode-${WORKSPACE} script if not already exists"
echo " clean-setup clean VSCode setup without plugins and recommendations"
exit
fi
if [ -z "${1}" ]
Expand Down Expand Up @@ -180,6 +205,11 @@ do
shift
doAddPlugin "${@}"
exit ${?}
elif [ "${1}" = "clean-setup" ]
then
doCleanSetup "${2}"
doStartVsCode
alfeilex marked this conversation as resolved.
Show resolved Hide resolved
exit
else
doFail "Undefined argument: ${1}"
fi
Expand Down