I have some big object, with a lot of properties, in my VSCode debug watch panel. When I right click on it and select "Copy value"
and then paste it, it does not paste the entire object value, but some of the first properties, and then '...'.
For example, if the object is:
{
"key1": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
"key2": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
"key3": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
"key4": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
"key5": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
"key6": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlc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XhHcjF",
"key3": "LTE1OGQtNDczNi04ZjlkLTQwZDgxODkyMThjOSIsInByZWZlcnJlZF91c2VybmFtZSI6InRlc3QtZ3JhcGhAYW55Y2xpcC5vbm1pY3Jvc29mdC5jb20iLCJyaCI6IjAuQVFzQTc2azRRNmlPbzAyTmVLeFdERDhKQ2d4QTc5Wkh2aXhHcjF",
...
}
How can I copy the full value?
This behaviour is up to the extension that contributes debug support for whatever you are debugging (source). See also this comment by maintainer Isidor Nikolic in Advanced copy variable values in debugger #27950, which outlines how a debug extension maintainer can implement this functionality. Quoting:
Dear Debug extension authors,
Now it is possible to implement advanced copy variable values for your debugger:
Your extension needs to send the capability
supportsClipboardContext
In the evaluate call you should check if the context is 'clipboard', if yes that means the user is triggering the Copy Value command and you can return the result of the "advanced copy" - a fully serialized value of the evaluation Example how @connor4312 has done it for js-debug microsoft/vscode-js-debug@a136ba5
And in the gif above you can see how it works in practice.
Related release notes section is here.
If the debug extension you're using doesn't do that yet, you can ask them politely to to do so, or even better, draft up an implementation and raise a Pull Request.
If the extension is supposed to support it, but it's not working properly, you should search their issue tracker to see if a bug report has already been raised, and if one hasn't yet, raise one yourself. For example, Copy Value in Watch panel copies truncated value with ... for a long/big string.
#175758, which was related to JS debugging (VS Code ships with a builtin JS debugger, vscode-js-debug
).
Or if you're too lazy to talk with maintainers and get things fixed long term (here I make my plea that you choose that path), you can see if your debug extension supports writing expressions in the watch panel, and if your language supports easily stringifying the variable in a format that works for you, you can do that, which is what a lot of people did before VS Code's extension API added the above capability (source).
Here are some related issue tickets for specific debug-support extensions:
In microsoft/vscode-java-debug
: Adopt supportsClipboardContext #819
In microsoft/vscode-cpptools
: Copying a long value from debug watch results in pasting partial value
#5470
In rust-lang/rust-analyzer
: Copying a long value from debug watch results in pasting partial value #15619