-
Notifications
You must be signed in to change notification settings - Fork 128
upstream merge for vscode python v2025.2.0
#6722
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
Changes from all commits
8f53385
8445722
cf45035
7fd7432
00e6509
27da9c2
9222682
1ed0ddb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,8 +120,12 @@ def normalize_lines(selection): | |
|
|
||
| # Insert a newline between each top-level statement, and append a newline to the selection. | ||
| source = "\n".join(statements) + "\n" | ||
| # If selection ends with trailing dictionary or list, remove last unnecessary newline. | ||
| if selection[-2] == "}" or selection[-2] == "]": | ||
| source = source[:-1] | ||
| # If the selection contains trailing return dictionary, insert newline to trigger execute. | ||
| if check_end_with_return_dict(selection): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use this code so should double-check how this affects Cmd+Enter for lines like
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just checked this out 👀 it looks like it will insert a newline in the script and in the console, but will still execute as expected. Screen.Recording.2025-03-12.at.12.43.47.PM.mov |
||
| source = source + "\n" | ||
| except Exception: | ||
| # If there's a problem when parsing statements, | ||
| # append a blank line to end the block and send it as-is. | ||
|
|
@@ -134,6 +138,11 @@ def normalize_lines(selection): | |
| min_key = None | ||
|
|
||
|
|
||
| def check_end_with_return_dict(code): | ||
| stripped_code = code.strip() | ||
| return stripped_code.endswith("}") and "return {" in stripped_code.strip() | ||
|
|
||
|
|
||
| def check_exact_exist(top_level_nodes, start_line, end_line): | ||
| return [ | ||
| node | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a major upgrade and psutil includes platform-specific binaries, we should double-check that this doesn't cause any platform-specific build issues after we've merged.