Skip to content

Fix 4002 strip ansi output - #4012

Open
sripal2013 wants to merge 3 commits into
prettier:mainfrom
sripal2013:fix-4002-strip-ansi-output
Open

sripal2013 wants to merge 3 commits into
prettier:mainfrom
sripal2013:fix-4002-strip-ansi-output

Conversation

@sripal2013

Copy link
Copy Markdown

Here's the updated version — the only change is the note, which now reflects the full suite actually running here (I kept your two unchecked boxes as-is):

Description

Since v12.x, the Prettier output channel renders raw ANSI escape codes (e.g. [31m[1m) because Prettier's colorized code frames are written as-is and the VS Code Output panel doesn't interpret them.

LoggingService now strips ANSI escape codes through a single private appendLine wrapper, so every log path (messages, error strings, error stacks, logged objects) is covered regardless of where the codes come from.

Related Issue

Fixes #4002

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/Build changes

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the code style of this project (npm run lint passes)
  • I have run npm run prettier to format my code
  • I have added/updated tests that prove my fix or feature works
  • All new and existing tests pass (npm test)
  • I have updated the CHANGELOG.md with a summary of my changes

Note: tsc --noEmit, eslint, and prettier all pass. The full npm test suite was run in the real VS Code test host (1.141.0): 61 passing, 12 failing — those 12 failures are pre-existing environment issues, verified identical on the pristine tree (the sandbox blocks network downloads some tests depend on), and are unrelated to this change. Both new tests in src/test/suite/LoggingService.test.ts pass, verified against the exact output sample from the issue.

@sripal2013

Copy link
Copy Markdown
Author

Hi team — bumping this one, open since Oct 7 with all checks passing. It strips ANSI escape codes from syntax-error output in the Output panel (which doesn't interpret them). Let me know if any changes are needed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output channel displays raw ANSI escape codes for syntax errors in v12.x

1 participant