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
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('recommendationHandler', function () {
supplementalContextItems: [],
contentsLength: 100,
latency: 0,
strategy: 'Empty',
strategy: 'empty',
})
sinon.stub(performance, 'now').returns(0.0)
session.startPos = new vscode.Position(1, 0)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/codewhisperer/models/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export const vsCodeState: VsCodeState = {
isFreeTierLimitReached: false,
}

export type UtgStrategy = 'ByName' | 'ByContent'
export type UtgStrategy = 'byName' | 'byContent'

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

export type SupplementalContextStrategy = CrossFileStrategy | UtgStrategy | 'Empty'
export type SupplementalContextStrategy = CrossFileStrategy | UtgStrategy | 'empty'

export type PatchInfo = {
name: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ export async function fetchSupplementalContextForSrc(
const supContext = (await opentabsContextPromise) ?? []
return {
supplementalContextItems: supContext,
strategy: supContext.length === 0 ? 'Empty' : 'opentabs',
strategy: supContext.length === 0 ? 'empty' : 'opentabs',
}
}

// codemap will use opentabs context plus repomap if it's present
if (supplementalContextConfig === 'codemap') {
let strategy: SupplementalContextStrategy = 'Empty'
let strategy: SupplementalContextStrategy = 'empty'
let hasCodemap: boolean = false
let hasOpentabs: boolean = false
const opentabsContextAndCodemap = await waitUntil(
Expand Down Expand Up @@ -132,7 +132,7 @@ export async function fetchSupplementalContextForSrc(
} else if (hasOpentabs) {
strategy = 'opentabs'
} else {
strategy = 'Empty'
strategy = 'empty'
}

return {
Expand Down Expand Up @@ -161,7 +161,7 @@ export async function fetchSupplementalContextForSrc(
const supContext = opentabsContext ?? []
return {
supplementalContextItems: supContext,
strategy: supContext.length === 0 ? 'Empty' : 'opentabs',
strategy: supContext.length === 0 ? 'empty' : 'opentabs',
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function fetchSupplementalContext(
supplementalContextItems: [],
contentsLength: 0,
latency: performance.now() - timesBeforeFetching,
strategy: 'Empty',
strategy: 'empty',
}
} else {
getLogger().error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function fetchSupplementalContextForTest(
const shouldProceed = shouldFetchUtgContext(editor.document.languageId)

if (!shouldProceed) {
return shouldProceed === undefined ? undefined : { supplementalContextItems: [], strategy: 'Empty' }
return shouldProceed === undefined ? undefined : { supplementalContextItems: [], strategy: 'empty' }
}

const languageConfig = utgLanguageConfigs[editor.document.languageId]
Expand All @@ -69,10 +69,10 @@ export async function fetchSupplementalContextForTest(
return {
supplementalContextItems: await generateSupplementalContextFromFocalFile(
crossSourceFile,
'ByName',
'byName',
cancellationToken
),
strategy: 'ByName',
strategy: 'byName',
}
}
throwIfCancelled(cancellationToken)
Expand All @@ -84,18 +84,18 @@ export async function fetchSupplementalContextForTest(
return {
supplementalContextItems: await generateSupplementalContextFromFocalFile(
crossSourceFile,
'ByContent',
'byContent',
cancellationToken
),
strategy: 'ByContent',
strategy: 'byContent',
}
}

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

Expand Down
Loading