in server/aws-lsp-codewhisperer/src/shared/amazonQServiceManager/configurationUtils.ts [105:168]
export async function getAmazonQRelatedWorkspaceConfigs(
lsp: Lsp,
logging: Logging
): Promise<Readonly<Partial<AmazonQWorkspaceConfig>>> {
let qConfig: Readonly<QConfigSection> | undefined = undefined
let codeWhispererConfig: Readonly<CodeWhispererConfigSection> | undefined = undefined
try {
logging.debug(`Calling getConfiguration(${Q_CONFIGURATION_SECTION})`)
const newQConfig = await lsp.workspace.getConfiguration(Q_CONFIGURATION_SECTION)
if (newQConfig) {
qConfig = {
customizationArn: textUtils.undefinedIfEmpty(newQConfig.customization),
optOutTelemetryPreference: newQConfig['optOutTelemetry'] === true ? 'OPTOUT' : 'OPTIN',
inlineSuggestions: {
extraContext: textUtils.undefinedIfEmpty(newQConfig.inlineSuggestions?.extraContext),
},
projectContext: {
enableLocalIndexing: newQConfig.projectContext?.enableLocalIndexing === true,
enableGpuAcceleration: newQConfig.projectContext?.enableGpuAcceleration === true,
indexWorkerThreads: newQConfig.projectContext?.indexWorkerThreads ?? -1,
localIndexing: {
ignoreFilePatterns: newQConfig.projectContext?.localIndexing?.ignoreFilePatterns ?? [],
maxFileSizeMB: newQConfig.projectContext?.localIndexing?.maxFileSizeMB ?? 10,
maxIndexSizeMB: newQConfig.projectContext?.localIndexing?.maxIndexSizeMB ?? 2048,
indexCacheDirPath: newQConfig.projectContext?.localIndexing?.indexCacheDirPath ?? undefined,
},
},
}
logging.log(`Read configuration customizationArn=${qConfig.customizationArn}`)
logging.log(`Read configuration optOutTelemetryPreference=${qConfig.optOutTelemetryPreference}`)
}
} catch (error) {
logging.error(`Error in getConfiguration(${Q_CONFIGURATION_SECTION}): ${error}`)
}
try {
logging.debug(`Calling getConfiguration(${CODE_WHISPERER_CONFIGURATION_SECTION})`)
const newCodeWhispererConfig = await lsp.workspace.getConfiguration(CODE_WHISPERER_CONFIGURATION_SECTION)
if (newCodeWhispererConfig) {
codeWhispererConfig = {
includeSuggestionsWithCodeReferences:
newCodeWhispererConfig['includeSuggestionsWithCodeReferences'] === true,
shareCodeWhispererContentWithAWS: newCodeWhispererConfig['shareCodeWhispererContentWithAWS'] === true,
}
logging.log(
`Read Ńonfiguration includeSuggestionsWithCodeReferences=${codeWhispererConfig.includeSuggestionsWithCodeReferences}`
)
logging.log(
`Read configuration shareCodeWhispererContentWithAWS=${codeWhispererConfig.shareCodeWhispererContentWithAWS}`
)
}
} catch (error) {
logging.error(`Error in getConfiguration(${CODE_WHISPERER_CONFIGURATION_SECTION}): ${error}`)
}
return {
...qConfig,
...codeWhispererConfig,
}
}