-
Notifications
You must be signed in to change notification settings - Fork 747
feat(amazonq): add setting to configure lsp log level #7172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
failing test tracked in #7183 |
| "type": "string" | ||
| } | ||
| }, | ||
| "amazonQ.lsp.traceChannel": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be explained somewhere in the documentation? Also I don't see traceChannel being used specifically in the code anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't amazonq.lsp.trace defined here? Does it not need to be, or we want to hide from users?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed amazonq.lsp.trace to amazonQ.lsp.traceChannel however didn't update the reference in the docs. Good catch, should be updated now.
docs/lsp.md
Outdated
| 4. Uncomment the `__AMAZONQLSP_PATH` and `__AMAZONQLSP_UI` variables in the `amazonq/.vscode/launch.json` extension configuration | ||
| 5. Use the `Launch LSP with Debugging` configuration and set breakpoints in VSCode or the language server | ||
| 6. (Optional): Enable `"amazonq.trace.server": "on"` or `"amazonq.trace.server": "verbose"` in your VSCode settings to view detailed log messages sent to/from the language server. These log messages will show up in the "Amazon Q Language Server" output channel | ||
| 6. (Optional): Enable `"amazonq.lsp.trace": "on"` in your VSCode settings to view detailed log messages sent to/from the language server. These log messages will show up in the "Amazon Q Language Server" output channel. `"amazonq.lsp.logLevel"` can be used to configure the log level for the language server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be helpful to create a dedicated section to enabling logs here instead of as a single bullet point. Then you can link to it. It will also be useful to link to it from the CONTRIBUTING.md loggin section (search ### Logging) as a subsection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these settings are exposed to the user through the UI, I was treating those descriptions as the documentation. However, I agree that this is useful information to have in CONTRIBUTING.md so I've duplicated it there as where.
|
Going to look into mapping the VSC log level to the Flare one instead. |
## Problem Same problem as #7172 ## Solution - listen to logLevel change events, and forward them to LSP. - pass initial logLevel to the LSP as well. - This requires mapping the local levels to the Flare Levels. This is done with the following: ``` export const lspLogLevelMapping: Map<vscode.LogLevel, LspLogLevel> = new Map([ [vscode.LogLevel.Error, 'error'], [vscode.LogLevel.Warning, 'warn'], [vscode.LogLevel.Info, 'info'], [vscode.LogLevel.Debug, 'log'], [vscode.LogLevel.Trace, 'debug'], [vscode.LogLevel.Off, 'error'], // TODO: once the language server supports a no-log setting, we can map to that. ]) ``` ## Notes - Because of this mapping, it means that to enabled 'debug' logs in Flare, we set to 'trace' in VSC which can be confusing for contributors. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Problem
We don't pass log level to the LSP, meaning it always defaults to info. This results in debug logs never showing up in the client side logs.
These settings are also missing from the UI.
Solution
amazonQ.lsp.logLevelto allow this to be configured. The allowed options are listed hereamazonQ.lsp.traceChannel....lsp.traceChannelsends language server logs to a separate channel (and includes the lsp req/rsp tracing)....lsp.logLeveldetermines which level these should be logged at.logLevelsetting with the lsp based on instructions here. AFAIK this can't currently be done with theoutputChannelsetting without some runtimes changes.related: #7114
Notes
lspprefix to describe the language server, but this isn't technically correct sincelspis the protocol. I kept my changes consistent with this, but in the future we may want to change this to avoid potentially confusing people.Settings UI
feature/xbranches will not be squash-merged at release time.