Skip to content

Commit 8a2dd3a

Browse files
authored
codewhisperer: crossfile configuration update (#3737)
1 parent 86226e4 commit 8a2dd3a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/codewhisperer/models/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ export const supplemetalContextFetchingTimeoutMsg = 'codewhisperer supplemental
274274

275275
export const crossFileContextConfig = {
276276
numberOfChunkToFetch: 60,
277+
numberOfChunkToFetchExperiment: 1000,
277278
topK: 3,
278279
numberOfLinesEachChunk: 10,
279280
}

src/codewhisperer/util/supplementalContext/crossFileContextUtil.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ export async function fetchSupplementalContextForSrc(
6060
return shouldProceed === undefined ? undefined : []
6161
}
6262

63+
const codeChunksCalculated =
64+
CodeWhispererUserGroupSettings.instance.userGroup === UserGroup.Control
65+
? crossFileContextConfig.numberOfChunkToFetch
66+
: crossFileContextConfig.numberOfChunkToFetchExperiment
67+
6368
// Step 1: Get relevant cross files to refer
6469
const relevantCrossFilePaths = await getCrossFileCandidates(editor)
6570
throwIfCancelled(cancellationToken)
@@ -70,16 +75,16 @@ export async function fetchSupplementalContextForSrc(
7075
let chunkList: Chunk[] = []
7176
for (const relevantFile of relevantCrossFilePaths) {
7277
throwIfCancelled(cancellationToken)
73-
const chunks: Chunk[] = splitFileToChunks(relevantFile, crossFileContextConfig.numberOfLinesEachChunk)
78+
const chunks: Chunk[] = splitFileToChunks(relevantFile, codeChunksCalculated)
7479
const linkedChunks = linkChunks(chunks)
7580
chunkList.push(...linkedChunks)
76-
if (chunkList.length >= crossFileContextConfig.numberOfChunkToFetch) {
81+
if (chunkList.length >= codeChunksCalculated) {
7782
break
7883
}
7984
}
8085

8186
// it's required since chunkList.push(...) is likely giving us a list of size > 60
82-
chunkList = chunkList.slice(0, crossFileContextConfig.numberOfChunkToFetch)
87+
chunkList = chunkList.slice(0, codeChunksCalculated)
8388

8489
// Step 3: Generate Input chunk (10 lines left of cursor position)
8590
// and Find Best K chunks w.r.t input chunk using BM25

0 commit comments

Comments
 (0)