question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Truncate and copy large values from the debug console

See original GitHub issue

In 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.

image

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.

cc @isidorn @weinand @roblourens

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:7
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
connor4312commented, Sep 15, 2021

@Azim-Palmer you can run copy(serialisedResults) to copy the untruncated value to your clipboard

1reaction
eamodiocommented, Oct 23, 2020

While 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developer Console suddenly truncating System.Debug output
This truncation applies to all string values in the Execution Log panel and to SOQL queries in the Source panel. You can view...
Read more >
Copying variable contents to clipboard while debugging in ...
Copying variable FULL VALUE (not truncated) to clipboard while debugging even for very long values and other additional strategies.
Read more >
Large strings get truncated when displayed in debug output or ...
P.S. If I try to copy the value from the variables pane, then paste that, the result is truncated in the same way...
Read more >
Eclipse debugging: truncated String values
With String variables, the default Eclipse configuration is to truncate big Strings after 10000 characters. This can be a problem with long ......
Read more >
How to copy long string variable value ... - Google Groups
String gets truncated and can't find a way to extract it ... Neither watches, scope variables panel or console did the trick. ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found