Skip to content

Commit db8c544

Browse files
committed
docs: update comment
1 parent fecfa59 commit db8c544

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

packages/amazonq/src/lsp/config.ts

+12-11
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import { DevSettings, getLogger, getServiceEnvVarConfig, Settings } from 'aws-core-vscode/shared'
77
import { LspConfig } from 'aws-core-vscode/amazonq'
88

9-
// Taken from https://github.com/aws/language-server-runtimes/blob/eae85672c345d8adaf4c8cbd741260b8a59750c4/runtimes/runtimes/util/loggingUtil.ts#L4-L10
9+
// Taken from language server repo since they are not exported:
10+
// https://github.com/aws/language-server-runtimes/blob/eae85672c345d8adaf4c8cbd741260b8a59750c4/runtimes/runtimes/util/loggingUtil.ts#L4-L10
1011
const validLspLogLevels = ['error', 'warn', 'info', 'log', 'debug']
1112
export interface ExtendedAmazonQLSPConfig extends LspConfig {
1213
ui?: string
@@ -36,18 +37,18 @@ export function getLspLogSettings(clientId: string) {
3637
const seperateTraceChannel = Settings.instance.get(traceServerSetting)
3738
const lspLogLevel = Settings.instance.get(lspLogLevelSetting, String, 'info')
3839

40+
return {
41+
seperateTraceChannel,
42+
lspLogLevel: sanitizeLogLevel(lspLogLevel),
43+
}
44+
}
45+
46+
export function sanitizeLogLevel(lspLogLevel: string) {
3947
if (!validLspLogLevels.includes(lspLogLevel)) {
4048
getLogger('amazonqLsp').warn(
41-
`Invalid log level for ${lspLogLevelSetting}: ${lspLogLevel}. Defaulting to 'info'.`
49+
`Invalid log level for amazonq.lsp.logLevel: ${lspLogLevel}. Defaulting to 'info'.`
4250
)
43-
return {
44-
seperateTraceChannel,
45-
lspLogLevel: 'info',
46-
}
47-
}
48-
49-
return {
50-
seperateTraceChannel,
51-
lspLogLevel: lspLogLevel,
51+
return 'info'
5252
}
53+
return lspLogLevel
5354
}

0 commit comments

Comments
 (0)