-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unnecessary truncation #1084
Comments
I think there is a |
The problem is that the debugger gets no clue from the client as to the size the output can fit. The best that we can do is to not trim anything if the output is REPL (which is the only bit of context that we do have). But then if you accidentally eval something that has a multi-megabyte repr(), you'll have to wait for it to finish printing, which is much worse. I don't think we have any knobs exposed to adjust this, unfortunately. You can look at pydevd_safe_repr.py in to see the limits and tweak them in your local install. A proper fix would require DAP changes - e.g. |
@int19h, @fabioz, @rchiodo From my side, vscode debugger is a very unpleasant place and as time goes by, I can see why (there is even a little rhyme in this sentence 😁). I briefly looked in the https://github.com/microsoft/debugpy/blob/main/src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py and as I understand I should change values for Another question is... why you don't use something like rich's print ( What is wrong with rich.print()? But than again... ...you really messed it up. Anyway, PyCharm has a solution for this problem from the very beginning: ... not beautiful as rich.print() but much better than vscode. |
Can you please provide an update? |
You would set the limits in your local pydevd_safe_repr.py to whatever limit you want. Something like say 300 |
Related Stack Overflow question: Is there any way to get the output in debug mode, not to be truncated? |
Can you please provide an update for this issue? |
This is unlikely to change in the current major debugpy release (1.x). But we're in the process of doing a major rewrite for the debugger, and as part of that, I would like to update this logic and make it more configurable. In principle, this could include customizing which function gets called in lieu of |
Hi @int19h, I opened this issue regarding problems with regular print and truncation. Regards. |
In your original repro, truncation happens for cases where you do not use So, the original issue is specifically about "safe repr". We cannot just ditch that for reasons described earlier, but we can make that customizable, and improve the implementation to be saner wrt what gets truncated with Similarly,
So even if debugpy could determine the actual width of debug console somehow, the best we could do here is special-case Pandas by detecting when it gets loaded, and if |
Hi Pavel (@int19h). You see how it goes. |
consider changing the width property in pandas to |
If you look at the picture:
In debug console, I have created a dictionary with long keys.
If I execute
dct
directly, keys are truncated with "..." in the middle.If I print it, all keys are visible (it is funny that both lines are of the same width, isn't it?).
Last print is just to show you how much horizontal space I have.
Please don't truncate something that can fit in the debug console.
Try to wisely use whole horizontal and vertical space as much as you can.
Extension version: 2022.16.0
VS Code version: Code 1.72.1 (129500ee4c8ab7263461ffe327268ba56b9f210d, 2022-10-10T17:22:48.346Z)
OS version: Windows_NT x64 10.0.19042
Modes:
Sandboxed: No
Remote OS version: Linux x64 3.10.0-1127.el7.x86_64
Remote OS version: Linux x64 3.10.0-1127.el7.x86_64
The text was updated successfully, but these errors were encountered: