Skip to content

Commit 14f2659

Browse files
committed
add settings for workspace context feature
force use lsp add env launch.json add listeners uri to string uri converter
1 parent c7179db commit 14f2659

File tree

11 files changed

+97
-39
lines changed

11 files changed

+97
-39
lines changed

aws-toolkit-vscode.code-workspace

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
{
2-
"folders": [
3-
{
4-
"path": "."
5-
},
6-
{
7-
"path": "packages/toolkit"
8-
},
9-
{
10-
"path": "packages/core"
11-
},
12-
{
13-
"path": "packages/amazonq"
14-
}
15-
],
16-
"settings": {
17-
"typescript.tsdk": "node_modules/typescript/lib"
18-
}
19-
}
2+
"folders": [
3+
{
4+
"path": ".",
5+
},
6+
{
7+
"path": "packages/toolkit",
8+
},
9+
{
10+
"path": "packages/core",
11+
},
12+
{
13+
"path": "packages/amazonq",
14+
},
15+
{
16+
"path": "../language-servers",
17+
},
18+
],
19+
"settings": {
20+
"typescript.tsdk": "node_modules/typescript/lib",
21+
},
22+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/amazonq/.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"env": {
1515
"SSMDOCUMENT_LANGUAGESERVER_PORT": "6010",
1616
"WEBPACK_DEVELOPER_SERVER": "http://localhost:8080"
17-
// "__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js",
17+
//"__AMAZONQLSP_PATH": "${workspaceFolder}/../../../language-servers/app/aws-lsp-codewhisperer-runtimes/out/token-standalone.js"
1818
},
1919
"envFile": "${workspaceFolder}/.local.env",
2020
"outFiles": ["${workspaceFolder}/dist/**/*.js", "${workspaceFolder}/../core/dist/**/*.js"],

packages/amazonq/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amazon-q-vscode",
33
"displayName": "Amazon Q",
44
"description": "The most capable generative AI-powered assistant for building, operating, and transforming software, with advanced capabilities for managing data and AI",
5-
"version": "1.52.0-SNAPSHOT",
5+
"version": "1.52.0-SSPC-GAMMA",
66
"extensionKind": [
77
"workspace"
88
],
@@ -143,6 +143,11 @@
143143
"default": true,
144144
"scope": "application"
145145
},
146+
"amazonQ.workspaceContext": {
147+
"type": "boolean",
148+
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceContext%",
149+
"default": true
150+
},
146151
"amazonQ.workspaceIndex": {
147152
"type": "boolean",
148153
"markdownDescription": "%AWS.configuration.description.amazonq.workspaceIndex%",

packages/amazonq/src/extension.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import * as vscode from 'vscode'
4141
import { registerCommands } from './commands'
4242
import { focusAmazonQPanel } from 'aws-core-vscode/codewhispererChat'
4343
import { activate as activateAmazonqLsp } from './lsp/activation'
44-
import { activate as activateInlineCompletion } from './app/inline/activation'
4544

4645
export const amazonQContextPrefix = 'amazonq'
4746

@@ -118,11 +117,8 @@ export async function activateAmazonQCommon(context: vscode.ExtensionContext, is
118117
}
119118
// This contains every lsp agnostic things (auth, security scan, code scan)
120119
await activateCodeWhisperer(extContext as ExtContext)
121-
if (Experiments.instance.get('amazonqLSP', false)) {
122-
await activateAmazonqLsp(context)
123-
} else {
124-
await activateInlineCompletion()
125-
}
120+
Experiments.instance.get('amazonqLSP', false)
121+
await activateAmazonqLsp(context)
126122

127123
// Generic extension commands
128124
registerGenericCommands(context, amazonQContextPrefix)

packages/amazonq/src/lsp/client.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ import { LanguageClient, LanguageClientOptions } from 'vscode-languageclient'
1010
import { registerInlineCompletion } from '../app/inline/completion'
1111
import { AmazonQLspAuth, encryptionKey, notificationTypes } from './auth'
1212
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
13-
import { ConnectionMetadata } from '@aws/language-server-runtimes/protocol'
13+
import {
14+
ConnectionMetadata,
15+
CreateFilesParams,
16+
DeleteFilesParams,
17+
DidChangeWorkspaceFoldersParams,
18+
DidSaveTextDocumentParams,
19+
RenameFilesParams,
20+
WorkspaceFolder,
21+
} from '@aws/language-server-runtimes/protocol'
1422
import {
1523
ResourcePaths,
1624
Settings,
@@ -123,6 +131,52 @@ export async function startLanguageServer(extensionContext: vscode.ExtensionCont
123131
}),
124132
AuthUtil.instance.auth.onDidDeleteConnection(async () => {
125133
client.sendNotification(notificationTypes.deleteBearerToken.method)
134+
}),
135+
vscode.workspace.onDidCreateFiles((e) => {
136+
client.sendNotification('workspace/didCreateFiles', {
137+
files: e.files.map((it) => {
138+
return { uri: it.fsPath }
139+
}),
140+
} as CreateFilesParams)
141+
}),
142+
vscode.workspace.onDidDeleteFiles((e) => {
143+
client.sendNotification('workspace/didDeleteFiles', {
144+
files: e.files.map((it) => {
145+
return { uri: it.fsPath }
146+
}),
147+
} as DeleteFilesParams)
148+
}),
149+
vscode.workspace.onDidRenameFiles((e) => {
150+
client.sendNotification('workspace/didRenameFiles', {
151+
files: e.files.map((it) => {
152+
return { oldUri: it.oldUri.fsPath, newUri: it.newUri.fsPath }
153+
}),
154+
} as RenameFilesParams)
155+
}),
156+
vscode.workspace.onDidSaveTextDocument((e) => {
157+
client.sendNotification('workspace/didSaveTextDocument', {
158+
textDocument: {
159+
uri: e.uri.fsPath,
160+
},
161+
} as DidSaveTextDocumentParams)
162+
}),
163+
vscode.workspace.onDidChangeWorkspaceFolders((e) => {
164+
client.sendNotification('workspace/didChangeWorkspaceFolder', {
165+
event: {
166+
added: e.added.map((it) => {
167+
return {
168+
name: it.name,
169+
uri: it.uri.fsPath,
170+
} as WorkspaceFolder
171+
}),
172+
removed: e.removed.map((it) => {
173+
return {
174+
name: it.name,
175+
uri: it.uri.fsPath,
176+
} as WorkspaceFolder
177+
}),
178+
},
179+
} as DidChangeWorkspaceFoldersParams)
126180
})
127181
)
128182
})

packages/amazonq/src/lsp/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { DevSettings, getServiceEnvVarConfig } from 'aws-core-vscode/shared'
77
import { LspConfig } from 'aws-core-vscode/amazonq'
88

99
export const defaultAmazonQLspConfig: LspConfig = {
10-
manifestUrl: 'https://aws-toolkit-language-servers.amazonaws.com/codewhisperer/0/manifest.json',
11-
supportedVersions: '^3.1.1',
10+
manifestUrl: 'https://aws-language-servers-gamma.amazonaws.com/remoteWorkspaceContext/0/manifest.json',
11+
supportedVersions: '0.1.2-rc.2',
1212
id: 'AmazonQ', // used for identification in global storage/local disk location. Do not change.
1313
path: undefined,
1414
}

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"AWS.configuration.description.amazonq": "Amazon Q creates a code reference when you insert a code suggestion from Amazon Q that is similar to training data. When unchecked, Amazon Q will not show code suggestions that have code references. If you authenticate through IAM Identity Center, this setting is controlled by your Amazon Q administrator. [Learn More](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/code-reference.html)",
9191
"AWS.configuration.description.amazonq.shareContentWithAWS": "When checked, your content processed by Amazon Q may be used for service improvement (except for content processed for users with the Amazon Q Developer Pro Tier). Unchecking this box will cause AWS to delete any of your content used for that purpose. The information used to provide the Amazon Q service to you will not be affected. See the [Service Terms](https://aws.amazon.com/service-terms) for more details.",
9292
"AWS.configuration.description.amazonq.importRecommendation": "Amazon Q will add import statements with inline code suggestions when necessary.",
93+
"AWS.configuration.description.amazonq.workspaceContext": "Allow Amazon Q to create remote workspace for quality improvements.",
9394
"AWS.configuration.description.amazonq.workspaceIndex": "When you add @workspace to your question in Amazon Q chat, Amazon Q will index your workspace files locally to use as context for its response. Extra CPU usage is expected while indexing a workspace. This will not impact Amazon Q features or your IDE, but you may manage CPU usage by setting the number of local threads in 'Local Workspace Index Threads'.",
9495
"AWS.configuration.description.amazonq.workspaceIndexWorkerThreads": "Number of worker threads of Amazon Q local index process. '0' will use the system default worker threads for balance performance. You may increase this number to more quickly index your workspace, but only up to your hardware's number of CPU cores. Please restart VS Code or reload the VS Code window after changing worker threads.",
9596
"AWS.configuration.description.amazonq.workspaceIndexUseGPU": "Enable GPU to help index your local workspace files. Only applies to Linux and Windows.",

packages/core/src/auth/connection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ const warnOnce = onceChanged((s: string, url: string) => {
2828
export const scopesCodeCatalyst = ['codecatalyst:read_write']
2929
export const scopesSsoAccountAccess = ['sso:account:access']
3030
/** These are the non-chat scopes for CW. */
31-
export const scopesCodeWhispererCore = ['codewhisperer:completions', 'codewhisperer:analysis']
32-
export const scopesCodeWhispererChat = ['codewhisperer:conversations']
33-
export const scopesFeatureDev = ['codewhisperer:taskassist']
34-
export const scopesGumby = ['codewhisperer:transformations']
31+
export const scopesCodeWhispererCore = ['codewhisperer_internal:completions', 'codewhisperer_internal:analysis']
32+
export const scopesCodeWhispererChat = ['codewhisperer_internal:conversations']
33+
export const scopesFeatureDev = ['codewhisperer_internal:taskassist']
34+
export const scopesGumby = ['codewhisperer_internal:transformations']
3535

3636
export const defaultSsoRegion = 'us-east-1'
3737

packages/core/src/codewhisperer/client/codewhisperer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ export interface CodeWhispererConfig {
3131
}
3232

3333
export const defaultServiceConfig: CodeWhispererConfig = {
34-
region: 'us-east-1',
35-
endpoint: 'https://codewhisperer.us-east-1.amazonaws.com/',
34+
region: 'us-west-2',
35+
endpoint: 'https://rts.gamma-us-west-2.codewhisperer.ai.aws.dev/',
3636
}
3737

3838
export function getCodewhispererConfig(): CodeWhispererConfig {

0 commit comments

Comments
 (0)