-
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
Shift-enter should not move cursor to end of line #23079
Comments
Hello, @arencambre. Thanks for the call out! This behavior of the Python extension smartly selecting the minimum amount of executable code, and advancing the cursor to the next executable statement is from the If you wish to turn off this behavior and get your desired cursor staying at the same position, you may go to settings and type Alternative solution to have the best of the both world would be you explicitly selecting/highlighting the chunk of code that you wish to run, this would cause Python extension to execute what you have selected, and will not do anything to move around your cursor. When you do not highlight any chunk of code and shift+enter, you will still be able to use the smart send behavior! Let me know if you need some other help |
This is fine, and I love it! The current behavior is the cursor advances to right after the next executable statement, at the end of that statement's line. For lines that are wider than the viewport, I am scrolled right until the entire statement shows, which obscures the beginning of the statement. It is the beginning of the statement that is most impactful to me, so that is what I prefer to see, not the end. Also, if I shift-enter, the cursor is placed at the end of a very long line, then I shift-enter again, and the next line is short enough to fit in the viewport, the horizontal viewport isn't scrolled all the way to the left, so even a portion of that short line is obscured. I think a sensible default is the cursor is advances to the beginning of the line that has the next executable statement. This shows me what is usually the most important part of a line of code, plus I avoid the horizonal position jumping around as I shift-enter through lines of code. |
Glad you are enjoying the feature!! Thank you :)
This can be subjective in a way, but ever since Considering folks will shift+enter as they incrementally write their code throughout the Python file, and have a formatter with around 100 character length, placing the cursor to the end made sense as it seemed more intuitive and gave the sense that they are ready to execute on that line without further changes. I will still bring this up to the team though. |
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue. |
Type: Bug
Behaviour
Expected vs. Actual
Expected behavior is after I press shift-enter to run a line of code (thank you for improving this in #13495!), either of these happen:
What actually happens is the cursor is jumped to the very end of the line. I am often having to scroll left to recall what the line is about.
Steps to reproduce:
Diagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2024.2.1
VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z)
OS version: Windows_NT x64 10.0.22631
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: