vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

Define custom "toString()" in variables view

Open mojo2012 opened this issue 7 years ago • 3 comments

Eclipse has a functioality to setup a custom "toString" method (called "Detail Formatter") on each type in the variables view. This is handy when you have objects that don't come with a nice toSring method. It allows you to directly show the useful information. Example details formatter: getName() + ": " + getBirthDate()

Environment
  • Operating System: macOS 10.12.6 (16G1212)
  • JDK version: 1.8.0_144-b01
  • Visual Studio Code version: 1.20.0 (1.20.0)
  • Java extension version: 0.18.1
  • Java Debugger extension version:0.6.0

detailformatter

mojo2012 avatar Feb 09 '18 07:02 mojo2012

@mojo2012 thank you for reporting this issue. Now the debugger supports expression evaluation. So if you type the body of the formatter in Watch panel, it will evaluate. Can it address the issue?

akaroml avatar Mar 02 '18 03:03 akaroml

That's not the same actually. The "detail formatter" feature is persistent across debug sessions. The expression view can be deleted at any point, losing the "body". Futhermore it would kinda "duplicate" the variable.

mojo2012 avatar Mar 02 '18 07:03 mojo2012

something like this would be amazing: natvis

riccardodebenedictis avatar Mar 29 '18 12:03 riccardodebenedictis