You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
View and copy toString() of objects in the VARIABLES and WATCH windows #1264
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?
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.
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.
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:
Workaround: in the Debug Console or WATCH panel add an explicit expression:
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!
Activity
nickzhums commentedon Nov 26, 2023
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?
testforstephen commentedon Nov 27, 2023
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.
crowmagnumb commentedon Nov 27, 2023
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 Valueso 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.
github-actions commentedon Nov 4, 2025
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:Workaround: in the Debug Console or WATCH panel add an explicit expression:
and then copy the result from the console output.
Follow the open feature request tracking adding a setting to show
toString()in the Variables/Watch windows:• Issue vscode-java-installer v0.2.2 error #315 – Show toString() values in variables windows
Show toString() values in variables windows vscode-java-debug#315
Labels
[enhancement, duplicate]
duplicateUrls
["https://github.com/microsoft/vscode-java-debug/issues/315"]
Other references with low confidence
toString()in hover tooltips instead of expanding the tree.Show toString() values in hover tooltips vscode-java-debug#364
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!