You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/TESTPLAN.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ Checking the state works well if user interactions are not required by the code
104
104
To handle this, test code can register event handler that listen for when a certain type of UI element is shown. For example, if we wanted to always accept the first item of a quick pick we can do this:
Exceptions thrown within one of these handlers will cause the current test to fail. This allows you to make assertions within the callback without worrying about causing the test to hang.
124
+
125
+
## Common issues
126
+
127
+
### Stubbing VSCode outside of core
128
+
129
+
- Stubbing VSCode imports (like executeCommand) does not work outside of core. For now you will need to put any tests that require spying/stubbing VSCode imports in core until we move more source files into the amazon q package
Copy file name to clipboardExpand all lines: docs/arch_develop.md
+30-32Lines changed: 30 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,39 +71,37 @@ Some components of the core library depend on the `package.json`s of the extensi
71
71
- Does not restore, it is a superset of what exists in `packages/core` for `configuration.properties`.
72
72
- To develop for the Amazon Q extension: add all changes to `packages/amazonq/package.json`, EXCEPT for settings that are references by code in the core library, or settings that already exist in the core `package.json`
73
73
74
-
## Shared vs Common names
74
+
If you are modifying or registering new debuggers in VS Code via the `debuggers` contribution point, you may need to regenerate the [definitions file](../packages/core/src/shared/sam/debugger/awsSamDebugConfiguration.gen.ts). After updating ['toolkit/package.json'](../packages/toolkit/package.json), run `npm run generateConfigurationAttributes -w packages/toolkit`
75
75
76
-
In this repo, the keywords **"shared"** and **"common"** have specific meanings in the context of file/folder names.
This project can run in different environments, eg Web mode (in the browser with no compute backend), or in Node.js on your desktop (the most common way).
79
+
A problem arises when we use code that is exclusive to one environment, an example being Node.js' Filesystem module which will fail in Web mode.
79
80
80
-
Code within a folder/file that has the "common" keyword implies that it can run in any environment. Examples of environments are: Web mode, or Node.js (local desktop)
81
+
To ensure developers use compatible code for their environment we have subfolders in each topic which contains environment specific code in a single place.
81
82
82
-
We need this distinction since not all code can run in any environment. A common example is filesystem code, where the actual implementation used could work in Node.js but not in Web mode.
83
+
Using this file tree as reference, here are the rules:
83
84
84
-
### "shared"
85
-
86
-
Code within a folder/file that has the "shared" keyword implies that it is intended to be reused wherever it can be. This is generalized code that "Feature A" or "Feature B" could use if it works for their use case.
87
-
88
-
An example is the `waitUntil()` function which continuously invokes an arbitrary callback function until it succeeds.
89
-
90
-
> NOTE: Something that is "shared" does not mean it is "common", as it could be reused in different places but only work in Node.js for example.
85
+
```
86
+
src/
87
+
├── myTopic/
88
+
│ ├── {file}.ts
89
+
│ ├── node/
90
+
│ │ └── {file}.ts
91
+
│ └── web/
92
+
│ └── {file}.ts
93
+
└── shared/
94
+
```
91
95
92
-
### How to apply this
96
+
-`myTopic/` is the general name of the folder, eg `request` for http requests.
97
+
-`myTopic/{file}.ts` is for code that works in any environment, we refer to this as `"common"` code.
98
+
-`node/{file}.ts` is for code that works exclusively in Node.js.
99
+
-`web/{file}.ts` is for code that works exclusively in Web mode.
100
+
-`shared/` is for code that is intended to be reused, i.e general purpose utils.
101
+
- Note environment specific code should be place in to a `web/` or `node/` subfolder.
102
+
- If the code is not in a subfolder then it is considered `shared common` code.
93
103
94
-
- Aim to make code compatible with "common" from the beginning.
95
-
- In a "topic" folder, if you have common code, create a subfolder named "common" and add your common code to there.
96
-
```
97
-
src/
98
-
|
99
-
myTopic/
100
-
|
101
-
common/
102
-
nonCommon.ts
103
-
```
104
-
- See if yours, or existing code can be moved in to a "shared" folder. Maybe it can be easily modified to become "shared".
105
-
- If there is no "shared" or "common" naming used for the file/folder, then assume it only works in Node.js.
106
-
- In the rare case your code only works in Web mode, create a `web` subfolder for that code.
104
+
> IMPORTANT: The current codebase does not fully follow this convention yet, the transition is being done incrementally. Due to this, code that is `"common"` may not actually be common yet. If you run in to this, please move that code to the appropriate subfolder.
107
105
108
106
## Commands
109
107
@@ -292,22 +290,22 @@ Commands and events are defined on the backend via sub-classes of `VueWebview`.
Copy file name to clipboardExpand all lines: docs/icons.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,17 @@
1
1
# Icons
2
2
3
-
All icons that are used in the Toolkit can be found in `resources/icons`.
3
+
All icons that are used in the extensions can be found in `resources/icons`.
4
4
5
-
A [build script](../../scripts/build/generateIcons.ts) generates Toolkit artifacts:
5
+
A [build script](../scripts/generateIcons.ts) generates extension artifacts in [core/](../packages/core/):
6
6
7
7
-`resources/icons/cloud9/generated`
8
8
-`resources/fonts/aws-toolkit-icons.woff`
9
9
-`resources/css/icons.css`
10
-
-`contributes.icons` in [package.json](../../package.json)
10
+
-`contributes.icons` in [amazonq package.json](../packages/amazonq/package.json) and [toolkit package.json](../packages/toolkit/package.json)
11
11
12
-
This script should be ran using `npm run generatePackage` after making updates. Any changes made to `package.json` should be committed with the relevant icons.
12
+
This script should be ran using `npm run generateIcons` after making updates. Any changes made to `package.json` should be committed with the relevant icons. Type checking in `core/` relies on the entries in `core/package.json`. However, the individual extensions require entries in their `package.json`s as well. Currently, resources (including icons) are shared between `core/` and the individual extensions. If `contributes.icons` in each of the extensions does not match the entry in `core/`, then CI will fail.
13
+
14
+
To sync the icons to the individual extensions, run `npm run copyFiles && npm run generateIcons` for each extension.
Copy file name to clipboardExpand all lines: docs/telemetry.md
+121Lines changed: 121 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -139,3 +139,124 @@ Finally, if `setupStep2()` was the thing that failed we would see a metric like:
139
139
...
140
140
}
141
141
```
142
+
143
+
## Adding a "Stack Trace" to your metric
144
+
145
+
### Problem
146
+
147
+
Common example: _"I have a function, `thisFailsSometimes()` that is called in multiple places. The function sometimes fails, I know from telemetry, but I do not know if it is failing when it is a specific caller. If I knew the call stack/trace that it took to call my function that would help me debug."_
148
+
149
+
```typescript
150
+
function outerA() {
151
+
thisFailsSometimes(1) // this succeeds
152
+
}
153
+
154
+
function outerB() {
155
+
thisFailsSometimes(0) // this fails
156
+
}
157
+
158
+
function thisFailsSometimes(num:number) {
159
+
returntelemetry.my_Metric.run(() => {
160
+
if (number===0) {
161
+
throwError('Cannot be 0')
162
+
}
163
+
...
164
+
})
165
+
}
166
+
```
167
+
168
+
### Solution
169
+
170
+
Add a value to `function` in the options of a `run()`. This will result in a stack of functions identifiers that were previously called
171
+
before `thisFailsSometimes()` was run. You can then retrieve the stack in the `run()` of your final metric using `getFunctionStack()`.
0 commit comments