-
Notifications
You must be signed in to change notification settings - Fork 747
feat(amazonq): remote workspace context #6894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 28 commits
14f2659
9df0b01
ce37759
f767505
86df670
00bf62c
37aeb2b
12d7169
cb16c75
b16e0d2
724308e
81597ea
9ad7a12
1a2f2f5
f71e05b
5d4b6d9
f9433f6
836ac80
6704a46
74629c8
f293cac
e596890
8194371
27cf915
847cbff
9387633
97447cd
3109971
ea8582b
c6269e7
30a9bfb
7c31f3a
32009cd
3a71511
ddb9734
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,19 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "." | ||
| }, | ||
| { | ||
| "path": "packages/toolkit" | ||
| }, | ||
| { | ||
| "path": "packages/core" | ||
| }, | ||
| { | ||
| "path": "packages/amazonq" | ||
| } | ||
| ], | ||
| "settings": { | ||
| "typescript.tsdk": "node_modules/typescript/lib" | ||
| } | ||
| } | ||
| "folders": [ | ||
| { | ||
| "path": ".", | ||
| }, | ||
| { | ||
| "path": "packages/toolkit", | ||
| }, | ||
| { | ||
| "path": "packages/core", | ||
| }, | ||
| { | ||
| "path": "packages/amazonq", | ||
| }, | ||
| ], | ||
| "settings": { | ||
| "typescript.tsdk": "node_modules/typescript/lib", | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,8 +11,8 @@ export interface ExtendedAmazonQLSPConfig extends LspConfig { | |
| } | ||
|
|
||
| export const defaultAmazonQLspConfig: ExtendedAmazonQLSPConfig = { | ||
| manifestUrl: 'https://aws-toolkit-language-servers.amazonaws.com/codewhisperer/0/manifest.json', | ||
| supportedVersions: '^3.1.1', | ||
| manifestUrl: 'https://aws-toolkit-language-servers.amazonaws.com/remoteWorkspaceContext/0/manifest.json', | ||
| supportedVersions: '^1.0.0', | ||
|
Comment on lines
+14
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the final URL or will
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is final, to my knowledge. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now this is the final URL but I imagine we will need to change the URL in the near future because new artifacts are also being built
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name is pretty confusing. this will this URL also have the upcoming "agentic chat" capabilities? |
||
| id: 'AmazonQ', // used across IDEs for identifying global storage/local disk locations. Do not change. | ||
| suppressPromptPrefix: 'amazonQ', | ||
| path: undefined, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ import { checkLeftContextKeywordsForJson } from './commonUtil' | |
| import { CodeWhispererSupplementalContext } from '../models/model' | ||
| import { getOptOutPreference } from '../../shared/telemetry/util' | ||
| import { indent } from '../../shared/utilities/textUtilities' | ||
| import { isInDirectory } from '../../shared' | ||
| import { AuthUtil } from './authUtil' | ||
|
|
||
| let tabSize: number = getTabSizeSetting() | ||
|
|
@@ -83,6 +84,22 @@ export function getFileRelativePath(editor: vscode.TextEditor): string { | |
| return relativePath.substring(0, CodeWhispererConstants.filenameCharsLimit) | ||
| } | ||
|
|
||
| async function getWorkspaceId(editor: vscode.TextEditor): Promise<string | undefined> { | ||
| try { | ||
| const workspaceIds: { workspaces: { workspaceRoot: string; workspaceId: string }[] } = | ||
| await vscode.commands.executeCommand('aws.amazonq.getWorkspaceId') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this a command instead of a plain function?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid cyclic dependency. The Flare LSP code was in the packages/amazonq which imports packages/core, but the CW code here is in packages/core.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if the command isn't defined? Sometimes there are startup ordering issues which result in "command not found" errors. Using a plain function would avoid that and add confidence. There are more robust ways of avoiding cyclic dependencies. Commands should be a last resort. |
||
| for (const item of workspaceIds.workspaces) { | ||
| const path = vscode.Uri.parse(item.workspaceRoot).fsPath | ||
| if (isInDirectory(path, editor.document.uri.fsPath)) { | ||
| return item.workspaceId | ||
| } | ||
| } | ||
| } catch (err) { | ||
| getLogger().warn(`No workspace id found ${err}`) | ||
| } | ||
| return undefined | ||
| } | ||
|
|
||
| export async function buildListRecommendationRequest( | ||
| editor: vscode.TextEditor, | ||
| nextToken: string, | ||
|
|
@@ -121,6 +138,7 @@ export async function buildListRecommendationRequest( | |
| supplementalContexts: supplementalContext, | ||
| customizationArn: selectedCustomization.arn === '' ? undefined : selectedCustomization.arn, | ||
| optOutPreference: getOptOutPreference(), | ||
| workspaceId: await getWorkspaceId(editor), | ||
| profileArn: profile?.arn, | ||
| }, | ||
| supplementalMetadata: supplementalContexts, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this event trigger for in-memory (non-file) editors? If so, should those be skipped, since the LSP can't do anything with them unless we send the file contents?