Skip to content

Commit aa97451

Browse files
authored
Merge branch 'master' into fix/add-telemetry-ws
2 parents 1da7030 + 8831e6b commit aa97451

Some content is hidden

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

54 files changed

+1119
-246
lines changed

package-lock.json

Lines changed: 46 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amazonq/package.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,14 @@
349349
"command": "aws.amazonq.optimizeCode",
350350
"group": "cw_chat@4"
351351
},
352+
{
353+
"command": "aws.amazonq.generateUnitTests",
354+
"group": "cw_chat@5",
355+
"when": "aws.codewhisperer.connected && aws.isInternalUser"
356+
},
352357
{
353358
"command": "aws.amazonq.sendToPrompt",
354-
"group": "cw_chat@5"
359+
"group": "cw_chat@6"
355360
}
356361
],
357362
"editor/context": [
@@ -423,6 +428,12 @@
423428
"category": "%AWS.amazonq.title%",
424429
"enablement": "aws.codewhisperer.connected"
425430
},
431+
{
432+
"command": "aws.amazonq.generateUnitTests",
433+
"title": "%AWS.command.amazonq.generateUnitTests%",
434+
"category": "%AWS.amazonq.title%",
435+
"enablement": "aws.codewhisperer.connected && aws.isInternalUser"
436+
},
426437
{
427438
"command": "aws.amazonq.reconnect",
428439
"title": "%AWS.command.codewhisperer.reconnect%",
@@ -599,6 +610,13 @@
599610
"mac": "cmd+alt+q",
600611
"linux": "meta+alt+q"
601612
},
613+
{
614+
"command": "aws.amazonq.generateUnitTests",
615+
"key": "win+alt+t",
616+
"mac": "cmd+alt+t",
617+
"linux": "meta+alt+t",
618+
"when": "aws.codewhisperer.connected && aws.isInternalUser"
619+
},
602620
{
603621
"command": "aws.amazonq.invokeInlineCompletion",
604622
"key": "alt+c",

packages/amazonq/test/unit/codewhisperer/service/telemetry.test.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
assertTelemetry,
1414
assertTextEditorContains,
1515
createTestWorkspaceFolder,
16-
openATextEditorWithText,
16+
toTextEditor,
1717
} from 'aws-core-vscode/test'
1818
import {
1919
DefaultCodeWhispererClient,
@@ -156,7 +156,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
156156
describe('tab and esc', function () {
157157
it('single accept', async function () {
158158
assertSessionClean()
159-
const editor = await openATextEditorWithText('', 'test.py')
159+
const editor = await toTextEditor('', 'test.py')
160160

161161
await manualTrigger(editor, client, config)
162162
await acceptByTab()
@@ -166,7 +166,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
166166

167167
it('single reject', async function () {
168168
assertSessionClean()
169-
const editor = await openATextEditorWithText('', 'test.py')
169+
const editor = await toTextEditor('', 'test.py')
170170

171171
await manualTrigger(editor, client, config)
172172
await rejectByEsc()
@@ -179,7 +179,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
179179

180180
it('accept - accept - accept', async function () {
181181
assertSessionClean()
182-
const editor = await openATextEditorWithText('', 'test.py')
182+
const editor = await toTextEditor('', 'test.py')
183183

184184
await manualTrigger(editor, client, config)
185185
await acceptByTab()
@@ -190,7 +190,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
190190
await acceptByTab()
191191
await assertTextEditorContains(`FooBaz${os.EOL}Baz`)
192192

193-
const anotherEditor = await openATextEditorWithText('', 'anotherTest.py')
193+
const anotherEditor = await toTextEditor('', 'anotherTest.py')
194194
assertSessionClean()
195195
await manualTrigger(anotherEditor, client, config)
196196
await acceptByTab()
@@ -205,7 +205,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
205205

206206
it('accept - reject - accept', async function () {
207207
assertSessionClean()
208-
const editor = await openATextEditorWithText('', 'test.py')
208+
const editor = await toTextEditor('', 'test.py')
209209

210210
await manualTrigger(editor, client, config)
211211
await acceptByTab()
@@ -216,7 +216,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
216216
await rejectByEsc()
217217
await assertTextEditorContains('Foo')
218218

219-
const anotherEditor = await openATextEditorWithText('', 'anotherTest.py')
219+
const anotherEditor = await toTextEditor('', 'anotherTest.py')
220220
assertSessionClean()
221221
await manualTrigger(anotherEditor, client, config)
222222
await rejectByEsc()
@@ -231,7 +231,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
231231

232232
it('reject - reject - reject', async function () {
233233
assertSessionClean()
234-
const editor = await openATextEditorWithText('', 'test.py')
234+
const editor = await toTextEditor('', 'test.py')
235235

236236
await manualTrigger(editor, client, config)
237237
await rejectByEsc()
@@ -256,7 +256,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
256256

257257
it('reject - accept - reject', async function () {
258258
assertSessionClean()
259-
const editor = await openATextEditorWithText('', 'test.py')
259+
const editor = await toTextEditor('', 'test.py')
260260

261261
await manualTrigger(editor, client, config)
262262
await rejectByEsc()
@@ -302,7 +302,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
302302
}
303303

304304
assertSessionClean()
305-
const editor = await openATextEditorWithText('', 'test.py')
305+
const editor = await toTextEditor('', 'test.py')
306306

307307
await manualTrigger(editor, client, config)
308308
await navigateNext()
@@ -318,7 +318,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
318318
}
319319

320320
assertSessionClean()
321-
const editor = await openATextEditorWithText('', 'test.py')
321+
const editor = await toTextEditor('', 'test.py')
322322

323323
await manualTrigger(editor, client, config)
324324
await navigateNext()
@@ -336,7 +336,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
336336
}
337337

338338
assertSessionClean()
339-
const editor = await openATextEditorWithText('', 'test.py')
339+
const editor = await toTextEditor('', 'test.py')
340340

341341
await manualTrigger(editor, client, config)
342342
await navigateNext()
@@ -351,7 +351,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
351351
describe('typing', function () {
352352
it('typeahead match accept', async function () {
353353
assertSessionClean()
354-
const editor = await openATextEditorWithText('', 'test.py')
354+
const editor = await toTextEditor('', 'test.py')
355355

356356
await manualTrigger(editor, client, config)
357357
await typing(editor, 'F')
@@ -365,7 +365,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
365365

366366
it('typeahead match, backspace and accept', async function () {
367367
assertSessionClean()
368-
const editor = await openATextEditorWithText('', 'test.py')
368+
const editor = await toTextEditor('', 'test.py')
369369

370370
await manualTrigger(editor, client, config)
371371
await typing(editor, 'F')
@@ -385,7 +385,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
385385
// the solution is to waitUntil VSCode InlineSuggestion to resolve the "typeahead" but currently no easy way to know if the InlinSuggestion is shown visible again
386386
this.skip()
387387
assertSessionClean()
388-
const editor = await openATextEditorWithText('', 'test.py')
388+
const editor = await toTextEditor('', 'test.py')
389389

390390
await manualTrigger(editor, client, config)
391391
await typing(editor, 'F')
@@ -398,7 +398,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
398398
await rejectByEsc()
399399
await assertTextEditorContains('Foo')
400400

401-
const anotherEditor = await openATextEditorWithText('', 'anotherTest.py')
401+
const anotherEditor = await toTextEditor('', 'anotherTest.py')
402402
await manualTrigger(anotherEditor, client, config)
403403
await typing(anotherEditor, 'Qo')
404404
await assertTextEditorContains('Qo')
@@ -415,7 +415,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
415415

416416
it('typeahead not match after suggestion is shown and reject', async function () {
417417
assertSessionClean()
418-
const editor = await openATextEditorWithText('', 'test.py')
418+
const editor = await toTextEditor('', 'test.py')
419419

420420
await manualTrigger(editor, client, config)
421421
await typing(editor, 'H')
@@ -441,13 +441,13 @@ describe.skip('CodeWhisperer telemetry', async function () {
441441

442442
it('reject - typeahead not matching after suggestion is shown then invoke another round and accept', async function () {
443443
assertSessionClean()
444-
const editor = await openATextEditorWithText('', 'test.py')
444+
const editor = await toTextEditor('', 'test.py')
445445

446446
await manualTrigger(editor, client, config)
447447
await typing(editor, 'H')
448448
await assertTextEditorContains('H')
449449

450-
const anotherEditor = await openATextEditorWithText('', 'anotherTest.py')
450+
const anotherEditor = await toTextEditor('', 'anotherTest.py')
451451
await manualTrigger(anotherEditor, client, config)
452452
await acceptByTab()
453453
await assertTextEditorContains(`Baz${os.EOL}Baz`)
@@ -462,14 +462,14 @@ describe.skip('CodeWhisperer telemetry', async function () {
462462
describe('on editor change, focus change', function () {
463463
it('reject: trigger then open another editor', async function () {
464464
assertSessionClean()
465-
const editor = await openATextEditorWithText('', 'test.py', tempFolder, { preview: false })
465+
const editor = await toTextEditor('', 'test.py', tempFolder, { preview: false })
466466

467467
await manualTrigger(editor, client, config)
468468

469-
await openATextEditorWithText('text in 2nd editor', 'another1.py', tempFolder, {
469+
await toTextEditor('text in 2nd editor', 'another1.py', tempFolder, {
470470
preview: false,
471471
})
472-
const anotherEditor = await openATextEditorWithText('text in 3rd editor', 'another2.py', tempFolder, {
472+
const anotherEditor = await toTextEditor('text in 3rd editor', 'another2.py', tempFolder, {
473473
preview: false,
474474
})
475475

@@ -483,7 +483,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
483483

484484
it('reject: trigger then close editor', async function () {
485485
assertSessionClean()
486-
const editor = await openATextEditorWithText('', 'test.py')
486+
const editor = await toTextEditor('', 'test.py')
487487

488488
await manualTrigger(editor, client, config)
489489
await closeActiveEditor()
@@ -496,7 +496,7 @@ describe.skip('CodeWhisperer telemetry', async function () {
496496

497497
it('reject: onFocusChange', async function () {
498498
assertSessionClean()
499-
const editor = await openATextEditorWithText('', 'test.py')
499+
const editor = await toTextEditor('', 'test.py')
500500

501501
await manualTrigger(editor, client, config)
502502
await assertTextEditorContains('')

packages/amazonq/test/unit/codewhisperer/tracker/lineTracker.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import { LineSelection, LineTracker, AuthUtil } from 'aws-core-vscode/codewhisperer'
77
import sinon from 'sinon'
88
import { Disposable, TextEditor, Position, Range, Selection } from 'vscode'
9-
import { openATextEditorWithText } from 'aws-core-vscode/test'
9+
import { toTextEditor } from 'aws-core-vscode/test'
1010
import assert from 'assert'
1111
import { waitUntil } from 'aws-core-vscode/shared'
1212

@@ -82,7 +82,7 @@ describe('LineTracker class', function () {
8282
describe('includes', function () {
8383
// util function to help set up LineTracker.selections
8484
async function setEditorSelection(selections: LineSelection[]): Promise<TextEditor> {
85-
const editor = await openATextEditorWithText('\n\n\n\n\n\n\n\n\n\n', 'foo.py', undefined, {
85+
const editor = await toTextEditor('\n\n\n\n\n\n\n\n\n\n', 'foo.py', undefined, {
8686
preview: false,
8787
})
8888

@@ -200,7 +200,7 @@ describe('LineTracker class', function () {
200200

201201
describe('onContentChanged', function () {
202202
it('should fire lineChangedEvent and set current line selection', async function () {
203-
editor = await openATextEditorWithText('\n\n\n\n\n', 'foo.py', undefined, { preview: false })
203+
editor = await toTextEditor('\n\n\n\n\n', 'foo.py', undefined, { preview: false })
204204
editor.selection = new Selection(new Position(5, 0), new Position(5, 0))
205205
assertEmptyCounts()
206206

@@ -222,7 +222,7 @@ describe('LineTracker class', function () {
222222

223223
describe('onTextEditorSelectionChanged', function () {
224224
it('should fire lineChangedEvent if selection changes and set current line selection', async function () {
225-
editor = await openATextEditorWithText('\n\n\n\n\n', 'foo.py', undefined, { preview: false })
225+
editor = await toTextEditor('\n\n\n\n\n', 'foo.py', undefined, { preview: false })
226226
editor.selection = new Selection(new Position(3, 0), new Position(3, 0))
227227
assertEmptyCounts()
228228

@@ -259,7 +259,7 @@ describe('LineTracker class', function () {
259259
it('should not fire lineChangedEvent if uri scheme is debug || output', async function () {
260260
// if the editor is not a text editor, won't emit an event and selection will be set to undefined
261261
async function assertLineChanged(schema: string) {
262-
const anotherEditor = await openATextEditorWithText('', 'bar.log', undefined, { preview: false })
262+
const anotherEditor = await toTextEditor('', 'bar.log', undefined, { preview: false })
263263
const uri = anotherEditor.document.uri
264264
sandbox.stub(uri, 'scheme').get(() => schema)
265265

0 commit comments

Comments
 (0)