Skip to content

Commit e3adbc9

Browse files
committed
fix type issue
1 parent 1a75593 commit e3adbc9

File tree

7 files changed

+25
-48
lines changed

7 files changed

+25
-48
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/.vscode/launch.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
1414
"env": {
1515
"SSMDOCUMENT_LANGUAGESERVER_PORT": "6010",
16-
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080"
16+
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080",
1717
// Below allows for overrides used during development
18-
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
19-
// "__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
18+
"__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/agent-standalone.js",
19+
"__AMAZONQLSP_UI": "${workspaceFolder}/../../../language-servers/chat-client/build/amazonq-ui.js"
2020
},
2121
"envFile": "${workspaceFolder}/.local.env",
2222
"outFiles": ["${workspaceFolder}/dist/**/*.js", "${workspaceFolder}/../core/dist/**/*.js"],

packages/amazonq/src/lsp/chat/diffAnimation/streamingDiffController.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import * as vscode from 'vscode'
77
import * as path from 'path'
88
import { getLogger } from 'aws-core-vscode/shared'
9+
import { FsWriteParams } from './types'
910

1011
export const diffViewUriScheme = 'amazonq-diff'
1112

@@ -24,16 +25,7 @@ export class StreamingDiffController implements vscode.Disposable {
2425
activeLineController: DecorationController
2526
streamedLines: string[]
2627
disposed: boolean
27-
fsWriteParams?: {
28-
command?: string
29-
insertLine?: number
30-
oldStr?: string
31-
newStr?: string
32-
fileText?: string
33-
explanation?: string
34-
pairIndex?: number
35-
totalPairs?: number
36-
}
28+
fsWriteParams?: FsWriteParams
3729
}
3830
>()
3931

@@ -55,7 +47,7 @@ export class StreamingDiffController implements vscode.Disposable {
5547
vscode.workspace.registerTextDocumentContentProvider(diffViewUriScheme, this.contentProvider)
5648
}
5749

58-
updateFsWriteParams(toolUseId: string, fsWriteParams: any): void {
50+
updateFsWriteParams(toolUseId: string, fsWriteParams: FsWriteParams): void {
5951
const session = this.activeStreamingSessions.get(toolUseId)
6052
if (session) {
6153
session.fsWriteParams = fsWriteParams

packages/amazonq/src/lsp/chat/diffAnimation/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,14 @@ export interface ScanPlan {
5050
preAdded?: boolean
5151
}>
5252
}
53+
54+
export interface FsWriteParams {
55+
command?: string
56+
insertLine?: number
57+
oldStr?: string
58+
newStr?: string
59+
fileText?: string
60+
explanation?: string
61+
pairIndex?: number
62+
totalPairs?: number
63+
}

packages/amazonq/src/lsp/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export async function startLanguageServer(
173173
},
174174
awsClientCapabilities: {
175175
q: {
176-
developerProfiles: true,
176+
developerProfiles: false,
177177
pinnedContextEnabled: true,
178178
imageContextEnabled: true,
179179
mcp: true,

packages/core/src/codewhisperer/region/regionProfileManager.ts

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ import { CachedResource } from '../../shared/utilities/resourceCache'
3333

3434
// TODO: is there a better way to manage all endpoint strings in one place?
3535
export const defaultServiceConfig: CodeWhispererConfig = {
36-
region: 'us-east-1',
37-
endpoint: 'https://codewhisperer.us-east-1.amazonaws.com/',
36+
region: 'us-west-2',
37+
// replace with your own endpoint
38+
endpoint: 'https://rts.alpha-us-west-2.codewhisperer.ai.aws.dev/',
3839
}
3940

4041
// Hack until we have a single discovery endpoint. We will call each endpoint one by one to fetch profile before then.
@@ -95,33 +96,6 @@ export class RegionProfileManager {
9596
}
9697

9798
get clientConfig(): CodeWhispererConfig {
98-
const conn = this.connectionProvider()
99-
if (!conn) {
100-
throw new ToolkitError('trying to get client configuration without credential')
101-
}
102-
103-
// builder id should simply use default IAD
104-
if (isBuilderIdConnection(conn)) {
105-
return defaultServiceConfig
106-
}
107-
108-
// idc
109-
const p = this.activeRegionProfile
110-
if (p) {
111-
const region = p.region
112-
const endpoint = endpoints.get(p.region)
113-
if (endpoint === undefined) {
114-
RegionProfileManager.logger.error(
115-
`Not found endpoint for region ${region}, not able to initialize a codewhisperer client`
116-
)
117-
throw new ToolkitError(`Q client configuration error, endpoint not found for region ${region}`)
118-
}
119-
return {
120-
region: region,
121-
endpoint: endpoint,
122-
}
123-
}
124-
12599
return defaultServiceConfig
126100
}
127101

packages/core/src/codewhisperer/util/authUtil.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,7 @@ export class AuthUtil {
314314
}
315315

316316
requireProfileSelection(): boolean {
317-
if (isBuilderIdConnection(this.conn)) {
318-
return false
319-
}
320-
return isIdcSsoConnection(this.conn) && this.regionProfileManager.activeRegionProfile === undefined
317+
return false
321318
}
322319

323320
private logConnection() {

0 commit comments

Comments
 (0)