Debug output and watches don't use custom repr()/str() for long strings? #1204
Replies: 8 comments 1 reply
-
@karthiknadig, I assume because you moved this here the truncated form is happening in debugpy or pydevd, and it's not VS Code that is deciding that the string is too long and asking for a shorter representation? |
Beta Was this translation helpful? Give feedback.
-
That is correct, |
Beta Was this translation helpful? Give feedback.
-
This limit applies to the inner string, in the above case, the |
Beta Was this translation helpful? Give feedback.
-
And we need to do this to avoid accidentally sending a multi-megabyte string over DAP, even if the client ultimately truncates it. We could up the limits, though. |
Beta Was this translation helpful? Give feedback.
-
Hi, did you close this because you did in fact change the limit? Or were you waiting for a reaction? I think it would make sense to increase the limit - ideally it could be set by the user (as a setting in vscode - and maybe a CLI flag for debugpy) but that's likely much more work. Since it looks like you're already setting the outer string length limit (which would avoid excessive bandwidth use), it should be fine with increasing the inner limit?
Ps: for my own curiosity, what's DAP? Nothing on wikipedia's disambiguation page seems to fit :-) |
Beta Was this translation helpful? Give feedback.
-
@ldorigo https://microsoft.github.io/debug-adapter-protocol/specification |
Beta Was this translation helpful? Give feedback.
-
Yes, we need more feedback on the limits first. Keep in mind that making them longer means that reprs for some deeply nested structures might become less readable, so we need to find the right balance. You can directly edit the file that Karthik mentioned earlier in your installation of vscode-python (look under In the meantime, perhaps we could change the hardcoded values to |
Beta Was this translation helpful? Give feedback.
-
My It turned out that my |
Beta Was this translation helpful? Give feedback.
-
Issue Type: Bug
Hi, consider this small snippet:
If I add
test_works
to watches or evaluate it in the debug console, it correctly uses the repr() I provide. However after some arbitrary string length, it reverts to showing<Test, len() = 3>
- which I don't want. I tried looking for a setting to change the value at which this change happens but couldn't find any. This is quite annoying when debugging as I need to continuously focus the output window and typeprint(test_doesntwork)
to be able to see what's in it.Extension version: 2022.0.1786462952
VS Code version: Code 1.64.0 (5554b12acf27056905806867f251c859323ff7e9, 2022-02-03T04:23:11.224Z)
OS version: Linux x64 5.15.19-1-lts
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Beta Was this translation helpful? Give feedback.
All reactions