Skip to content

No ANSI colors in Debug Console with VSCode 1.94.0 #5302

Closed

Description

@davidmartos96

Describe the bug
After the 1.94.0 VScode update, colors stopped working in the debug console.
I did a bisect on vscode source code and this seems to be the related change in the protocol: microsoft/vscode#227729
I looks like the extension now needs to opt in into the ANSI colors support.

To Reproduce
Steps to reproduce the behavior:

  1. Run the provided code in the VSCode debug session
void main() {
  print("\u001b[1;31m Red message");
  print("\u001b[1;32m Green message");
  print("\u001b[1;33m Yellow message");
  print("\u001b[1;34m Blue message");
  print("\u001b[1;35m Purple message");
  print("\u001b[1;36m Cyan message");
}

Expected behavior

image

Workspace Environment
Dart Code extension: 3.98.0
Flutter extension: 3.98.0 (activated)

App: Visual Studio Code
App Host: desktop
Version: linux 1.94.0

Workspace type: Dart, Flutter (LSP)
Workspace name: Dart-Code

Dart (3.5.1): /home/david/.puro/shared/caches/c9b9d5780da342eb3f0f5e439a7db06f7d112575/dart-sdk
Flutter (3.24.1): /home/david/.puro/envs/stable/flutter (Chrome (web-javascript/web))

Output from 'dart info'

/home/david/.puro/shared/caches/c9b9d5780da342eb3f0f5e439a7db06f7d112575/dart-sdk/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

Process info

Memory CPU Elapsed time Command line
65 MB 0.0% 32:14 dart devtools --machine --allow-embedding --dtd-uri ws:/jDEHKFOjO15HnGdD
67 MB 0.1% 03:22 dart devtools --machine --allow-embedding --dtd-uri ws:/qeurg9aEmmYHJUMX
616 MB 1.3% 32:14 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.98.0
363 MB 1.4% 03:23 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.98.0
82 MB 0.0% 32:14 dart tooling-daemon --machine
82 MB 0.2% 03:23 dart tooling-daemon --machine
206 MB 0.2% 32:14 flutter_tools.snapshot daemon
202 MB 0.6% 03:23 flutter_tools.snapshot daemon
Output from 'flutter doctor'

/home/david/.puro/envs/stable/flutter/bin/flutter doctor -v

[!] Flutter (Channel stable, 3.24.1, on Fedora Linux 40 (Workstation Edition) 6.10.12-200.fc40.x86_64, locale en_US.UTF-8)
    • Flutter version 3.24.1 on channel stable at /home/david/.puro/envs/stable/flutter
    ! Warning: `flutter` on your path resolves to /home/david/.puro/envs/3.22.3/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /home/david/.puro/envs/stable/flutter. Consider adding /home/david/.puro/envs/stable/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /home/david/.puro/envs/3.22.3/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /home/david/.puro/envs/stable/flutter. Consider adding /home/david/.puro/envs/stable/flutter/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (7 weeks ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/david/Android/Sdk/
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/david/opt/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 18.1.8 (Fedora 18.1.8-1.fc40)
    • cmake version 3.28.2
    • ninja version 1.12.1
    • pkg-config version 2.1.1

[✓] Android Studio (version 2023.2)
    • Android Studio at /home/david/opt/android-studio/
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /home/david/opt/android-studio/
    • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[✓] VS Code (version 1.94.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.98.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Fedora Linux 40 (Workstation Edition) 6.10.12-200.fc40.x86_64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 129.0.6668.89

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. DanTup commented on Oct 7, 2024

    @DanTup
    Member

    Thanks for the debugging - I noticed this myself today. This seems like quite a break to all existing debug adapters that assumed the client supported ansi colors.

    It'll take a while to ship updated capabilities in the SDK, but I'll see if I can fix this with some middleware in the meantime.

  2. added this to the v3.100.0 milestone on Oct 7, 2024
  3. added
    in debuggingRelates to the debug adapter or process of running debug sessions
    on Oct 7, 2024
  4. DanTup commented on Oct 7, 2024

    @DanTup
    Member

    I've pushed a new pre-release version of the extension with a fix for this (v3.99.20241007 - it might take 20mins or so to show up):

    Dart pre-release versions

    I will probably cherry-pick this into a stable release tomorrow because this is also affecting Flutter structured errors and not only apps specifically choosing to print these codes:

    image

  5. modified the milestones: v3.100.0, v3.98.1 on Oct 7, 2024
  6. reopened this on Oct 7, 2024
  7. added a commit that references this issue on Oct 8, 2024
  8. DanTup commented on Oct 8, 2024

    @DanTup
    Member

    This fix was also cherry-picked into v3.98.1 of the Dart extension (which may take 20-30 mins to show up).

  9. Sten435 commented on Oct 8, 2024

    @Sten435

    @DanTup Can the color be an option in the settings ? if i. want to shoz the logs as wite insthead of blue or just provide a hex value...

  10. added a commit that references this issue on Nov 7, 2024
  11. DanTup commented on Nov 14, 2024

    @DanTup
    Member

    @Sten435 sorry, I missed your comment. Being able to disable colours from rendering is probably something that should be done by VS Code. We're forwarding output that may have ansii colour codes (eg. from Flutter) and we should tell the client about this. If you don't want colours, it should be done by not rendering them, rather than rendering the ascii escape sequences literally.

    (there may already be an option in VS Code to control this, though I couldn't see one)

  12. stan-at-work commented on Feb 5, 2025

    @stan-at-work

    @Sten435 sorry, I missed your comment. Being able to disable colours from rendering is probably something that should be done by VS Code. We're forwarding output that may have ansii colour codes (eg. from Flutter) and we should tell the client about this. If you don't want colours, it should be done by not rendering them, rather than rendering the ascii escape sequences literally.

    (there may already be an option in VS Code to control this, though I couldn't see one)

    Any update on how to do this?

    Like to show the flutter in white instead of that (ugly) blue color :-)

  13. DanTup commented on Feb 5, 2025

    @DanTup
    Member

    @stan-at-work it appears you can customise the debug console colors with workbench.colorCustomizations:

    Image

    "workbench.colorCustomizations": {
    	"debugConsole.errorForeground": "#0000ff",
    	"debugConsole.infoForeground": "#00ff00",
    	"debugConsole.sourceForeground": "#ffdd00",
    	"debugConsole.warningForeground": "#ff00dd",
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions