Skip to content

repl: Change default run actions to run line and add four run related actions#46868

Open
gepcel wants to merge 8 commits intozed-industries:mainfrom
gepcel:split-repl-run
Open

repl: Change default run actions to run line and add four run related actions#46868
gepcel wants to merge 8 commits intozed-industries:mainfrom
gepcel:split-repl-run

Conversation

@gepcel
Copy link

@gepcel gepcel commented Jan 15, 2026

edited in 2026-02-02:

Should be able to close #46594, #19031, #16961

This pr changes the default behavior of two already existed actions: Run and Run in place to run lines. And add four other actions: Run cell and Run cell in palce to run cells, Run above to run cells above, Run all to run all cells.

  • repl: run
  • repl: run in place
  • repl: run cell
  • repl: run cell in place
  • repl: run all
  • repl: run above

Previous this pr there were two actions in repl: Run (included in repl menu, as shown in the following pic) and RunInPlace (not included in repl menu). When there are no cells (as of no # %% mark in python script file), these actions run current line or selected lines. When there are cells in file, these actions run current cell or selected cells, therefore no way to execute line inside a cell.

image

Release Notes:

  • Fixed that default run actions of repl to run lines.
  • Added 4 actions RunCell , RunCellInPlace, RunAbove and RunAll.

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @gepcel on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jan 15, 2026
@gepcel
Copy link
Author

gepcel commented Jan 15, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jan 15, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title Change default run actions to run line and add two actions to run cell repl: Change default run actions to run line and add two actions to run cell Jan 15, 2026
@zed-industries-bot
Copy link
Contributor

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 6b77eff

@gepcel
Copy link
Author

gepcel commented Jan 19, 2026

@rgbkrk Would you mind take a look at this, and see if it's appropriate.

I've built and tested locally.

@gepcel gepcel changed the title repl: Change default run actions to run line and add two actions to run cell repl: Change default run actions to run line and add four actions to run cell Jan 22, 2026
@gepcel gepcel changed the title repl: Change default run actions to run line and add four actions to run cell repl: Change default run actions to run line and add four run related actions Jan 22, 2026
@rgbkrk
Copy link
Collaborator

rgbkrk commented Jan 22, 2026

At the very least, I like the change in naming if someone is "in" a cell, on a line, or selecting contents. I don't want to overload the menu with too many options though so I prefer to make it more context dependent. Now... actions wise it probably makes sense to have multiple, just not all shown in one menu.

@gepcel
Copy link
Author

gepcel commented Jan 22, 2026

I'm not sure I followed. By saying "the menu", you mean the repl_menu.rs menu, or the "command palette" menu? If you mean the "repl_menu.rs" menu, any actions you prefer to be added to the menu? If you mean the "command palette", which actions you prefer to be dropped?

And I'd like your opinion on another thing. If cursor on line 2 of the following example, when execute the run cell action, would you prefer (1) run nothing, or (2) run "from line 1 to line 3" as one cell? Personally I'd like (2).

[1]  import numpy as np
[2]  a = 3
[3]  
[4]  # %%
[5]  print(a)  # cursor here

@gepcel
Copy link
Author

gepcel commented Jan 28, 2026

Close this due to not clear what to do next.

@gepcel gepcel closed this Jan 28, 2026
@rgbkrk
Copy link
Collaborator

rgbkrk commented Jan 28, 2026

By saying "the menu", you mean the repl_menu.rs menu, or the "command palette" menu? If you mean the "repl_menu.rs" menu, any actions you prefer to be added to the menu? If you mean the "command palette", which actions you prefer to be dropped?

I'm talking the visual repl menu.

If cursor on line 2 of the following example, when execute the run cell action, would you prefer (1) run nothing, or (2) run "from line 1 to line 3" as one cell? Personally I'd like (2).

I'd prefer (2) as well.

@gepcel
Copy link
Author

gepcel commented Jan 28, 2026

About the "repl menu" menu, previously there's only one item about run action, in this pr, I did nothing to it, so there is now still only one item.

I don't want to overload the menu with too many options.

Do you want add something to the menu? Or do you want to reduce anything from the menu?

I'd prefer (2) as well.

This I can do.

@gepcel gepcel reopened this Jan 30, 2026
@gepcel
Copy link
Author

gepcel commented Jan 30, 2026

Based on the feedback from @rgbkrk, the following changes have been made. The command palette now displays two original actions and four newly added actions:

  • repl: run
  • repl: run in place
  • repl: run cell
  • repl: run cell in place
  • repl: run all
  • repl: run above

The names of these actions are self-explanatory, but a few details are worth noting:

  1. run and run in place execute the current line or selected lines now, different as previous.
  2. run cell and run cell in place execute the current cell or the cells to which the selected lines belong. A special case occurs when the cursor (or selected lines) is positioned before the first cell block (i.e., before the first # %%). For continuity, the code preceding the first cell is treated as a cell and executed. This avoids the need to go to the top line and insert a new line and new # %%.
  3. There are no changes to the shortcut keys; users may assign them as they prefer.
  4. There are no changes to the REPL menu (located at the top right of the editor). However, it seems that @rgbkrk wishes to add only some of these actions to that menu, but not all. This can be addressed in a separate pull request.

@gepcel
Copy link
Author

gepcel commented Jan 30, 2026

I've made some changes and would like your decision on a few points, @rgbkrk or someone else interested. Let me use the following code examples with line numbers:

Example 1

[1] print(1)
[2] print(2)
[3] print(3)

Example 2, different file from example 1, assume line starts from 4 for discuss.

[4] print(4)
[5] print(5)
[6] print(6)
[7] # %% first cell mark
[8] print(7)
[9] print(8)
[10] # %%
[11] print(9)

Now, regarding the behavior of two commands:

  1. run all run all cells individually
    • with example 1, execute all codes (line 1 to 3) as a single block since there are no cell markers.
    • with examlle 2, execute all as 3 cells individually, treat line 4 to line 6 before the first cell mark as a cell. I agree with you, executing cell by cell is better.
  2. run above run above cells individually
    • with example 1, cursor on line 3, since there are no cell markers, I think it should fall back to running the lines above. But should we include or exclude line 3 (print(3))?
    • with example 2, cursor on line 5, since it's in the first cell, no cell above. So should we execute current cell(line 4 to 6) or only run lines above(fall back to run lines above, and also include or exclude line 5)?
    • with example 2, cursor on line 8, after executing line 4 to 6 as first cell, should we include or exclude current cell( print(6), print(7))?

exclusive..

Signed-off-by: gepcel <gepcelway@gmail.com>
@gepcel
Copy link
Author

gepcel commented Feb 2, 2026

@rgbkrk Now this is ready for review, please have a look.

miguelraz pushed a commit that referenced this pull request Feb 3, 2026
- This also sends the cursor to block placement anchor which is the
standard thing to happen when we run cmd/ctrl + shift + enter, this is
usually used for Run and Move onto next cell.
- Perhaps the ability to stay on the same code will be tackled on
further works where not using the shift modifier would signify stay and
"just" run the cell. Like #46868

Closes #48069

Release Notes:

- Fixed cursor becoming invisible on the last line of REPL cells after
re-running
adb-sh pushed a commit to adb-sh/zed that referenced this pull request Feb 5, 2026
…industries#48218)

- This also sends the cursor to block placement anchor which is the
standard thing to happen when we run cmd/ctrl + shift + enter, this is
usually used for Run and Move onto next cell.
- Perhaps the ability to stay on the same code will be tackled on
further works where not using the shift modifier would signify stay and
"just" run the cell. Like zed-industries#46868

Closes zed-industries#48069

Release Notes:

- Fixed cursor becoming invisible on the last line of REPL cells after
re-running
@rgbkrk rgbkrk added the area:repl repl, jupyter, notebooks, etc label Feb 6, 2026
@gepcel
Copy link
Author

gepcel commented Feb 13, 2026

At the very least, I like the change in naming if someone is "in" a cell, on a line, or selecting contents. I don't want to overload the menu with too many options though so I prefer to make it more context dependent. Now... actions wise it probably makes sense to have multiple, just not all shown in one menu.

I've looked back at your comment, I realize I still haven’t fully understood your point — my initial interpretation may have been wrong, possibly due to my limited English. Could you explain it in more detail? Just tell me directly what I should do, or what effect I should aim for. If I’m able to implement it, I’ll follow your instructions accordingly. Waiting for weeks or even over a month, left me wondering if you’re expecting me to do something, or if you just don’t like this PR at all. I'm fine if you drop this, because I’m really not trying to push it.

@rgbkrk
Copy link
Collaborator

rgbkrk commented Feb 13, 2026

I'm sorry. I feel bad having you delay. I wasn't fully understanding either and I kept meaning to come back to your PR. I'll try to prioritize another look at it.

@gepcel
Copy link
Author

gepcel commented Feb 13, 2026

It might not have been clearly communicated due to the English expression—the modification is actually not complicated at all, and the logic will become clear upon simple trial. I have now completed all the work I planned for. It is now up to you or someone else from the dev team to decide whether this is feasible and what else needs to be done. There are also some suggestions from others you may want to check. Once decided, please directly specify what needs to be done, to avoid misunderstandings. I was a liile bit hard to get your point, and you might feel the same vice versa.

@rgbkrk
Copy link
Collaborator

rgbkrk commented Feb 20, 2026

Thank you for the contribution. I'll get this folded in somehow with the other ongoing changes to this and give you commit attribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:repl repl, jupyter, notebooks, etc cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants