Skip to content
Merged
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
4 changes: 3 additions & 1 deletion packages/core/src/codewhisperer/util/editorContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ export async function buildGenerateRecommendationRequest(editor: vscode.TextEdit
const fileContext = extractContextForCodeWhisperer(editor)

const tokenSource = new vscode.CancellationTokenSource()
// the supplement context fetch mechanisms each has a timeout of supplementalContextTimeoutInMs
// adding 10 ms for overall timeout as buffer
setTimeout(() => {
tokenSource.cancel()
}, supplementalContextTimeoutInMs)
}, supplementalContextTimeoutInMs + 10)
const supplementalContexts = await fetchSupplementalContext(editor, tokenSource.token)

logSupplementalContext(supplementalContexts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ export async function fetchSupplementalContextForSrc(
async function () {
return await fetchSupplementalContextForSrcV1(editor, cancellationToken)
},
{ timeout: supplementalContextTimeoutInMs, interval: 10, truthy: false }
{ timeout: supplementalContextTimeoutInMs, interval: 5, truthy: false }
)
const promiseV2 = waitUntil(
async function () {
return await fetchSupplementalContextForSrcV2(editor)
},
{ timeout: supplementalContextTimeoutInMs, interval: 10, truthy: false }
{ timeout: supplementalContextTimeoutInMs, interval: 5, truthy: false }
)
const [resultV1, resultV2] = await Promise.all([promiseV1, promiseV2])
return resultV2 ?? resultV1
Expand Down
Loading