Skip to content

Commit 2736861

Browse files
committed
Merge remote-tracking branch 'upstream/master' into crossfile-config
2 parents 9a7e50a + 089c230 commit 2736861

File tree

66 files changed

+589
-435
lines changed

Some content is hidden

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

66 files changed

+589
-435
lines changed
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": "Q dev handle no change required"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Deprecation",
3+
"description": "The next release of this extension will require VS Code 1.83.0 or newer."
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": "Show a one-time warning if new VS Code is required"
4+
}

packages/amazonq/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112
"type": "boolean",
113113
"default": false
114114
},
115+
"minIdeVersion": {
116+
"type": "boolean",
117+
"default": false
118+
},
115119
"ssoCacheError": {
116120
"type": "boolean",
117121
"default": false
@@ -1046,6 +1050,6 @@
10461050
},
10471051
"engines": {
10481052
"npm": "^10.1.0",
1049-
"vscode": "^1.83.0"
1053+
"vscode": "^1.68.0"
10501054
}
10511055
}

packages/amazonq/src/extension.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
placeholder,
4141
setContext,
4242
setupUninstallHandler,
43+
maybeShowMinVscodeWarning,
4344
} from 'aws-core-vscode/shared'
4445
import { ExtStartUpSources, telemetry } from 'aws-core-vscode/telemetry'
4546
import { VSCODE_EXTENSION_ID } from 'aws-core-vscode/utils'
@@ -98,6 +99,8 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
9899
}
99100
}
100101

102+
void maybeShowMinVscodeWarning('1.83.0')
103+
101104
globals.machineId = await getMachineId()
102105
globals.awsContext = new DefaultAwsContext()
103106
globals.sdkClientBuilder = new DefaultAWSClientBuilder(globals.awsContext)

packages/amazonq/test/unit/codewhisperer/commands/onAcceptance.test.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@ import * as vscode from 'vscode'
88
import * as sinon from 'sinon'
99
import {
1010
onAcceptance,
11-
UserGroup,
1211
AcceptedSuggestionEntry,
1312
session,
1413
CodeWhispererTracker,
1514
RecommendationHandler,
16-
CodeWhispererUserGroupSettings,
1715
AuthUtil,
1816
} from 'aws-core-vscode/codewhisperer'
1917
import { resetCodeWhispererGlobalVariables, createMockTextEditor } from 'aws-core-vscode/test'
2018
import { assertTelemetryCurried } from 'aws-core-vscode/test'
21-
import { globals } from 'aws-core-vscode/shared'
22-
import { extensionVersion } from 'aws-core-vscode/shared'
2319

2420
describe('onAcceptance', function () {
2521
describe('onAcceptance', function () {
@@ -31,7 +27,6 @@ describe('onAcceptance', function () {
3127
afterEach(function () {
3228
sinon.restore()
3329
session.reset()
34-
CodeWhispererUserGroupSettings.instance.reset()
3530
})
3631

3732
it('Should enqueue an event object to tracker', async function () {
@@ -75,11 +70,6 @@ describe('onAcceptance', function () {
7570
})
7671

7772
it('Should report telemetry that records this user decision event', async function () {
78-
await globals.globalState.update('CODEWHISPERER_USER_GROUP', {
79-
group: UserGroup.Control,
80-
version: extensionVersion,
81-
})
82-
8373
const testStartUrl = 'testStartUrl'
8474
sinon.stub(AuthUtil.instance, 'startUrl').value(testStartUrl)
8575
const mockEditor = createMockTextEditor()
@@ -117,7 +107,6 @@ describe('onAcceptance', function () {
117107
codewhispererCompletionType: 'Line',
118108
codewhispererLanguage: 'python',
119109
credentialStartUrl: testStartUrl,
120-
codewhispererUserGroup: 'Control',
121110
})
122111
})
123112
})

packages/amazonq/test/unit/codewhisperer/commands/onInlineAcceptance.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,7 @@ import * as vscode from 'vscode'
88
import * as sinon from 'sinon'
99
import { resetCodeWhispererGlobalVariables, createMockTextEditor } from 'aws-core-vscode/test'
1010
import { assertTelemetryCurried } from 'aws-core-vscode/test'
11-
import {
12-
onInlineAcceptance,
13-
RecommendationHandler,
14-
AuthUtil,
15-
session,
16-
CodeWhispererUserGroupSettings,
17-
UserGroup,
18-
} from 'aws-core-vscode/codewhisperer'
11+
import { onInlineAcceptance, RecommendationHandler, AuthUtil, session } from 'aws-core-vscode/codewhisperer'
1912
import { globals } from 'aws-core-vscode/shared'
2013
import { extensionVersion } from 'aws-core-vscode/shared'
2114

@@ -29,7 +22,6 @@ describe('onInlineAcceptance', function () {
2922
afterEach(function () {
3023
sinon.restore()
3124
session.reset()
32-
CodeWhispererUserGroupSettings.instance.reset()
3325
})
3426

3527
it('Should dispose inline completion provider', async function () {
@@ -53,7 +45,6 @@ describe('onInlineAcceptance', function () {
5345

5446
it('Should report telemetry that records this user decision event', async function () {
5547
await globals.globalState.update('CODEWHISPERER_USER_GROUP', {
56-
group: UserGroup.Classifier,
5748
version: extensionVersion,
5849
})
5950

@@ -95,7 +86,6 @@ describe('onInlineAcceptance', function () {
9586
codewhispererCompletionType: 'Line',
9687
codewhispererLanguage: 'python',
9788
credentialStartUrl: testStartUrl,
98-
codewhispererUserGroup: 'Classifier',
9989
})
10090
})
10191
})

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ import {
1313
resetCodeWhispererGlobalVariables,
1414
} from 'aws-core-vscode/test'
1515
import * as EditorContext from 'aws-core-vscode/codewhisperer'
16-
import * as CodeWhispererConstants from 'aws-core-vscode/codewhisperer'
1716
import {
1817
ConfigurationEntry,
1918
DocumentChangedSource,
2019
KeyStrokeHandler,
2120
DefaultDocumentChangedType,
2221
RecommendationService,
23-
CodeWhispererUserGroupSettings,
2422
ClassifierTrigger,
2523
isInlineCompletionEnabled,
2624
RecommendationHandler,
@@ -52,7 +50,6 @@ describe('keyStrokeHandler', function () {
5250
})
5351
afterEach(function () {
5452
sinon.restore()
55-
CodeWhispererUserGroupSettings.instance.reset()
5653
})
5754

5855
it('Whatever the input is, should skip when automatic trigger is turned off, should not call invokeAutomatedTrigger', async function () {
@@ -145,19 +142,13 @@ describe('keyStrokeHandler', function () {
145142
}
146143
})
147144

148-
async function testShouldInvoke(
149-
input: string,
150-
shouldTrigger: boolean,
151-
rightContext: string = '',
152-
userGroup: CodeWhispererConstants.UserGroup = CodeWhispererConstants.UserGroup.Control
153-
) {
145+
async function testShouldInvoke(input: string, shouldTrigger: boolean, rightContext: string = '') {
154146
const mockEditor = createMockTextEditor(rightContext, 'test.js', 'javascript', 0, 0)
155147
const mockEvent: vscode.TextDocumentChangeEvent = createTextDocumentChangeEvent(
156148
mockEditor.document,
157149
new vscode.Range(new vscode.Position(0, 0), new vscode.Position(0, 1)),
158150
input
159151
)
160-
CodeWhispererUserGroupSettings.instance.userGroup = userGroup
161152
await KeyStrokeHandler.instance.processKeyStroke(mockEvent, mockEditor, mockClient, config)
162153
assert.strictEqual(
163154
invokeSpy.called,

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ import {
1010
ReferenceInlineProvider,
1111
session,
1212
AuthUtil,
13-
CodeWhispererUserGroupSettings,
1413
DefaultCodeWhispererClient,
1514
RecommendationsList,
1615
ConfigurationEntry,
1716
RecommendationHandler,
1817
CodeWhispererCodeCoverageTracker,
19-
UserGroup,
2018
supplementalContextUtil,
2119
} from 'aws-core-vscode/codewhisperer'
2220
import {
@@ -26,7 +24,6 @@ import {
2624
resetCodeWhispererGlobalVariables,
2725
} from 'aws-core-vscode/test'
2826
// import * as supplementalContextUtil from 'aws-core-vscode/codewhisperer'
29-
import { globals, extensionVersion } from 'aws-core-vscode/shared'
3027

3128
describe('recommendationHandler', function () {
3229
const config: ConfigurationEntry = {
@@ -55,7 +52,6 @@ describe('recommendationHandler', function () {
5552

5653
afterEach(function () {
5754
sinon.restore()
58-
CodeWhispererUserGroupSettings.instance.reset()
5955
})
6056

6157
it('should assign correct recommendations given input', async function () {
@@ -110,11 +106,6 @@ describe('recommendationHandler', function () {
110106
})
111107

112108
it('should call telemetry function that records a CodeWhisperer service invocation', async function () {
113-
await globals.globalState.update('CODEWHISPERER_USER_GROUP', {
114-
group: UserGroup.CrossFile,
115-
version: extensionVersion,
116-
})
117-
118109
const mockServerResult = {
119110
recommendations: [{ content: "print('Hello World!')" }, { content: '' }],
120111
$response: {
@@ -157,16 +148,10 @@ describe('recommendationHandler', function () {
157148
codewhispererSupplementalContextTimeout: false,
158149
codewhispererSupplementalContextLatency: 0,
159150
codewhispererSupplementalContextLength: 100,
160-
codewhispererUserGroup: 'CrossFile',
161151
})
162152
})
163153

164154
it('should call telemetry function that records a Empty userDecision event', async function () {
165-
await globals.globalState.update('CODEWHISPERER_USER_GROUP', {
166-
group: UserGroup.CrossFile,
167-
version: extensionVersion,
168-
})
169-
170155
const mockServerResult = {
171156
recommendations: [],
172157
nextToken: '',
@@ -198,7 +183,6 @@ describe('recommendationHandler', function () {
198183
codewhispererCompletionType: 'Line',
199184
codewhispererLanguage: 'python',
200185
credentialStartUrl: testStartUrl,
201-
codewhispererUserGroup: 'CrossFile',
202186
})
203187
})
204188
})

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ describe.skip('CodeWhisperer telemetry', async function () {
5353
codewhispererSuggestionState: 'Accept',
5454
codewhispererSuggestionImportCount: 0,
5555
codewhispererTypeaheadLength: 0,
56-
codewhispererUserGroup: 'Control',
5756
...ops,
5857
}
5958
}

0 commit comments

Comments
 (0)