Skip to content

View and copy toString() of objects in the VARIABLES and WATCH windows #1264

Closed as not planned

Description

Suggestion

The ability to see the results of at least the toString() of a variable in both the VARIABLES and WATCH sections of the debugger.

Use Cases

I just recently switched to using VSCode for my Java debugging (from Eclipse) and one thing I always did in Eclipse was put a breakpoint to check my SQL out when there was an issue. I have an SQLStatement object that allows you to build an SQL string from constituent parts. It's toString() method produces the SQL to send to the db. So when I want to test that out I put a breakpoint and evaluate the toString(). Usually copying and pasting it into my db command-line i/f for testing and editing. But in VSCode I can´t seem to do that.

I only see the first few characters as can be seen in the screenshot. "SELECT id..." and if I right-click and choose "Copy Value" I get that exact same expression with double-quotes and ellipsis! Can this please just give the full value of the string?

Examples

image

Activity

  1. nickzhums commented on Nov 26, 2023

    @nickzhums
    Member

    Thanks for reporting this! Jinbo Wang (@testforstephen) could you please take a look at this one, do we automatically omit the value of the variable?

  2. testforstephen commented on Nov 27, 2023

    @testforstephen
    Contributor

    Ken Southerland (@crowmagnumb) Have you changed the user setting "java.debug.settings.maxStringLength"? If so, you can change it to "java.debug.settings.maxStringLength": 0, that will show the full text.

    Also I see a room to improve this case. No matter what value is set in the maxStringLength, it should return the full text if users want to copy the variable value.

  3. crowmagnumb commented on Nov 27, 2023

    @crowmagnumb
    Author

    Jinbo Wang (@testforstephen) Thank you! I was looking for some setting like that but couldn't find it. That is a great improvement but a couple of things. One, it gives me the quotes when I say Copy Value so I have to go to the front and the end of the copied text to delete them before sending it to my SQL server, which is a bit annoying. Also it might be nice if it was somewhere persistent on the screen rather than just in the pop-up dialog, move my mouse slightly and it disappears. But that's not the most important, the copying of just the value and not the quoted value would be great!

    And as you said, I think it should give you the whole string when you copy it (without quotes) no matter what your setting for this is.

    But Thank You! This will work for me! Cheers.

  4. github-actions commented on Nov 4, 2025

    @github-actions

    Hi Ken Southerland (@crowmagnumb), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    Current Status

    There is no built-in support yet in the VS Code Java debugger to expand and copy the full toString() of an object directly in the VARIABLES or WATCH views. You can:

    Labels

    [enhancement, duplicate]

    duplicateUrls

    ["https://github.com/microsoft/vscode-java-debug/issues/315"]

    Other references with low confidence

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions