-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SmartSend removes empty lines with triple-quoted strings #23743
Comments
@cbrnr Hello! Thank you for filing the issue. I believe this is expected behavior as we "normalize" white spaces to send to terminal and REPL. I think you should be able to repro this even when you turn off smart send, if I recall correctly. |
Yes, I can reproduce the behavior also when SmartSend is off. However, I do not think that this is expected behavior. Executing a command should not modify ("normalize") the contents of a string, which is what is happening here. So to me, this is clearly a bug. |
I would tend to agree with @cbrnr here: if I send something to the REPL, it should not get modified. If I intended to print this string, suddenly some intentionally empty lines would be gone -- surely this cannot be right! |
Thank you all for your feedback. Let me bring this up the team. |
Good news folks. Managed to get this in August plan, so I will be investigating how to best handle this normalization of command when we send it to either terminal REPL or native REPL! |
Amazing, thanks @anthonykim1! |
Hi folks! Just merged in the PR for this, that being said it should be available starting tomorrow's(August 21st) pre-release of the Python extension. Give this a try via running shift+enter on your multi line string or even an assignment to the multi-line string. Thank you all :) |
Verification steps:
|
…24096) Reverts microsoft#23977 Have to revert microsoft#23977 with issue: microsoft#23743 due to microsoft#24069 Will revisit why microsoft#23743 is breaking if contained inside other top level (in ast term) code block, and look into how to support microsoft#23743 without breaking.
…24096) Reverts microsoft#23977 Have to revert microsoft#23977 with issue: microsoft#23743 due to microsoft#24069 Will revisit why microsoft#23743 is breaking if contained inside other top level (in ast term) code block, and look into how to support microsoft#23743 without breaking.
Resolves: microsoft#23743 It seems that when people have a multi line string such surrounded by """ quotes, the white spacing inside the quote is very much intentional, and so if we detect that they are in such code-block, we would rather not normalize/truncate the white spaces for that specific code block.
…24096) Reverts microsoft#23977 Have to revert microsoft#23977 with issue: microsoft#23743 due to microsoft#24069 Will revisit why microsoft#23743 is breaking if contained inside other top level (in ast term) code block, and look into how to support microsoft#23743 without breaking.
Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off. Happy Coding! |
Type: Bug
Behaviour
SmartSend on a triple-quoted string containing empty lines (i.e. two or more subsequent
\n
) removes empty lines on execution.Steps to reproduce:
The result is:
'Hello\nWorld\nHow are you?'
The expected result is:
'Hello\n\nWorld\n\n\n\n\nHow are you?'
Diagnostic data
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Extension version: 2024.9.2024062703
VS Code version: Code 1.91.0 (ea1445cc7016315d0f5728f8e8b12a45dc0a7286, 2024-07-01T18:53:23.353Z)
OS version: Darwin arm64 23.5.0
Modes:
The text was updated successfully, but these errors were encountered: