Skip to content
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

Do not truncate whitespace for multi-line string #23977

Merged
merged 8 commits into from
Aug 20, 2024

Conversation

anthonykim1
Copy link

@anthonykim1 anthonykim1 commented Aug 20, 2024

Resolves: #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.

@anthonykim1 anthonykim1 added feature-request Request for new features or functionality area-repl labels Aug 20, 2024
@anthonykim1 anthonykim1 self-assigned this Aug 20, 2024
@anthonykim1 anthonykim1 changed the title Do not truncate white space for multi-line string Do not truncate whitespace for multi-line string Aug 20, 2024
@anthonykim1 anthonykim1 marked this pull request as ready for review August 20, 2024 20:33
@vs-code-engineering vs-code-engineering bot added this to the August 2024 milestone Aug 20, 2024
@anthonykim1 anthonykim1 merged commit e751377 into microsoft:main Aug 20, 2024
40 checks passed
@edeane
Copy link

edeane commented Sep 9, 2024

Does this break sending the code to the python terminal with shfit+enter when there are doc strings in the function because it sends the function in 2 different lines?

In [1]: def foo(a):
   ...:     """
   ...:     foo return a
   ...:     """
   ...: 
In [2]:     return a
  Cell In[2], line 1
    return a
    ^
SyntaxError: 'return' outside function

@Tyriar
Copy link
Member

Tyriar commented Sep 9, 2024

@anthonykim1 good case for a unit test regardless of whether it breaks that case or not 👆

@anthonykim1
Copy link
Author

I think this might actually be a breaking scenario - @edeane ref: #24069

anthonykim1 added a commit that referenced this pull request Sep 11, 2024
anthonykim1 added a commit that referenced this pull request Sep 11, 2024
Reverts #23977

Have to revert #23977
with issue: #23743 due
to #24069

Will revisit why #23743
is breaking if contained inside other top level (in ast term) code
block, and look into how to support
#23743 without
breaking.
anthonykim1 added a commit to anthonykim1/vscode-python that referenced this pull request Sep 11, 2024
…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.
anthonykim1 added a commit to anthonykim1/vscode-python that referenced this pull request Sep 12, 2024
…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.
anthonykim1 added a commit that referenced this pull request Sep 12, 2024
…24099)

Reverts #23977

Have to revert #23977
with issue: #23743 due
to #24069

Will revisit why #23743
is breaking if contained inside other top level (in ast term) code
block, and look into how to support
#23743 without
breaking.
anthonykim1 added a commit to anthonykim1/vscode-python that referenced this pull request Sep 13, 2024
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.
anthonykim1 added a commit to anthonykim1/vscode-python that referenced this pull request Sep 13, 2024
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-repl feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SmartSend removes empty lines with triple-quoted strings
3 participants