Fix ESLint debug output log level - #2212
Conversation
|
Although this is working the server side is not the right place to fix this. Major reason is that the server doesn't know anything about the formatting of the output channel and different clients might handle things differently. A better solution is to do this on the client side by overriding the error, warn, log and info method and string any date format from the start of the message. |
Dirk Bäumer (dbaeumer)
left a comment
There was a problem hiding this comment.
See latest comment in PR.
|
Updated as requested. I removed the server-side stderr bridge and moved the fix to the client output channel. What changed:
Validated with:
|
|
We should first fix microsoft/vscode-languageserver-node#1838 and then use the new API to provide a nice implementation for ESLint. In general I am not a big fan of batching methods on VS Code API object. If they freeze these object or do some other tricks this will fail in the future. |
|
Thanks, agreed. I converted this PR to draft while the upstream API work lands. Once microsoft/vscode-languageserver-node#1838 / microsoft/vscode-languageserver-node#1839 is merged and a |
|
The LSP libs are updated and #2228 will make them available here. |
|
Updated now that #2228 has landed. This PR now uses Validated with:
|
|
Follow-up: the first Azure rerun caught an unused type import from the refactor. I removed it in |
|
/AzurePipelines run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/AzurePipelines run |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
🟢 Approval recommended
The change is client-scoped, aligns with the stated intent (fixing debug output log levels), and includes targeted tests validating the new routing/sanitization behavior.
Pull request overview
This PR fixes incorrect log-level tagging for ESLint --debug output in the VS Code ESLint extension by using vscode-languageclient’s stdioOptions hooks to sanitize and re-route server stdout/stderr lines, avoiding any mutation/patching of VS Code’s LogOutputChannel.
Changes:
- Add client-side stdout/stderr line processing to strip leading timestamps and ANSI sequences, and route ESLint debug namespaces (
eslint:/eslintrc:) from stderr toinfo. - Wire the new
stdioOptionsbehavior into theLanguageClientOptionsused to start the ESLint server. - Add focused unit tests (Node’s
node:test) validating sanitization and stdout/stderr routing.
File summaries
| File | Description |
|---|---|
| client/src/client.ts | Passes stdioOptions into LanguageClientOptions to control how server stdout/stderr is logged. |
| client/src/logOutput.ts | Implements sanitization and routing logic for ESLint server stdout/stderr lines. |
| client/src/tests/logOutput.test.ts | Adds unit tests covering sanitization and log-level routing behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Pradeep Ramola (@pradeep-ramola) see the Copilot comments. |
|
Addressed the two Copilot review comments in
Validated locally with:
|
Fixes #2060
Summary
Uses the
stdioOptionsAPI fromvscode-languageclient@10.1.1to handle ESLint server stdout/stderr formatting without patching VS Code'sLogOutputChannelobject.ESLint debug namespace messages from stderr (
eslint:/eslintrc:) are sanitized and written asinfo, while non-debug stderr lines continue to useerror. Stdout lines are sanitized and written asinfo.This keeps the fix on the client side, follows the new LSP client API, and avoids mutating VS Code API objects.
Validation
Passed locally:
Also compiled
client/src/logOutput.tsandclient/src/tests/logOutput.test.tsto a temp directory and ran the emitted test withnode --test; all 4 log-output tests passed.