Skip to content
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

fix(amazonq): Add code reference opt-in config to non-SSO requests #5551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ export class RecommendationHandler {
}
}
} else {
session.requestContext = await EditorContext.buildGenerateRecommendationRequest(editor as vscode.TextEditor)
session.requestContext = await EditorContext.buildGenerateRecommendationRequest(
editor as vscode.TextEditor,
config.isSuggestionsWithCodeReferencesEnabled
)
}
const request = session.requestContext.request

Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/codewhisperer/util/editorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export async function buildListRecommendationRequest(
}
}

export async function buildGenerateRecommendationRequest(editor: vscode.TextEditor): Promise<{
export async function buildGenerateRecommendationRequest(
editor: vscode.TextEditor,
allowCodeWithReference: boolean
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - align it with the API definition - allowRecommendationsWithReferences?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I based it off of the same parameter in buildListRecommendationRequest here

): Promise<{
request: codewhispererClient.GenerateRecommendationsRequest
supplementalMetadata: CodeWhispererSupplementalContext | undefined
}> {
Expand All @@ -150,6 +153,9 @@ export async function buildGenerateRecommendationRequest(editor: vscode.TextEdit
request: {
fileContext: fileContext,
maxResults: CodeWhispererConstants.maxRecommendations,
referenceTrackerConfiguration: {
recommendationsWithReferences: allowCodeWithReference ? 'ALLOW' : 'BLOCK',
},
supplementalContexts: supplementalContexts?.supplementalContextItems ?? [],
},
supplementalMetadata: supplementalContexts,
Expand Down
Loading