Skip to content

Commit

Permalink
chore(project-type): context-menu example commands enablement configu…
Browse files Browse the repository at this point in the history
…red + README.md updated
  • Loading branch information
alex-gilin committed Dec 15, 2021
1 parent 24493f5 commit 50c905c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
27 changes: 16 additions & 11 deletions examples/vscode-artifact-management-context-menus/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
# Example VSCode Extension using workspace instance
# Example of vscode extension using conditional operator to enable the extension's command

An example demonstrating using VSCode [conditional `in` operator](https://code.visualstudio.com/api/references/when-clause-contexts#in-conditional-operator)
in conjunction with custom contexts created using `@sap/artifact-managment` project type information.

TODO: finish description

## pre-requisites

- **Nodejs**: An `active` or `maintenance` version.
- **Yarn**: version 1.x
- CAP Development Kit `npm install -g @sap/cds-dk` (must be **globally** installed).
- **pnpm**: version >= 6.x

## Initial setup

In commandline/shell at the **root** of this monorepo:

1. `yarn`.
2. `yarn compile`.
1. `pnpm i`.
2. `pnpm compile`.

In "Main" VSCode window:

1. `File` --> `Open Folder...` and select this mono repo's **root**.
2. go to `Run and Debug` tab,
3. select the launch configuration called `Run Toolkit with Project Type Context Menus Example` in the dropdown.
3. select the launch configuration called `Run Toolkit with Artifact-Management Context Menus Example` in the dropdown.
4. click the `Start Debugging` green run icon.

In the newly opened VSCode "Extension Development Host" Window:

1. `File` -> `Open Folder` -> select the `samples/cap-project` folder under the root of this repo.
2. Open the output panel: `View` -> `Output`
3. Select `SAP OSS.project_using_workspace_api_instance` in the dropdown menu.
4. Inspect the printed `@sap/artifact-managment` project type hierarchy.
2. 'Add Folder to Workspace...' -> select the `samples/openui5` folder.
3. Open the output panel: `View` -> `Output`
4. Select `vscode-using-workspace-api` in the dropdown menu.
5. Inspect the printed `@sap/artifact-managment` project type hierarchy.

## Inspecting the context dependent commands

1. Select the `openui5` folder in the workspace explorer and right click on it --> you should see the `Deploy UI5 Application` menu appear in the context menu that opens.
2. Navigate to `openui5` --> `webapp` --> `manifest.json`. Select and right click on it --> this time you should see the two menus `Deploy UI5 Application` and `Edit UI5 Manifest` appears in the context menu that opens.
3. Select the `cap-project` folder in the workspace explorer and right click on it --> you should see the `Preview LCAP Application` menu appear in the context menu that opens.
4. Right click on another file in other project --> the mentioned context menus should not appear.
14 changes: 14 additions & 0 deletions examples/vscode-artifact-management-context-menus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@
],
"contributes": {
"menus": {
"commandPalette": [
{
"when": "false",
"command": "extension.capPreview"
},
{
"when": "false",
"command": "extension.ui5Deploy"
},
{
"when": "false",
"command": "extension.ui5EditManifest"
}
],
"explorer/context": [
{
"command": "extension.capPreview",
Expand Down

0 comments on commit 50c905c

Please sign in to comment.