-
Notifications
You must be signed in to change notification settings - Fork 67
Debug console: \n
not shown as new line (NumPy ndarray)
#1432
Comments
This happens for any object that has But this is a VSCode bug . When we send the variable value back, it's a JSON string literal, and class Foo(object):
def __repr__(self):
return 'foo\tbar\nbaz\fblah'
foo = Foo() produces this in the log: {
"name": "foo",
"value": "foo\tbar\nbaz\fbah",
"type": "Foo",
"evaluateName": "foo",
"variablesReference": 7
}, which is correct, but it is then rendered like so in Variables: Given the difference in treatment, this is likely intentional. |
cc @isidorn |
Yeah this is intentional, we use \n and \t in the variables view to save on space. If you think this is wrong please file a new feature request against vscode and argue for your case. Thanks |
@isidorn the issue happens in the debug console, not in the variables view (it makes sense in the variables view for me as the space is really limited but seems strange in the debug console where the user is evaluating probably because he couldn't see very well in the variables view). The issue was already reported to VSCode (microsoft/vscode#73845) and was moved here because it was marked as |
Thank you all! |
@isidorn @yzhang-gh @int19h The issue on vscode (microsoft/vscode#73845) was closed as out of scope and was refered back to this extension. Could you reopen this bug as a consequence? The current state makes the debug console unusable for any multiline strings (such as tabluar data). I see the space optimization point for the Variables view, but the console should use the horizontal space it has available (like any other terminal). To give you an example, I'm trying to make sense of this "table". |
Well, as it stands, the only way I can see here would be not returning a -- note that right now the workaround is doing the print yourself: i.e.: Instead of doing:
you can do:
the downside is that it won't be expandable/collapsible, but without the change in microsoft/vscode#73845, the extension is powerless to decide how it wants |
We need changes from VSCode to fix this properly, and we'll ask for them. But until then, it still manifests as a product bug in the debugger, so we'll track that here. |
Upstream issue: microsoft/vscode#89114 |
@luabud This is now solved upstream: microsoft/vscode#73845 (comment) |
@yzhang-gh commented on Fri May 17 2019
Copied from microsoft/vscode#73845
Environment data
Expected behaviour
When evaluating a NumPy ndarray in the debug console, the
\n
should become a new line.Actual behaviour
Steps to reproduce:
import numpy as np
np.random.rand(5, 5)
The text was updated successfully, but these errors were encountered: