Skip to content

Commit 6b76aaa

Browse files
authored
Merge pull request #1580 from aws/autoMerge/feature/featureDev-codegen
Merge staging into feature/featureDev-codegen
2 parents b839060 + a66e7e8 commit 6b76aaa

File tree

111 files changed

+1801
-438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1801
-438
lines changed

.changes/2.11.0.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"date": "2024-02-22",
3+
"version": "2.11.0",
4+
"entries": [
5+
{
6+
"type": "Feature",
7+
"description": "Amazon Q: /dev command now supports the InvalidState event during the GenerateApproach step. The reason for the Approach to reach an Invalid State is printed in /dev's chat response."
8+
},
9+
{
10+
"type": "Feature",
11+
"description": "CloudFormation and SAM templates now have a CodeLens link to Application Composer"
12+
},
13+
{
14+
"type": "Feature",
15+
"description": "Amazon Q CodeTransformation: show user build logs for Maven install and copy-deps commands"
16+
}
17+
]
18+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Amazon Q: Static analysis of document symbols used as context in Amazon Q requests must filter tree-sitter \"extra\" CST nodes (comments) in order to avoid crashes which freeze the chat panel"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "Enable node 20 for SAM create and local Lambda debugging"
4+
}

.changes/next-release/Feature-214097b6-7e2e-4a96-a932-3f8966939f7c.json

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "CodeWhisperer: Add startUrl to security scan telemetry"
4+
}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ packages/toolkit/resources/css/icons.css
5252
.local.env
5353
*.config.local.json
5454

55-
# Created by `npm run browserRun` when testing extension in the browser
55+
# Created by `npm run webRun` when testing extension in web mode
5656
.vscode-test-web

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 2.11.0 2024-02-22
2+
3+
- **Feature** Amazon Q: /dev command now supports the InvalidState event during the GenerateApproach step. The reason for the Approach to reach an Invalid State is printed in /dev's chat response.
4+
- **Feature** CloudFormation and SAM templates now have a CodeLens link to Application Composer
5+
- **Feature** Amazon Q CodeTransformation: show user build logs for Maven install and copy-deps commands
6+
17
## 2.10.0 2024-02-16
28

39
- **Bug Fix** CDK Explorer: Refresh button is now visible.

CONTRIBUTING.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ You can also use these NPM tasks (see `npm run` for the full list):
148148
149149
---
150150
151-
### Browser
151+
### Web Mode
152152
153-
The AWS Toolkit VSCode extension has a support (with limited functionality) for running in the browser, eg [vscode.dev](https://vscode.dev).
153+
The AWS Toolkit VSCode extension has a support (with limited functionality) for running in a web browser, eg [vscode.dev](https://vscode.dev).
154154
155-
See [browser.md](./docs/browser.md) for working with the browser implementation of the extension.
155+
See [web.md](./docs/web.md) for working with the web mode implementation of the extension.
156156
157157
---
158158
@@ -214,12 +214,6 @@ To run tests against a specific folder in VSCode, do any one of:
214214
$Env:TEST_DIR = "src/test/foo"; npm run test
215215
```
216216
217-
### Browser Support
218-
219-
Running the extension in the browser (eg: [vscode.dev](https://vscode.dev/)).
220-
221-
[See documentation here](./packages/toolkit/src/browser/README.md).
222-
223217
### Coverage report
224218
225219
You can find the coverage report at `./coverage/index.html` after running the tests. Tests ran from the workspace launch config won't generate a coverage report automatically because it can break file watching. A few manual steps are needed instead:

docs/ARCHITECTURE.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ An overview of the architecture for various components within the Toolkit.
66

77
This project is currently set up as a typescript monorepo with a single subproject.
88
We are currently working on splitting the Toolkit into various subprojects to help with
9-
sharing code between modules, browser extension development, etc. For now, there is just
9+
sharing code between modules, Web mode development, etc. For now, there is just
1010
one monolithic subproject with all the extension functionality: [`packages/toolkit/`](./packages/toolkit/).
1111

1212
Unless otherwise stated, the documentation throughout this project is referring to the code and
@@ -337,7 +337,14 @@ Abstractly, a 'wizard' is a collection of discrete, linear steps (subroutines),
337337

338338
### Creating a Wizard (Quick Picks)
339339

340-
A new wizard can be created by extending off the base `Wizard` class, using the template type to specify the shape of the wizard state. All wizards have an internal 'form' property that is used to assign steps. We can assign UI elements (namely, quick picks) using the `bindPrompter` method on form elements. This method accepts a callback that should return a `Prompter` given the current state. For this example, we will use `createQuickPick` and `createInputBox` for our prompters:
340+
Create a new wizard by extending the base `Wizard` class, using the template type to specify the
341+
shape of the wizard state. All wizards have an internal `form` property that is used to assign
342+
steps. You can assign UI elements (namely, quickpicks) using the `bindPrompter` method on form
343+
elements. This method accepts a callback that should return a `Prompter` given the current state.
344+
For this example, we will use `createQuickPick` and `createInputBox` for our prompters:
345+
346+
If you need to call async functions to construct your `Wizard` subclass, define your init logic in
347+
the `init()` method instead of the constructor.
341348

342349
```ts
343350
interface ExampleState {
@@ -382,7 +389,7 @@ Note that all wizards can potentially return `undefined` if the workflow was can
382389
Use `createWizardTester` on an instance of a wizard. Tests can then be constructed by asserting both the user-defined and internal state. Using the above `ExampleWizard`:
383390

384391
```ts
385-
const tester = createWizardTester(new ExampleWizard())
392+
const tester = await createWizardTester(new ExampleWizard())
386393
tester.foo.assertShowFirst() // Fails if `foo` is not shown (or not shown first)
387394
tester.bar.assertDoesNotShow() // True since `foo` is not assigned an explicit value
388395
tester.foo.applyInput('Hello, world!') // Manipulate 'user' state

docs/browser.md renamed to docs/web.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# Browser
1+
# Web Mode
22

3-
This extension can run in the web browser (eg: [vscode.dev](https://vscode.dev)), but with limited functionality compared to
3+
This extension can run in a web browser (eg: [vscode.dev](https://vscode.dev)), but with limited functionality compared to
44
the desktop version.
55

6-
## Running the Browser implementation
6+
## Running the Web mode implementation
77

8-
You can run the browser implementation of the extension in the following ways.
8+
You can run the Web mode implementation of the extension in the following ways.
99

1010
## Pre-requisites
1111

1212
[See the CONTRIBUTING document.](../CONTRIBUTING.md#setup)
1313

1414
### General Notes
1515

16-
- To see logs, using the Command Palette search: `Toggle Developer Tools`. Then go to the `Console` tab. In browser mode VS Code seems to duplicate log messages, idk how to fix this.
17-
- The difference between browser mode and Node.js/desktop is that browser mode is in an actual browser environment so certain things like Node.js modules will **not** be available.
16+
- To see logs, using the Command Palette search: `Toggle Developer Tools`. Then go to the `Console` tab. In web mode VS Code seems to duplicate log messages, idk how to fix this.
17+
- The difference between web mode and Node.js/desktop is that in web mode everything runs in browser environment so certain things like Node.js modules will **not** be available.
1818

1919
## Running in an actual Browser
2020

2121
The following steps will result in a Chrome window running with VS Code
22-
and the Browser version of the AWS Toolkit extension installed:
22+
and the web version of the AWS Toolkit extension installed:
2323

2424
1. (Recommended) To have the Chrome window save your VS Code state after closing it, you need to modify the node module which executes the playwright method that opens it. In `node_modules/@vscode/test-web/out/index.js#openBrowser()` make the following change:
2525

@@ -51,26 +51,30 @@ and the Browser version of the AWS Toolkit extension installed:
5151

5252
#### (OPTIONAL) Enabling CORS
5353

54-
By default, we disable CORS in browser mode since certain endpoints
54+
By default, we disable CORS in web mode since certain endpoints
5555
such as telemetry or auth do not support CORS (at the moment of writing) for the VSCode origin.
5656

5757
In the case you want to enable CORS in the browser to test CORS compatibility
5858
do the following:
5959

60-
- In `package.json` find the `browserRun` script
60+
- In `package.json` find the `webRun` script
6161
- Temporarily remove `--browserOption=--disable-web-security`
6262

6363
Now when you run the extension in the browser it will do CORS checks.
6464

65-
## Testing in VSCode Browser Mode
65+
## Testing in VSCode Web Mode
6666

6767
The following steps will result in a VSCode Extension window running
6868
with the AWS Toolkit extension installed. While it looks the same as a typical
6969
VS Code window, in the background it is running in a Browser context.
7070

71-
- In the `Run & Debug` menu run: `Extension Tests (browser)`
71+
- In the `Run & Debug` menu run: `Extension Tests (web)`
7272

73-
> NOTE: Tests do not spin up an actual Browser window, but if we find a good reason to switch it will require some additional work. The current way does not require dowloading a separate browser like Chromium.
73+
> NOTE: Tests do not spin up an actual browser window, but if we find a good reason to switch it will require some additional work. The current way does not require dowloading a separate browser like Chromium.
74+
75+
## Adding Web mode specific npm modules
76+
77+
If you need to manage npm modules required for Web mode, such as a [browserfied module](https://www.npmjs.com/package/os-browserify), see [the documentation here](../packages/toolkit/src/web/README.md).
7478

7579
## Finding incompatible transitive dependencies
7680

@@ -97,13 +101,13 @@ to help us visualize the imports and determine which module is importing a certa
97101

98102
### Summary
99103

100-
- **When in Browser mode**, state is not shared between the actual extension code and the unit test code. I.e you cannot modify a global variable in the extension code and see that change in the unit tests
104+
- **When in Web mode**, state is not shared between the actual extension code and the unit test code. I.e you cannot modify a global variable in the extension code and see that change in the unit tests
101105
- State will need to be stored somewhere in `globalThis` to be accessible by tests. Any state not in `globalThis` will not be the same as the actual extension, they are separate.
102106

103-
With the introduction of Browser support, it was discovered that the context between the extension code and test code is not shared.
107+
With the introduction of web mode support, it was discovered that the context between the extension code and test code is not shared.
104108
Though it is shared in the Node version of the extension.
105109

106-
Example that does NOT work in the Browser:
110+
Example that does NOT work in Web mode:
107111

108112
```typescript
109113
export let myGlobal = 'A'
@@ -115,17 +119,17 @@ function activate() {
115119
```
116120

117121
```typescript
118-
// Browser unit test
122+
// Web unit test
119123
import { myGlobal } from '../src/extension.ts'
120124
121125
describe('test', function () {
122126
it('test', function () {
123-
assert.strictEqual(myGlobal, 'B') // this fails in Browser (but not Node.js). The value here is actually 'A'.
127+
assert.strictEqual(myGlobal, 'B') // this fails in Web (but not Node.js). The value here is actually 'A'.
124128
})
125129
})
126130
```
127131

128-
Example that DOES work in the Browser:
132+
Example that DOES work in Web mode:
129133

130134
```typescript
131135
;(globalThis as any).myGlobal = 'A'
@@ -136,17 +140,17 @@ function activate() {
136140
```
137141

138142
```typescript
139-
// Browser unit test
143+
// Web unit test
140144
describe('test', function () {
141145
it('test', function () {
142-
assert.strictEqual((globalThis as any).myGlobal, 'B') // this succeeds in Browser and Node.js
146+
assert.strictEqual((globalThis as any).myGlobal, 'B') // this succeeds in Web and Node.js
143147
})
144148
})
145149
```
146150

147151
### Web Worker
148152

149-
The assumption for the behavior is due to how Web Workers work. We (VS Code) use them to run our extension and unit test code when in the Browser. The scripts share global values differently compared to a different environment such as Node.js.
153+
The assumption for the behavior is due to how Web Workers work. We (VS Code) use them to run our extension and unit test code when in the browser. The scripts share global values differently compared to a different environment such as Node.js.
150154

151155
- [`WorkerGlobalScope`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope)
152156
- The context of the executing code is contained within itself and is not accessible to other scripts (eg: extension code context is not accessible by unit tests)

0 commit comments

Comments
 (0)