Skip to content

Commit 5962a67

Browse files
authored
refactor(inline suggestion): camel case supplemental context strategy ids #6369
house cleaning and unify naming pattern of this field corresponding JB commit aws/aws-toolkit-jetbrains@39bc048
1 parent 7c0b90e commit 5962a67

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

packages/amazonq/test/unit/codewhisperer/service/recommendationHandler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ describe('recommendationHandler', function () {
125125
supplementalContextItems: [],
126126
contentsLength: 100,
127127
latency: 0,
128-
strategy: 'Empty',
128+
strategy: 'empty',
129129
})
130130
sinon.stub(performance, 'now').returns(0.0)
131131
session.startPos = new vscode.Position(1, 0)

packages/core/src/codewhisperer/models/model.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ export const vsCodeState: VsCodeState = {
4747
isFreeTierLimitReached: false,
4848
}
4949

50-
export type UtgStrategy = 'ByName' | 'ByContent'
50+
export type UtgStrategy = 'byName' | 'byContent'
5151

5252
export type CrossFileStrategy = 'opentabs' | 'codemap' | 'bm25' | 'default'
5353

54-
export type SupplementalContextStrategy = CrossFileStrategy | UtgStrategy | 'Empty'
54+
export type SupplementalContextStrategy = CrossFileStrategy | UtgStrategy | 'empty'
5555

5656
export type PatchInfo = {
5757
name: string

packages/core/src/codewhisperer/util/supplementalContext/crossFileContextUtil.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ export async function fetchSupplementalContextForSrc(
8888
const supContext = (await opentabsContextPromise) ?? []
8989
return {
9090
supplementalContextItems: supContext,
91-
strategy: supContext.length === 0 ? 'Empty' : 'opentabs',
91+
strategy: supContext.length === 0 ? 'empty' : 'opentabs',
9292
}
9393
}
9494

9595
// codemap will use opentabs context plus repomap if it's present
9696
if (supplementalContextConfig === 'codemap') {
97-
let strategy: SupplementalContextStrategy = 'Empty'
97+
let strategy: SupplementalContextStrategy = 'empty'
9898
let hasCodemap: boolean = false
9999
let hasOpentabs: boolean = false
100100
const opentabsContextAndCodemap = await waitUntil(
@@ -132,7 +132,7 @@ export async function fetchSupplementalContextForSrc(
132132
} else if (hasOpentabs) {
133133
strategy = 'opentabs'
134134
} else {
135-
strategy = 'Empty'
135+
strategy = 'empty'
136136
}
137137

138138
return {
@@ -161,7 +161,7 @@ export async function fetchSupplementalContextForSrc(
161161
const supContext = opentabsContext ?? []
162162
return {
163163
supplementalContextItems: supContext,
164-
strategy: supContext.length === 0 ? 'Empty' : 'opentabs',
164+
strategy: supContext.length === 0 ? 'empty' : 'opentabs',
165165
}
166166
}
167167

packages/core/src/codewhisperer/util/supplementalContext/supplementalContextUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function fetchSupplementalContext(
5858
supplementalContextItems: [],
5959
contentsLength: 0,
6060
latency: performance.now() - timesBeforeFetching,
61-
strategy: 'Empty',
61+
strategy: 'empty',
6262
}
6363
} else {
6464
getLogger().error(

packages/core/src/codewhisperer/util/supplementalContext/utgUtils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export async function fetchSupplementalContextForTest(
5454
const shouldProceed = shouldFetchUtgContext(editor.document.languageId)
5555

5656
if (!shouldProceed) {
57-
return shouldProceed === undefined ? undefined : { supplementalContextItems: [], strategy: 'Empty' }
57+
return shouldProceed === undefined ? undefined : { supplementalContextItems: [], strategy: 'empty' }
5858
}
5959

6060
const languageConfig = utgLanguageConfigs[editor.document.languageId]
@@ -69,10 +69,10 @@ export async function fetchSupplementalContextForTest(
6969
return {
7070
supplementalContextItems: await generateSupplementalContextFromFocalFile(
7171
crossSourceFile,
72-
'ByName',
72+
'byName',
7373
cancellationToken
7474
),
75-
strategy: 'ByName',
75+
strategy: 'byName',
7676
}
7777
}
7878
throwIfCancelled(cancellationToken)
@@ -84,18 +84,18 @@ export async function fetchSupplementalContextForTest(
8484
return {
8585
supplementalContextItems: await generateSupplementalContextFromFocalFile(
8686
crossSourceFile,
87-
'ByContent',
87+
'byContent',
8888
cancellationToken
8989
),
90-
strategy: 'ByContent',
90+
strategy: 'byContent',
9191
}
9292
}
9393

9494
// TODO (Metrics): 4. Failure count - when unable to find focal file (supplemental context empty)
9595
getLogger().debug(`CodeWhisperer failed to fetch utg context`)
9696
return {
9797
supplementalContextItems: [],
98-
strategy: 'Empty',
98+
strategy: 'empty',
9999
}
100100
}
101101

0 commit comments

Comments
 (0)