Skip to content

Strings and numbers should have different colored output #1526

Closed

Description

Describe the bug
When I console log a string, I expect it to have a different color from numbers and booleans. They are all the same blue, though. However, if I log an object with those values, they get properly colored.

Note: Not sure if this is a bug or simply an expected feature that has not been implemented.

To Reproduce
Steps to reproduce the behavior:

  1. Run the following in debug mode
console.log(1)
console.log('1')
console.log(true)
console.log(false)
console.log({a: 1, b: '1', c: true, d: false})

You'll see this outout where they are all blue in lines 1 through 4 but properly colored when logged together as an object

Screen Shot 2023-01-20 at 2 02 06 PM

VS Code Version:
Version: 1.74.3 (Universal)
Commit: 97dec172d3256f8ca4bfb2143f3f76b503ca0534
Date: 2023-01-09T17:07:18.579Z
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 21.6.0
Sandboxed: No

Additional context
First raised here: microsoft/vscode#168924 (comment)

Launch config:

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "node",
			"request": "launch",
			"name": "Launch Program",
			"console": "integratedTerminal",
			"skipFiles": [
				"<node_internals>/**"
			],
			"program": "${file}"
		}
	]
}

Activity

  1. added
    bug
    on Jan 20, 2023
  2. connor4312 commented on Jan 23, 2023

    @connor4312
    Member

    Thanks for the report. This is because top level output is given as a string and is not as rich as the full 'variables' we send on the debug protocol for the object. I think the best fix for this is microsoft/debug-adapter-protocol#85, which would let us provide variables for these output lines..

    Requiring the client to make individual variables requests for every log line would fix this issue, but cause performance problems. In fact we go to a deal of effort to avoid this for most log lines, as scripts that log thousands of lines quickly become problematic if each line requires duplicate requests from the client.

    Closing this to merge into that issue

  3. mhkeller commented on Jan 23, 2023

    @mhkeller
    Author

    Got it. Thanks for the info. Is there any idea on when that issue will get put through? I see it's over three years old :( I realize you must have a lot of stuff on your plate though and it's all important. Just curious if there's a roadmap or anything to mark on the calendar to check back in on. Thanks again.

  4. connor4312 commented on Jan 23, 2023

    @connor4312
    Member

    It's not a big priority for me since I've worked around the main ordering and performance problem is js-debug already. But if you feel strongly, I would invite you to start in the discussion in that issue. A reasonable proposal would be to add an optional variable?: Variable property on the output event.

  5. removed
    bug
    on Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions