Skip to content

Commit 3c1796d

Browse files
committed
feat: add settings section for ls specific settings
1 parent e456dae commit 3c1796d

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

packages/amazonq/package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,23 @@
209209
"items": {
210210
"type": "string"
211211
}
212+
},
213+
"amazonQ.lsp.traceChannel": {
214+
"type": "boolean",
215+
"markdownDescription": "%AWS.configuration.description.amazonq.lsp.traceChannel%",
216+
"default": false
217+
},
218+
"amazonQ.lsp.logLevel": {
219+
"type": "string",
220+
"markdownDescription": "%AWS.configuration.description.amazonq.lsp.logLevel%",
221+
"default": "info",
222+
"enum": [
223+
"error",
224+
"warn",
225+
"info",
226+
"log",
227+
"debug"
228+
]
212229
}
213230
}
214231
},

packages/amazonq/src/lsp/client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function startLanguageServer(
6363
})
6464
const clientId = `amazonq`
6565
const documentSelector = [{ scheme: 'file', language: '*' }]
66-
const lspLogSettings = getLspLogSettings(clientId)
66+
const lspLogSettings = getLspLogSettings()
6767

6868
getLogger('amazonqLsp').info(`Sending log settings to lsp: %O`, lspLogSettings)
6969

@@ -149,7 +149,7 @@ export async function startLanguageServer(
149149
* When trace server is enabled, logs go to a seperate "Amazon Q Language Server" output.
150150
* Otherwise, logs go to the regular "Amazon Q Logs" channel.
151151
*/
152-
...(lspLogSettings.seperateTraceChannel
152+
...(lspLogSettings.traceChannelEnabled
153153
? {}
154154
: {
155155
outputChannel: globals.logOutputChannel,

packages/amazonq/src/lsp/config.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ export function getAmazonQLspConfig(): ExtendedAmazonQLSPConfig {
3131
}
3232

3333
// TODO: expose lsp logging settings to users and re-send on update.
34-
export function getLspLogSettings(clientId: string) {
35-
const traceServerSetting = `${clientId}.trace.server`
36-
const lspLogLevelSetting = `${clientId}.lsp.logLevel`
37-
const seperateTraceChannel = Settings.instance.get(traceServerSetting)
38-
const lspLogLevel = Settings.instance.get(lspLogLevelSetting, String, 'info')
34+
export function getLspLogSettings() {
35+
const lspSettings = Settings.instance.getSection('lsp')
36+
const lspLogLevel = lspSettings.get('logLevel', 'info')
37+
const traceChannelEnabled = lspSettings.get('trace', false)
3938

4039
return {
41-
seperateTraceChannel,
40+
traceChannelEnabled,
4241
lspLogLevel: sanitizeLogLevel(lspLogLevel),
4342
}
4443
}

packages/core/package.nls.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@
9898
"AWS.configuration.description.amazonq.workspaceIndexIgnoreFilePatterns": "File patterns to ignore when indexing your workspace files",
9999
"AWS.configuration.description.amazonq.workspaceIndexCacheDirPath": "The path to the directory that contains the cache of the index of your workspace files",
100100
"AWS.configuration.description.amazonq.ignoredSecurityIssues": "Specifies a list of code issue identifiers that Amazon Q should ignore when reviewing your workspace. Each item in the array should be a unique string identifier for a specific code issue. This allows you to suppress notifications for known issues that you've assessed and determined to be false positives or not applicable to your project. Use this setting with caution, as it may cause you to miss important security alerts.",
101+
"AWS.configuration.description.amazonq.lsp.traceChannel": "View detailed log messages sent to/from the language server in a seperate output channel named 'Amazon Q Language Server'. All language server logs will be routed to this output channel instead.",
102+
"AWS.configuration.description.amazonq.lsp.logLevel": "Set the logging level of the language server.",
101103
"AWS.command.apig.copyUrl": "Copy URL",
102104
"AWS.command.apig.invokeRemoteRestApi": "Invoke in the cloud",
103105
"AWS.command.apig.invokeRemoteRestApi.cn": "Invoke on Amazon",

packages/core/src/shared/settings-amazonq.gen.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export const amazonqSettings = {
3535
"amazonQ.workspaceIndexMaxFileSize": {},
3636
"amazonQ.workspaceIndexCacheDirPath": {},
3737
"amazonQ.workspaceIndexIgnoreFilePatterns": {},
38-
"amazonQ.ignoredSecurityIssues": {}
38+
"amazonQ.ignoredSecurityIssues": {},
39+
"amazonQ.lsp.traceChannel": {},
40+
"amazonQ.lsp.logLevel": {}
3941
}
4042

4143
export default amazonqSettings

0 commit comments

Comments
 (0)