Skip to content
Closed
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 @@ -204,7 +204,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
// record preprocessing end time
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 @@ -123,7 +123,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 @@ -143,6 +146,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