microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.4k stars 28.95k forks source link

debug console cannot support ansi color #230880

Open monster5475 opened 5 days ago

monster5475 commented 5 days ago

Type: Bug

when i print log in debug console

ansi color code can not print right.

like this

2024-10-09T16:03:41+08:00 [INFO] [file:router.go:37] Start app at 0.0.0.0:9898

VS Code version: Code 1.94.1 (e10f2369d0d9614a452462f2e01cdc4aa9486296, 2024-10-05T05:44:32.189Z) OS version: Windows_NT x64 10.0.22631 Modes:

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 2304)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off| |Load (avg)|undefined| |Memory (System)|15.76GB (5.81GB free)| |Process Argv|--crash-reporter-id c1ca331d-7a81-46bc-91d4-e3705fc08303| |Screen Reader|no| |VM|0%|
Extensions (70) Extension|Author (truncated)|Version ---|---|--- simple-react-snippets|bur|1.2.8 npm-intellisense|chr|1.4.5 vscode-eslint|dba|3.0.10 es7-react-js-snippets|dsz|4.4.3 gitlens|eam|15.6.0 EditorConfig|Edi|0.16.4 prettier-vscode|esb|11.0.0 go|gol|0.42.1 vue-snippets|hol|1.0.4 vscode-react-typescript|inf|1.3.1 vscode-leetcode|Lee|0.18.4 vscode-fix-checksums|leh|1.1.0 git-graph|mhu|1.30.0 vscode-fileheader|mik|0.0.2 prettify-json|moh|0.0.3 vscode-docker|ms-|1.29.3 vscode-language-pack-zh-hans|MS-|1.94.2024100209 autopep8|ms-|2024.0.0 debugpy|ms-|2024.10.0 isort|ms-|2023.10.1 python|ms-|2024.16.0 vscode-pylance|ms-|2024.10.1 jupyter|ms-|2024.9.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.19 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.388.0 remote-ssh|ms-|0.115.0 remote-ssh-edit|ms-|0.87.0 remote-wsl|ms-|0.88.4 vscode-remote-extensionpack|ms-|0.25.0 makefile-tools|ms-|0.11.13 remote-explorer|ms-|0.4.3 remote-server|ms-|1.5.2 autodocstring|njp|0.6.1 material-icon-theme|PKi|5.11.1 fabric8-analytics|red|0.9.5 java|red|1.35.1 vscode-xml|red|0.27.1 vscode-yaml|red|1.15.0 vscode-sort-json|ric|1.20.0 synthwave-vscode|Rob|0.1.15 rust-analyzer|rus|0.3.2137 vue-vscode-snippets|sdr|3.1.1 vue-helper|she|4.2.8 srd-copilot-vscode|srd|1.3.6 code-spell-checker|str|3.0.1 even-better-toml|tam|0.19.2 shellcheck|tim|0.37.1 pdf|tom|1.2.2 vscode-lldb|vad|1.11.0 intellicode-api-usage-examples|Vis|0.2.8 vscodeintellicode|Vis|1.3.1 vscode-boot-dev-pack|vmw|0.2.1 vscode-gradle|vsc|3.16.4 vscode-java-debug|vsc|0.58.0 vscode-java-dependency|vsc|0.24.0 vscode-java-pack|vsc|0.29.0 vscode-java-test|vsc|0.42.0 vscode-lombok|vsc|1.1.1 vscode-maven|vsc|0.44.0 vscode-spring-initializr|vsc|0.11.2 vscode-icons|vsc|12.9.0 volar|Vue|2.1.6 vscode-todo-highlight|way|1.0.5 JavaScriptSnippets|xab|1.8.0 ReactSnippets|xab|2.4.0 markdown-all-in-one|yzh|3.6.2 material-theme|zhu|3.17.5 (2 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 vscrpc:30673769 a9j8j154:30646983 962ge761:30959799 f8hc8238:30694864 pythongtdpath:30769146 pythonnoceb:30805159 asynctok:30898717 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 0ee40948:31013168 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 2f103344:31071589 impr_priority:31102340 nativerepl2:31139839 refactort:31108082 pythonrstrctxt:31112756 flighttreat:31134774 wkspc-onlycs-t:31132770 wkspc-ranged-t:31151552 cf971741:31144450 autoexpandse:31146404 notype1cf:31151524 5fd0e150:31146321 ```
xmedeko commented 11 hours ago

Unfortunately, similar request have been refused, e.g. see #571 or #186963.

I please VS Code devs, consider some switch in the settings like "Debug console interprets escape characters"

starball5 commented 10 hours ago

Related on Stack Overflow: How to display ANSI colors in VSCode debug console?

xmedeko commented 10 hours ago

Workaround From https://stackoverflow.com/a/44186259/254109 is to add to the launch configuration:

            "internalConsoleOptions": "neverOpen",
            "console": "integratedTerminal"

(The colored output goes to the terminal, but it still goes uncolored to the Debug Console, too, VS Code 1.94).

adventureisyou commented 4 hours ago

This was fixed in 1.94.2 here: https://github.com/Microsoft/vscode/issues/230441