Skip to content

Commit f6cdb18

Browse files
committed
refactor the code base
1 parent ba8fda7 commit f6cdb18

22 files changed

+847
-736
lines changed

aws-toolkit-vscode.code-workspace

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
{
1313
"path": "packages/amazonq",
1414
},
15+
{
16+
"path": "../language-servers",
17+
},
1518
],
1619
"settings": {
1720
"typescript.tsdk": "node_modules/typescript/lib",

packages/amazonq/package.json

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,110 +1227,138 @@
12271227
"fontCharacter": "\\f1d0"
12281228
}
12291229
},
1230-
"aws-lambda-function": {
1230+
"aws-lambda-create-stack": {
12311231
"description": "AWS Contributed Icon",
12321232
"default": {
12331233
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12341234
"fontCharacter": "\\f1d1"
12351235
}
12361236
},
1237-
"aws-mynah-MynahIconBlack": {
1237+
"aws-lambda-create-stack-light": {
12381238
"description": "AWS Contributed Icon",
12391239
"default": {
12401240
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12411241
"fontCharacter": "\\f1d2"
12421242
}
12431243
},
1244-
"aws-mynah-MynahIconWhite": {
1244+
"aws-lambda-function": {
12451245
"description": "AWS Contributed Icon",
12461246
"default": {
12471247
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12481248
"fontCharacter": "\\f1d3"
12491249
}
12501250
},
1251-
"aws-mynah-logo": {
1251+
"aws-mynah-MynahIconBlack": {
12521252
"description": "AWS Contributed Icon",
12531253
"default": {
12541254
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12551255
"fontCharacter": "\\f1d4"
12561256
}
12571257
},
1258-
"aws-redshift-cluster": {
1258+
"aws-mynah-MynahIconWhite": {
12591259
"description": "AWS Contributed Icon",
12601260
"default": {
12611261
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12621262
"fontCharacter": "\\f1d5"
12631263
}
12641264
},
1265-
"aws-redshift-cluster-connected": {
1265+
"aws-mynah-logo": {
12661266
"description": "AWS Contributed Icon",
12671267
"default": {
12681268
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12691269
"fontCharacter": "\\f1d6"
12701270
}
12711271
},
1272-
"aws-redshift-database": {
1272+
"aws-redshift-cluster": {
12731273
"description": "AWS Contributed Icon",
12741274
"default": {
12751275
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12761276
"fontCharacter": "\\f1d7"
12771277
}
12781278
},
1279-
"aws-redshift-redshift-cluster-connected": {
1279+
"aws-redshift-cluster-connected": {
12801280
"description": "AWS Contributed Icon",
12811281
"default": {
12821282
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12831283
"fontCharacter": "\\f1d8"
12841284
}
12851285
},
1286-
"aws-redshift-schema": {
1286+
"aws-redshift-database": {
12871287
"description": "AWS Contributed Icon",
12881288
"default": {
12891289
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12901290
"fontCharacter": "\\f1d9"
12911291
}
12921292
},
1293-
"aws-redshift-table": {
1293+
"aws-redshift-redshift-cluster-connected": {
12941294
"description": "AWS Contributed Icon",
12951295
"default": {
12961296
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
12971297
"fontCharacter": "\\f1da"
12981298
}
12991299
},
1300-
"aws-s3-bucket": {
1300+
"aws-redshift-schema": {
13011301
"description": "AWS Contributed Icon",
13021302
"default": {
13031303
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13041304
"fontCharacter": "\\f1db"
13051305
}
13061306
},
1307-
"aws-s3-create-bucket": {
1307+
"aws-redshift-table": {
13081308
"description": "AWS Contributed Icon",
13091309
"default": {
13101310
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13111311
"fontCharacter": "\\f1dc"
13121312
}
13131313
},
1314-
"aws-schemas-registry": {
1314+
"aws-s3-bucket": {
13151315
"description": "AWS Contributed Icon",
13161316
"default": {
13171317
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13181318
"fontCharacter": "\\f1dd"
13191319
}
13201320
},
1321-
"aws-schemas-schema": {
1321+
"aws-s3-create-bucket": {
13221322
"description": "AWS Contributed Icon",
13231323
"default": {
13241324
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13251325
"fontCharacter": "\\f1de"
13261326
}
13271327
},
1328-
"aws-stepfunctions-preview": {
1328+
"aws-sagemaker-code-editor": {
13291329
"description": "AWS Contributed Icon",
13301330
"default": {
13311331
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
13321332
"fontCharacter": "\\f1df"
13331333
}
1334+
},
1335+
"aws-sagemaker-jupyter-lab": {
1336+
"description": "AWS Contributed Icon",
1337+
"default": {
1338+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
1339+
"fontCharacter": "\\f1e0"
1340+
}
1341+
},
1342+
"aws-schemas-registry": {
1343+
"description": "AWS Contributed Icon",
1344+
"default": {
1345+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
1346+
"fontCharacter": "\\f1e1"
1347+
}
1348+
},
1349+
"aws-schemas-schema": {
1350+
"description": "AWS Contributed Icon",
1351+
"default": {
1352+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
1353+
"fontCharacter": "\\f1e2"
1354+
}
1355+
},
1356+
"aws-stepfunctions-preview": {
1357+
"description": "AWS Contributed Icon",
1358+
"default": {
1359+
"fontPath": "./resources/fonts/aws-toolkit-icons.woff",
1360+
"fontCharacter": "\\f1e3"
1361+
}
13341362
}
13351363
},
13361364
"walkthroughs": [
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import * as vscode from 'vscode'
7+
import { getLogger } from 'aws-core-vscode/shared'
8+
import { AutoDebugCommands } from './commands'
9+
import { AutoDebugCodeActionsProvider } from './codeActionsProvider'
10+
import { AutoDebugController } from './controller'
11+
12+
/**
13+
* Auto Debug feature activation for Amazon Q
14+
* This handles the complete lifecycle of the auto debug feature
15+
*/
16+
export class AutoDebugFeature implements vscode.Disposable {
17+
private readonly logger = getLogger()
18+
private readonly disposables: vscode.Disposable[] = []
19+
20+
private autoDebugCommands?: AutoDebugCommands
21+
private codeActionsProvider?: AutoDebugCodeActionsProvider
22+
private controller?: AutoDebugController
23+
24+
constructor(private readonly context: vscode.ExtensionContext) {}
25+
26+
/**
27+
* Activate the auto debug feature
28+
*/
29+
async activate(): Promise<void> {
30+
try {
31+
this.logger.info('AutoDebugFeature: Activating auto debug feature')
32+
33+
// Initialize the controller first
34+
this.controller = new AutoDebugController()
35+
await this.controller.initialize()
36+
37+
// Initialize commands and pass the controller
38+
this.autoDebugCommands = new AutoDebugCommands(this.controller)
39+
this.autoDebugCommands.registerCommands(this.context)
40+
41+
// Initialize code actions provider
42+
this.codeActionsProvider = new AutoDebugCodeActionsProvider()
43+
this.context.subscriptions.push(this.codeActionsProvider)
44+
45+
// Add all to disposables
46+
this.disposables.push(this.controller, this.autoDebugCommands, this.codeActionsProvider)
47+
48+
this.logger.info('AutoDebugFeature: Auto debug feature activated successfully')
49+
} catch (error) {
50+
this.logger.error('AutoDebugFeature: Failed to activate auto debug feature: %s', error)
51+
throw error
52+
}
53+
}
54+
55+
/**
56+
* Get the auto debug controller instance
57+
*/
58+
getController(): AutoDebugController | undefined {
59+
return this.controller
60+
}
61+
62+
/**
63+
* Dispose of all resources
64+
*/
65+
dispose(): void {
66+
this.logger.debug('AutoDebugFeature: Disposing auto debug feature')
67+
vscode.Disposable.from(...this.disposables).dispose()
68+
}
69+
}
70+
71+
/**
72+
* Factory function to activate auto debug feature
73+
* This is the main entry point for activating auto debug
74+
*/
75+
export async function activateAutoDebug(context: vscode.ExtensionContext): Promise<AutoDebugFeature> {
76+
const feature = new AutoDebugFeature(context)
77+
await feature.activate()
78+
return feature
79+
}

packages/core/src/amazonq/autoDebug/ide/codeActionsProvider.ts renamed to packages/amazonq/src/autoDebug/codeActionsProvider.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
*/
55

66
import * as vscode from 'vscode'
7-
import { getLogger } from '../../../shared/logger/logger'
7+
import { getLogger } from 'aws-core-vscode/shared'
88

99
/**
1010
* Provides code actions for Amazon Q Auto Debug features.
1111
* Integrates with VS Code's quick fix system to offer debugging assistance.
1212
*/
1313
export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider, vscode.Disposable {
14-
private readonly logger = getLogger('amazonqLsp')
14+
private readonly logger = getLogger()
1515
private readonly disposables: vscode.Disposable[] = []
1616

1717
public static readonly providedCodeActionKinds = [vscode.CodeActionKind.QuickFix, vscode.CodeActionKind.Refactor]
@@ -21,10 +21,10 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
2121
}
2222

2323
private registerProvider(): void {
24+
this.logger.debug('AutoDebugCodeActionsProvider: Registering code actions provider')
25+
2426
// Register for all file types
25-
const selector: vscode.DocumentSelector = [
26-
{ scheme: 'file' }, // All file types
27-
]
27+
const selector: vscode.DocumentSelector = [{ scheme: 'file' }]
2828

2929
this.disposables.push(
3030
vscode.languages.registerCodeActionsProvider(selector, this, {

0 commit comments

Comments
 (0)