Skip to content

Commit b17b3fa

Browse files
authored
Merge pull request #6437 from aws/autoMerge/feature/amazonqLSP
Merge master into feature/amazonqLSP
2 parents 7488e0a + de684e0 commit b17b3fa

File tree

9 files changed

+107
-52
lines changed

9 files changed

+107
-52
lines changed

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- run: npm run testCompile
5858
- run: npm run lint
5959

60-
jscpd:
60+
lint-duplicate-code:
6161
needs: lint-commits
6262
if: ${{ github.event_name == 'pull_request'}}
6363
runs-on: ubuntu-latest
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 0.2
2+
3+
phases:
4+
install:
5+
runtime-versions:
6+
nodejs: 16
7+
8+
commands:
9+
- apt update
10+
- apt install -y wget gpg
11+
- curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
12+
- install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
13+
- sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'
14+
- apt update
15+
- apt install -y code
16+
17+
pre_build:
18+
commands:
19+
# Check for implicit env vars passed from the release pipeline.
20+
- test -n "${TARGET_EXTENSION}"
21+
22+
build:
23+
commands:
24+
- VERSION=$(node -e "console.log(require('./packages/${TARGET_EXTENSION}/package.json').version);")
25+
# get extension name
26+
- |
27+
if [ "${TARGET_EXTENSION}" = "amazonq" ]; then
28+
extension_name="amazonwebservices.amazon-q-vscode"
29+
elif [ "${TARGET_EXTENSION}" = "toolkit" ]; then
30+
extension_name="amazonwebservices.aws-toolkit-vscode"
31+
else
32+
echo checkmarketplace: "Unknown TARGET_EXTENSION: ${TARGET_EXTENSION}"
33+
exit 1
34+
fi
35+
# keep reinstalling the extension until the desired version is updated. Otherwise fail on codebuild timeout (1 hour).
36+
- |
37+
while true; do
38+
code --uninstall-extension "${extension_name}" --no-sandbox --user-data-dir /tmp/vscode
39+
code --install-extension ${extension_name} --no-sandbox --user-data-dir /tmp/vscode
40+
cur_version=$(code --list-extensions --show-versions --no-sandbox --user-data-dir /tmp/vscode | grep ${extension_name} | cut -d'@' -f2)
41+
if [ "${cur_version}" = "${VERSION}" ]; then
42+
echo "checkmarketplace: Extension ${extension_name} is updated to version '${cur_version}.'"
43+
break
44+
else
45+
echo "checkmarketplace: Current version '${cur_version}' does not match expected version '${VERSION}'. Retrying..."
46+
fi
47+
sleep 120 # Wait for 2 minutes before retrying
48+
done

packages/core/package.nls.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"AWS.configuration.description.suppressPrompts": "Prompts which ask for confirmation. Checking an item suppresses the prompt.",
2121
"AWS.configuration.enableCodeLenses": "Enable SAM hints in source code and template.yaml files",
2222
"AWS.configuration.description.resources.enabledResources": "AWS resources to display in the 'Resources' portion of the explorer.",
23-
"AWS.configuration.description.experiments": "Try experimental features and give feedback. Note that experimental features may be removed at any time.\n * `jsonResourceModification` - Enables basic create, update, and delete support for cloud resources via the JSON Resources explorer component.\n * `ec2RemoteConnect` - Allows interfacing with EC2 instances with options to start, stop, and establish remote connections. Remote connections are done over SSM and can be through a terminal or a remote VSCode window.",
23+
"AWS.configuration.description.experiments": "Try experimental features and give feedback. Note that experimental features may be removed at any time.\n * `jsonResourceModification` - Enables basic create, update, and delete support for cloud resources via the JSON Resources explorer component.",
2424
"AWS.stepFunctions.asl.format.enable.desc": "Enables the default formatter used with Amazon States Language files",
2525
"AWS.stepFunctions.asl.maxItemsComputed.desc": "The maximum number of outline symbols and folding regions computed (limited for performance reasons).",
2626
"AWS.configuration.description.awssam.debug.api": "API Gateway configuration",
@@ -295,6 +295,7 @@
295295
"AWS.codewhisperer.customization.notification.new_customizations.learn_more": "Learn More",
296296
"AWS.amazonq.title": "Amazon Q",
297297
"AWS.amazonq.chat": "Chat",
298+
"AWS.amazonq.chat.workspacecontext.enable.message": "Amazon Q: Workspace index is now enabled. You can disable it from Amazon Q settings.",
298299
"AWS.amazonq.security": "Code Issues",
299300
"AWS.amazonq.login": "Login",
300301
"AWS.amazonq.learnMore": "Learn More About Amazon Q",
@@ -404,6 +405,7 @@
404405
"AWS.amazonq.doc.pillText.reject": "Reject",
405406
"AWS.amazonq.doc.pillText.makeChanges": "Make changes",
406407
"AWS.amazonq.inline.invokeChat": "Inline chat",
408+
"AWS.amazonq.opensettings:": "Open settings",
407409
"AWS.toolkit.lambda.walkthrough.quickpickTitle": "Application Builder Walkthrough",
408410
"AWS.toolkit.lambda.walkthrough.title": "Get started building your application",
409411
"AWS.toolkit.lambda.walkthrough.description": "Your quick guide to build an application visually, iterate locally, and deploy to the cloud!",

packages/core/src/awsexplorer/regionNode.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { getEcsRootNode } from '../awsService/ecs/model'
3030
import { compareTreeItems, TreeShim } from '../shared/treeview/utils'
3131
import { Ec2ParentNode } from '../awsService/ec2/explorer/ec2ParentNode'
3232
import { Ec2Client } from '../shared/clients/ec2Client'
33-
import { Experiments } from '../shared/settings'
3433

3534
interface ServiceNode {
3635
allRegions?: boolean
@@ -64,7 +63,6 @@ const serviceCandidates: ServiceNode[] = [
6463
},
6564
{
6665
serviceId: 'ec2',
67-
when: () => Experiments.instance.isExperimentEnabled('ec2RemoteConnect'),
6866
createFn: (regionCode: string, partitionId: string) =>
6967
new Ec2ParentNode(regionCode, partitionId, new Ec2Client(regionCode)),
7068
},

packages/core/src/shared/clients/s3Client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ export class DefaultS3Client {
465465
* Set '' as the default prefix to ensure that the bucket's content will be displayed
466466
* when the user has at least list access to the root of the bucket.
467467
* https://github.com/aws/aws-toolkit-vscode/issues/4643
468-
* @default ''
468+
* @default ''
469469
*/
470470
Prefix: request.folderPath ?? defaultPrefix,
471471
ContinuationToken: request.continuationToken,

packages/core/src/shared/featureConfig.ts

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ListFeatureEvaluationsResponse,
1111
} from '../codewhisperer/client/codewhispereruserclient'
1212
import * as vscode from 'vscode'
13+
import * as nls from 'vscode-nls'
1314
import { codeWhispererClient as client } from '../codewhisperer/client/codewhisperer'
1415
import { AuthUtil } from '../codewhisperer/util/authUtil'
1516
import { getLogger } from './logger'
@@ -19,7 +20,9 @@ import globals from './extensionGlobals'
1920
import { getClientId, getOperatingSystem } from './telemetry/util'
2021
import { extensionVersion } from './vscode/env'
2122
import { telemetry } from './telemetry'
22-
import { Auth } from '../auth'
23+
import { Commands } from './vscode/commands2'
24+
25+
const localize = nls.loadMessageBundle()
2326

2427
export class FeatureContext {
2528
constructor(
@@ -35,6 +38,7 @@ export const Features = {
3538
customizationArnOverride: 'customizationArnOverride',
3639
dataCollectionFeature: 'IDEProjectContextDataCollection',
3740
projectContextFeature: 'ProjectContextV2',
41+
workspaceContextFeature: 'WorkspaceContext',
3842
test: 'testFeature',
3943
} as const
4044

@@ -83,6 +87,21 @@ export class FeatureConfigProvider {
8387
}
8488
}
8589

90+
getWorkspaceContextGroup(): 'control' | 'treatment' {
91+
const variation = this.featureConfigs.get(Features.projectContextFeature)?.variation
92+
93+
switch (variation) {
94+
case 'CONTROL':
95+
return 'control'
96+
97+
case 'TREATMENT':
98+
return 'treatment'
99+
100+
default:
101+
return 'control'
102+
}
103+
}
104+
86105
public async listFeatureEvaluations(): Promise<ListFeatureEvaluationsResponse> {
87106
const request: ListFeatureEvaluationsRequest = {
88107
userContext: {
@@ -154,12 +173,26 @@ export class FeatureConfigProvider {
154173
await vscode.commands.executeCommand('aws.amazonq.refreshStatusBar')
155174
}
156175
}
157-
if (Auth.instance.isInternalAmazonUser()) {
176+
if (this.getWorkspaceContextGroup() === 'treatment') {
158177
// Enable local workspace index by default only once, for Amzn users.
159178
const isSet = globals.globalState.get<boolean>('aws.amazonq.workspaceIndexToggleOn') || false
160179
if (!isSet) {
161180
await CodeWhispererSettings.instance.enableLocalIndex()
162181
globals.globalState.tryUpdate('aws.amazonq.workspaceIndexToggleOn', true)
182+
183+
await vscode.window
184+
.showInformationMessage(
185+
localize(
186+
'AWS.amazonq.chat.workspacecontext.enable.message',
187+
'Amazon Q: Workspace index is now enabled. You can disable it from Amazon Q settings.'
188+
),
189+
localize('AWS.amazonq.opensettings', 'Open settings')
190+
)
191+
.then((r) => {
192+
if (r === 'Open settings') {
193+
void Commands.tryExecute('aws.amazonq.configure').then()
194+
}
195+
})
163196
}
164197
}
165198
} catch (e) {

packages/core/src/shared/settings-toolkit.gen.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export const toolkitSettings = {
4242
},
4343
"aws.experiments": {
4444
"jsonResourceModification": {},
45-
"amazonqLSP": {},
46-
"ec2RemoteConnect": {}
45+
"amazonqLSP": {}
4746
},
4847
"aws.resources.enabledResources": {},
4948
"aws.lambda.recentlyUploaded": {},
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "EC2 is now available in AWS Explorer:\n\n1. Remote-connect VSCode to your EC2 instances.\n2. Open terminal to your EC2 instances.\n3. Start, stop, and visit the Launch page."
4+
}

packages/toolkit/package.json

Lines changed: 14 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,7 @@
240240
"type": "object",
241241
"markdownDescription": "%AWS.configuration.description.experiments%",
242242
"default": {
243-
"jsonResourceModification": false,
244-
"ec2RemoteConnect": false
243+
"jsonResourceModification": false
245244
},
246245
"properties": {
247246
"jsonResourceModification": {
@@ -251,10 +250,6 @@
251250
"amazonqLSP": {
252251
"type": "boolean",
253252
"default": false
254-
},
255-
"ec2RemoteConnect": {
256-
"type": "boolean",
257-
"default": false
258253
}
259254
},
260255
"additionalProperties": false
@@ -1210,30 +1205,6 @@
12101205
{
12111206
"command": "aws.toolkit.auth.manageConnections"
12121207
},
1213-
{
1214-
"command": "aws.ec2.openRemoteConnection",
1215-
"when": "config.aws.experiments.ec2RemoteConnect"
1216-
},
1217-
{
1218-
"command": "aws.ec2.openTerminal",
1219-
"when": "config.aws.experiments.ec2RemoteConnect"
1220-
},
1221-
{
1222-
"command": "aws.ec2.linkToLaunch",
1223-
"when": "config.aws.experiments.ec2RemoteConnect"
1224-
},
1225-
{
1226-
"command": "aws.ec2.startInstance",
1227-
"when": "config.aws.experiments.ec2RemoteConnect"
1228-
},
1229-
{
1230-
"command": "aws.ec2.stopInstance",
1231-
"when": "config.aws.experiments.ec2RemoteConnect"
1232-
},
1233-
{
1234-
"command": "aws.ec2.rebootInstance",
1235-
"when": "config.aws.experiments.ec2RemoteConnect"
1236-
},
12371208
{
12381209
"command": "aws.dev.openMenu",
12391210
"when": "aws.isDevMode || isCloud9"
@@ -1457,66 +1428,66 @@
14571428
{
14581429
"command": "aws.ec2.openTerminal",
14591430
"group": "0@1",
1460-
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/ && config.aws.experiments.ec2RemoteConnect"
1431+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
14611432
},
14621433
{
14631434
"command": "aws.ec2.openTerminal",
14641435
"group": "inline@1",
1465-
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/ && config.aws.experiments.ec2RemoteConnect"
1436+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
14661437
},
14671438
{
14681439
"command": "aws.ec2.linkToLaunch",
14691440
"group": "0@0",
1470-
"when": "viewItem =~ /^(awsEc2ParentNode)$/ && config.aws.experiments.ec2RemoteConnect"
1441+
"when": "viewItem =~ /^(awsEc2ParentNode)$/"
14711442
},
14721443
{
14731444
"command": "aws.ec2.linkToLaunch",
14741445
"group": "inline@0",
1475-
"when": "viewItem =~ /^(awsEc2ParentNode)$/ && config.aws.experiments.ec2RemoteConnect"
1446+
"when": "viewItem =~ /^(awsEc2ParentNode)$/"
14761447
},
14771448
{
14781449
"command": "aws.ec2.openRemoteConnection",
14791450
"group": "0@1",
1480-
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/ && config.aws.experiments.ec2RemoteConnect"
1451+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
14811452
},
14821453
{
14831454
"command": "aws.ec2.openRemoteConnection",
14841455
"group": "inline@1",
1485-
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/ && config.aws.experiments.ec2RemoteConnect"
1456+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
14861457
},
14871458
{
14881459
"command": "aws.ec2.startInstance",
14891460
"group": "0@1",
1490-
"when": "viewItem == awsEc2StoppedNode && config.aws.experiments.ec2RemoteConnect"
1461+
"when": "viewItem == awsEc2StoppedNode"
14911462
},
14921463
{
14931464
"command": "aws.ec2.startInstance",
14941465
"group": "inline@1",
1495-
"when": "viewItem == awsEc2StoppedNode && config.aws.experiments.ec2RemoteConnect"
1466+
"when": "viewItem == awsEc2StoppedNode"
14961467
},
14971468
{
14981469
"command": "aws.ec2.stopInstance",
14991470
"group": "0@1",
1500-
"when": "viewItem == awsEc2RunningNode && config.aws.experiments.ec2RemoteConnect"
1471+
"when": "viewItem == awsEc2RunningNode"
15011472
},
15021473
{
15031474
"command": "aws.ec2.stopInstance",
15041475
"group": "inline@1",
1505-
"when": "viewItem == awsEc2RunningNode && config.aws.experiments.ec2RemoteConnect"
1476+
"when": "viewItem == awsEc2RunningNode"
15061477
},
15071478
{
15081479
"command": "aws.ec2.rebootInstance",
15091480
"group": "0@1",
1510-
"when": "viewItem == awsEc2RunningNode && config.aws.experiments.ec2RemoteConnect"
1481+
"when": "viewItem == awsEc2RunningNode"
15111482
},
15121483
{
15131484
"command": "aws.ec2.rebootInstance",
15141485
"group": "inline@1",
1515-
"when": "viewItem == awsEc2RunningNode && config.aws.experiments.ec2RemoteConnect"
1486+
"when": "viewItem == awsEc2RunningNode"
15161487
},
15171488
{
15181489
"command": "aws.ec2.copyInstanceId",
1519-
"when": "view == aws.explorer && viewItem =~ /^(awsEc2(Running|Stopped|Pending)Node)$/ && config.aws.experiments.ec2RemoteConnect",
1490+
"when": "view == aws.explorer && viewItem =~ /^(awsEc2(Running|Stopped|Pending)Node)$/",
15201491
"group": "2@0"
15211492
},
15221493
{

0 commit comments

Comments
 (0)