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

Dynamic Smart Cursor Movement #21838

Closed
anthonykim1 opened this issue Aug 18, 2023 · 0 comments
Closed

Dynamic Smart Cursor Movement #21838

anthonykim1 opened this issue Aug 18, 2023 · 0 comments
Assignees
Labels
feature-request Request for new features or functionality on-testplan Added to test plan triage-needed Needs assignment to the proper sub-team
Milestone

Comments

@anthonykim1
Copy link

User should be able to shift+enter with smart shift+enter feature #21779, and the cursor should dynamically and smartly move from one top block to another to provide the most smooth experience.

@anthonykim1 anthonykim1 added the feature-request Request for new features or functionality label Aug 18, 2023
@anthonykim1 anthonykim1 added this to the August 2023 milestone Aug 18, 2023
@anthonykim1 anthonykim1 self-assigned this Aug 18, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Aug 18, 2023
anthonykim1 added a commit that referenced this issue Oct 10, 2023
There are two Feature Requests from: #18105 #21838 
They are grouped together to provide the smoothest experience: when user
wants to press shift+enter and smoothly move between each executable
Python code block without having to manually move their cursor.

#19955 (For Execute line/selection and advance to next line, referred to
as dynamic smart cursor hereby)
Open Issue: #21778 #21838

Steps in implementing REPL Smart Send (smart shift+enter to the REPL)
and dynamic cursor move aka. Move to Next Line (next executable line of
code to be more precise):

1. Figure out the workflow of where things start and run when user
clicks on run selection/line
2. Send the content of selection & document to the Python Side from
Typescript side.
3. Respect and follow previous logic/code for EXPLICIT selection (user
has highlighting particular text they want to send to REPL), but
otherwise, use newly created smart send code.
4. Receive content of document & selection in Python Side
5. Use AST (From Python standard library) to figure out if selection if
selection is part of, for example, dictionary, but look for nodes and
how each relates to the top level. If some selection is, for example
part of a dictionary, we should run the whole dictionary. Look at how to
do this for all top level, so that we run the Minimum Viable Block
possible. (For example, if user selects part of a dictionary to run in
REPL, it will select and send only the dictionary not the whole class or
file, etc)
6. Receive the commands to run in typescript side and send it to the
REPL
7. After the user has ran shift+enter(non highlight, meaning there was
no explicit highlight of text), thus the incurring of smart send, and we
have processed the smart selection, figure out the "next" executable
line of code in the currently opened Python file.
8. After figuring out the "next" line number, we will move user's cursor
to that line number.

- [x] Additional scope for telemetry EventName.EXECUTION_CODE with the
scope of 'line' in addition to differentiate the explicit selection
usage compared to line or executable block.
- [x] Drop 3.7 support before merging since end_line attribute of the
AST module is only supported for Python version 3.8 and above.
-  [x] Python tests for both smart selection, dynamic cursor move.
-  [x] TypeScript tests for smart selection, dynamic cursor move.

Notes: 
* To be shipped after dropping Python3.7 support, since end_lineno,
which is critical in smart shift+enter logic, is only for Python version
GREATER than 3.7 Update (9/14/23: Python 3.7 support is dropped from the
VS Code Python extension: #21962)
* Code in regards to this feature(s) should be wrapped in standard
experiment (not setting based experiment)
* Respective Telemetry should also be attached
* EXPLICIT (highlight) selection of the text, and shift+enter/run
selection should respect user's selection and send AS IT IS. (When the
user selects/highlight specifically what they want to send, we should
respect user's selection and send the selection as they are selected)
* Smart Shift+Enter should be shipped together with dynamic smart cursor
movement for smoothest experience.
This way user could shift+enter line by line (or more accurately top
block after another top block) as they shift+enter their code.
* Be careful with line_no usage between vscode and python as vscode
counts line number starting from 0 and python ast start as normal
(starts from line 1)) So vscode_lineno + 1 = python_ast_lineno

---------

Co-authored-by: Karthik Nadig <[email protected]>
@anthonykim1 anthonykim1 added the on-testplan Added to test plan label Oct 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-testplan Added to test plan triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

1 participant