Skip to content

Commit

Permalink
feat(explorer): move CDK to 'Developer Tools' view (#2639)
Browse files Browse the repository at this point in the history
## Problem

The CDK explorer is basically a copy-paste of the AWS explorer with a few tweaks. This makes it hard to move it around because it has a 'custom' tree provider combined with usage of a coupled base class.

AWSTreeNodeBase is not great for two reasons:

* Directly inherits from vscode.TreeItem
* Developers are encouraged to pack business logic directly in the UI element (!)

The inheritance itself isn't bad, it's just when we also embed logic for user gestures. It makes it really easy to just pipe the node everywhere which we don't want.


## Solution

Separate out the resource ('model') from the tree item in its own interface. I had to add a corresponding data provider as well. Some ideas are still being worked out in terms of ergonomics though the implementation itself is sound.

This PR is the first step towards separating out the model from the tree. CDK was refactored to test some of the ideas.
  • Loading branch information
JadenSimon authored May 23, 2022
1 parent 7d2332a commit 5dbf5e6
Show file tree
Hide file tree
Showing 50 changed files with 997 additions and 1,820 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Feature",
"description": "You can now find CDK functionality under the 'Developer Tools' view. This view will contain more ways to work with local project resources in future releases."
}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ CHANGELOG.md
src/shared/telemetry/service-2.json
.changes
src/testFixtures/**
resources/markdown/samReadme.md
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AWS Toolkit for Visual Studio Code

| System | Status |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| System | Status |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Build ([main branch](https://github.com/aws/aws-toolkit-vscode/commits/master)) | [![GitHub CI status](https://github.com/aws/aws-toolkit-vscode/workflows/CI/badge.svg?branch=master)](https://github.com/aws/aws-toolkit-vscode/actions?query=branch%3Amaster) ![CodeBuild Build Status - main branch](https://codebuild.us-west-2.amazonaws.com/badges?uuid=eyJlbmNyeXB0ZWREYXRhIjoiMlluaDRTMnZLdmMvcFREQVQ4RjFoK0FUSTZPdlRVcWJlQ2gwRElLT2gxZDhMeno5MThZZnlXdURDVFFjOWdqSEQ5QjVBYm0xSURoU3E1RTVHejltcnZrPSIsIml2UGFyYW1ldGVyU3BlYyI6IkY3SE9CaG1oMHhJUmsyakkiLCJtYXRlcmlhbFNldFNlcmlhbCI6MX0%3D&branch=master) [![Coverage](https://img.shields.io/codecov/c/github/aws/aws-toolkit-vscode/master.svg)](https://codecov.io/gh/aws/aws-toolkit-vscode/branch/master) [![LGTM Grade](https://img.shields.io/lgtm/grade/javascript/github/aws/aws-toolkit-vscode)](https://lgtm.com/projects/g/aws/aws-toolkit-vscode/) |
| [Marketplace](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) | [![Marketplace Version](https://img.shields.io/vscode-marketplace/v/AmazonWebServices.aws-toolkit-vscode.svg) ![Marketplace Downloads](https://img.shields.io/vscode-marketplace/d/AmazonWebServices.aws-toolkit-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) |
| [Marketplace](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) | [![Marketplace Version](https://img.shields.io/vscode-marketplace/v/AmazonWebServices.aws-toolkit-vscode.svg) ![Marketplace Downloads](https://img.shields.io/vscode-marketplace/d/AmazonWebServices.aws-toolkit-vscode.svg)](https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.aws-toolkit-vscode) |

The AWS Toolkit for Visual Studio Code is an extension for working with AWS services such as AWS Lambda.

Expand Down
70 changes: 32 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"onCommand:aws.previewStateMachine",
"onCommand:aws.stepfunctions.createStateMachineFromTemplate",
"onCommand:aws.stepfunctions.publishStateMachine",
"onView:aws.cdk.explorer",
"onCommand:aws.refreshCdkExplorer",
"onView:aws.developerTools",
"onCommand:aws.cdk.refresh",
"onCommand:aws.cdk.renderStateMachineGraph",
"onCommand:aws.aboutToolkit",
"onCommand:aws.cloudWatchLogs.viewLogStream",
Expand Down Expand Up @@ -684,9 +684,8 @@
"name": "%AWS.lambda.explorerTitle%"
},
{
"id": "aws.cdk.explorer",
"name": "%AWS.cdk.explorerTitle%",
"when": "!isCloud9"
"id": "aws.developerTools",
"name": "%AWS.developerTools.explorerTitle%"
}
]
},
Expand Down Expand Up @@ -761,7 +760,11 @@
"when": "false"
},
{
"command": "aws.refreshCdkExplorer",
"command": "aws.cdk.refresh",
"when": "false"
},
{
"command": "aws.cdk.viewDocs",
"when": "false"
},
{
Expand Down Expand Up @@ -924,10 +927,6 @@
"command": "aws.s3.uploadFileToParent",
"when": "false"
},
{
"command": "aws.cdk.help",
"when": "!isCloud9"
},
{
"command": "aws.apprunner.startDeployment",
"when": "false"
Expand Down Expand Up @@ -1140,16 +1139,6 @@
"command": "aws.viewLogs",
"when": "view == aws.explorer || !aws.explorer.visible && view =~ /^aws/",
"group": "z_about@1"
},
{
"command": "aws.refreshCdkExplorer",
"when": "view == aws.cdk.explorer",
"group": "navigation@5"
},
{
"command": "aws.cdk.help",
"when": "view == aws.cdk.explorer",
"group": "z_externalLinks@1"
}
],
"explorer/context": [
Expand Down Expand Up @@ -1337,12 +1326,12 @@
},
{
"command": "aws.cdk.renderStateMachineGraph",
"when": "view == aws.cdk.explorer && viewItem == awsCdkStateMachineNode",
"when": "viewItem == awsCdkStateMachineNode",
"group": "inline@1"
},
{
"command": "aws.cdk.renderStateMachineGraph",
"when": "view == aws.cdk.explorer && viewItem == awsCdkStateMachineNode",
"when": "viewItem == awsCdkStateMachineNode",
"group": "0@1"
},
{
Expand Down Expand Up @@ -1644,6 +1633,21 @@
"command": "aws.sam.newTemplate",
"group": "0@2",
"when": "view == aws.explorer && viewItem == awsCloudFormationRootNode"
},
{
"command": "aws.cdk.refresh",
"when": "viewItem == awsCdkRootNode",
"group": "inline@1"
},
{
"command": "aws.cdk.refresh",
"when": "viewItem == awsCdkRootNode",
"group": "0@1"
},
{
"command": "aws.cdk.viewDocs",
"when": "viewItem == awsCdkRootNode",
"group": "0@2"
}
]
},
Expand Down Expand Up @@ -1730,16 +1734,6 @@
}
}
},
{
"command": "aws.cdk.help",
"title": "%AWS.command.cdk.help%",
"category": "%AWS.title%",
"cloud9": {
"cn": {
"category": "%AWS.title.cn%"
}
}
},
{
"command": "aws.ecr.copyTagUri",
"title": "%AWS.command.ecr.copyTagUri%",
Expand Down Expand Up @@ -2337,19 +2331,19 @@
}
},
{
"command": "aws.refreshCdkExplorer",
"command": "aws.cdk.refresh",
"title": "%AWS.command.refreshCdkExplorer%",
"category": "%AWS.title%",
"icon": {
"dark": "third-party/resources/from-vscode-icons/dark/refresh.svg",
"light": "third-party/resources/from-vscode-icons/light/refresh.svg"
},
"cloud9": {
"cn": {
"category": "%AWS.title.cn%"
}
}
},
{
"command": "aws.cdk.viewDocs",
"title": "%AWS.generic.viewDocs%",
"category": "%AWS.title%"
},
{
"command": "aws.stepfunctions.createStateMachineFromTemplate",
"title": "%AWS.command.stepFunctions.createStateMachineFromTemplate%",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"AWS.title.cn": "Amazon",
"AWS.productName": "AWS Toolkit",
"AWS.productName.cn": "Amazon Toolkit",
"AWS.cdk.explorerTitle": "CDK (Preview)",
"AWS.configuration.profileDescription": "The name of the credential profile to obtain credentials from.",
"AWS.configuration.description.lambda.recentlyUploaded": "Recently selected Lambda upload targets.",
"AWS.configuration.description.logLevel": "The AWS Toolkit's log level (changes reflected on restart)",
Expand Down Expand Up @@ -164,6 +163,7 @@
"AWS.command.resources.copyIdentifier": "Copy Identifier",
"AWS.command.resources.configure": "Show Resources...",
"AWS.lambda.explorerTitle": "Explorer",
"AWS.developerTools.explorerTitle": "Developer Tools",
"AWS.cloudWatchLogs.limit.desc": "Maximum amount of log entries pulled per request from CloudWatch Logs (max 10000)",
"AWS.samcli.deploy.bucket.recentlyUsed": "Buckets recently used for SAM deployments",
"AWS.generic.create": "Create...",
Expand Down
Loading

0 comments on commit 5dbf5e6

Please sign in to comment.