Truncate and copy large values from the debug console
See original GitHub issueIn js-debug, we truncate large data inside the debug adapter before giving back to the UI. However, this means that if the user logs a very large string, they have no way to view it. The Chrome devtools solve this by adding a “copy” and “show all” button to very large strings.
We don’t currently have a way to show buttons in the output. I believe the just having a “copy” button in the UI is sufficient. An approach for this is to use the evaluateName
in the output’s variablesReference
with an evaluate
call, in the clipboard
context if supported. It’s notable that the UI can use this even for values that aren’t truncated to allow the user to copy complex expressions.
The question of who does the truncation is orthogonal to the ability to copy. If the debug adapter continues to do the truncation, then it should have a DAP flag to hint to the UI that the value can be expanded (using the presence of an evaluateName
alone would prevent thatgeneralized copy functionality).
If the UI does the truncation, it means more traffic over the protocol, and it might also be tricky to figure out how to show a truncated state for complex objects. But then the UI can also implement “show all” without any debug adapter changes. Overall I think UI-side truncation is preferable.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:7 (5 by maintainers)
Top GitHub Comments
@Azim-Palmer you can run
copy(serialisedResults)
to copy the untruncated value to your clipboardWhile that could be happen, the truncation today is no where close to that level – I feel like there is a lot of ground between today’s truncation and hundreds/thousands of MBs