@@ -53,25 +53,35 @@ interface Chunk {
5353 score ?: number
5454}
5555
56- type SupplementalContextConfig = 'none' | 'openbtabs' | 'codemap' | 'bm25' | 'default'
56+ /**
57+ * `none`: supplementalContext is not supported
58+ * `opentabs`: opentabs_BM25
59+ * `codemap`: repomap + opentabs BM25
60+ * `bm25`: global_BM25
61+ * `default`: repomap + global_BM25
62+ */
63+ type SupplementalContextConfig = 'none' | 'opentabs' | 'codemap' | 'bm25' | 'default'
5764
5865export async function fetchSupplementalContextForSrc (
5966 editor : vscode . TextEditor ,
6067 cancellationToken : vscode . CancellationToken
6168) : Promise < Pick < CodeWhispererSupplementalContext , 'supplementalContextItems' | 'strategy' > | undefined > {
6269 const supplementalContextConfig = getSupplementalContextConfig ( editor . document . languageId )
6370
71+ // not supported case
6472 if ( supplementalContextConfig === 'none' ) {
6573 return undefined
6674 }
6775
68- if ( supplementalContextConfig === 'openbtabs' ) {
76+ // opentabs context will use bm25 and users' open tabs to fetch supplemental context
77+ if ( supplementalContextConfig === 'opentabs' ) {
6978 return {
7079 supplementalContextItems : ( await fetchOpentabsContext ( editor , cancellationToken ) ) ?? [ ] ,
7180 strategy : 'OpenTabs_BM25' ,
7281 }
7382 }
7483
84+ // codemap will use opentabs context plus repomap if it's present
7585 if ( supplementalContextConfig === 'codemap' ) {
7686 const opentabsContextAndCodemap = await waitUntil (
7787 async function ( ) {
@@ -106,6 +116,7 @@ export async function fetchSupplementalContextForSrc(
106116 { timeout : supplementalContextTimeoutInMs , interval : 5 , truthy : false }
107117 )
108118
119+ // global bm25 without repomap
109120 if ( supplementalContextConfig === 'bm25' ) {
110121 const projectBM25Promise = waitUntil (
111122 async function ( ) {
@@ -128,6 +139,7 @@ export async function fetchSupplementalContextForSrc(
128139 }
129140 }
130141
142+ // global bm25 with repomap
131143 const projectContextAndCodemapPromise = waitUntil (
132144 async function ( ) {
133145 return await fetchProjectContext ( editor , 'default' )
@@ -273,7 +285,7 @@ function getSupplementalContextConfig(languageId: vscode.TextDocument['languageI
273285 const group = FeatureConfigProvider . instance . getProjectContextGroup ( )
274286 switch ( group ) {
275287 case 'control' :
276- return 'openbtabs '
288+ return 'opentabs '
277289
278290 case 't1' :
279291 return 'codemap'
0 commit comments