posit-dev / posit-dev/positron
Python: Cursor skips to end of function after an empty line
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 206
Description
System details:
Positron and OS details:
Positron Version: 2025.03.0 build 116
Code - OSS Version: 1.96.0
Commit: 7f0f93873e8b24c9f393bb3586724f4783c5e72c
Date: 2025-03-01T18:48:08.166Z
Electron: 32.2.6
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Linux x64 6.8.0-57-generic
Interpreter details:
Python 3.10.12
Describe the issue:
Inside an if-statement in a Py script, empty lines will lead the cursor to jump to the end of the if-statement when doing ctrl + enter repeatedly. Instead the next code line within the if-statement should be executed. This might be a bit similar to what has been discussed with R-related cursor issues (cf. e.g. #1416, #1259, #1259)
Steps to reproduce the issue:
Here's a demo script:
if __name__ == "__main__":
print("hello")
print("it's me")
print("I would like to say more")
print("But the cursors skips to the end of the function")
print("So I can't say what I want to say")
print("I always jump to the end")
For example, placing the cursor on the line print("hello") and then repeatedly pressing ctrl + enter leads to the following output:
>>> print("hello")
hello
>>> print("it's me")
it's me
>>> print("I always jump to the end")
I always jump to the end
Expected or desired behavior:
The output should be (and this behavior is followed if the print-statements are not in an if-block):
>>> print("hello")
hello
>>> print("it's me")
it's me
>>> print("I would like to say more")
I would like to say more
>>> print("But the cursors skips to the end of the function")
But the cursors skips to the end of the function
>>> print("So I can't say what I want to say")
So I can't say what I want to say
>>> print("I always jump to the end")
I always jump to the end
Were there any error messages in the UI, Output panel, or Developer Tools console?
No errors but I'm not sure this debug messgae is related:
DEBUG Comments: URIs of continue on comments to add to storage .
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No implementation file or test is named in the issue. Start by reproducing the behavior in the provided Python script with repeated Ctrl+Enter, then trace the Positron command that executes the current Python statement and advances the cursor. Done means blank lines inside the if-block no longer cause execution to jump to the block's final statement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100