Content-Length: 551969 | pFad | https://github.com/zed-industries/zed/pull/44523

2F repl: Add inlay repl output display, skip empty lines on execution, and gutter execution display by auriium2 · Pull Request #44523 · zed-industries/zed · GitHub
Skip to content

repl: Add inlay repl output display, skip empty lines on execution, and gutter execution display#44523

Merged
miguelraz merged 7 commits into
zed-industries:mainfrom
auriium2:repl-upgrades
Jan 7, 2026
Merged

repl: Add inlay repl output display, skip empty lines on execution, and gutter execution display#44523
miguelraz merged 7 commits into
zed-industries:mainfrom
auriium2:repl-upgrades

Conversation

@auriium2
Copy link
Copy Markdown
Contributor

@auriium2 auriium2 commented Dec 10, 2025

Adds various useful things to the repl inspired by ipynb and the julia vscode extension which can be best seen with this video:

https://github.com/user-attachments/assets/6589715e-3783-456c-8f4b-e2d5a1c4090d

To summarize:

Inline outputs

Added small, single-line outputs displayed inline at the end of the code line instead of in a separate block. This provides a cleaner, more compact view for simple results like numbers or short strings. This occurs for execution views who only output a single mimetype/plain OR output nothing, otherwise the default behavior of creating a block will occur.

It looks like this:
image
or with a Output
image
This was inspired by julia vscode extension, but now it can be used with any replanguage! Hooray!

image

It saves lots of space compared to the ugly and distracting:
image

Gutters and execution numbers

Added gutters + execution number to display exactly what was executed. The gutter highlighting is useful for when selecting multiple cells manually to run, but you dont remember which ones

Ran at different times:
image
Ran together:
image

The execution number is useful in the same way that a normal jupyter notebook execution number is useful.

If a gutter-region does not have a block assigned to it, when you edit the text in the gutter region, the gutter will disappear, which is useful for telling when you have modified your code, but does not delete useful experiment results in blocks:

image image image

Skip empty line

This is a minor fix which is intended to make lab workflow less tedious. Currently when you execute on an empty line (which might be there for formatting purposes) nothing will occur. This PR adds the ability to, when executing from an empty line, skip ahead the range of inclusion until you reach actual code, and then execute.

Before:

code //run execute
//empty space, so you have to move your cursor down or use arrow key
code //run execute
code //run execute

After:

code //run execute
//empty space, you can now run execute on it and it will include the next line of code
//empty space
code //automatically executed
code //run execute

Currently the only piece of tested code is related to this, i still have to write tests for the gutter annotation api i added and all of the gutter + inline related code. Also still have to add more config for this stuff.

@rgbkrk would appreciate a review :D

Closes #22678

Release Notes:

  • repl: Added an inline display of execution results (as opposed to the large execution view) for simple REPL cells
  • repl: Improved how execution of empty lines are handled
  • repl: Added gutter execution display

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Dec 10, 2025
@rgbkrk
Copy link
Copy Markdown
Collaborator

rgbkrk commented Dec 10, 2025

Inline check marks are superb here. I think that one is an easy approval. ✅

Execution numbers in the gutters aren't quite my cup of tea. I think we'd want Zed's designers to weigh in on this. 😕

Empty line skip seems good. ✅

@rgbkrk
Copy link
Copy Markdown
Collaborator

rgbkrk commented Dec 10, 2025

Execution numbers in the gutters aren't quite my cup of tea. I think we'd want Zed's designers to weigh in on this.

Now that I've played with it a bit, it's growing on me. Kind of like it.

@rgbkrk
Copy link
Copy Markdown
Collaborator

rgbkrk commented Dec 10, 2025

I think to ease getting this in, I'd move the execution numbers in the gutter to another PR so that your other two changes can go in more rapidly.

@rgbkrk
Copy link
Copy Markdown
Collaborator

rgbkrk commented Dec 11, 2025

Looking good. You'll need to update the description to include a Release Notes segment like this:

Release Notes:

- Added/Fixed/Improved ...

I think since you've broken the PR up you can take it off of draft after that as well.

@auriium2 auriium2 marked this pull request as ready for review December 12, 2025 02:40
@auriium2
Copy link
Copy Markdown
Contributor Author

@rgbkrk Ready for review!

Copy link
Copy Markdown
Collaborator

@rgbkrk rgbkrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This brings us all the way back to the Hydrogen days with inline small results and the checkmark. Solid improvement, thank you.

I left some comments on an inline display edge case that we'll want to fix as well as some little comments. Up to you and the Zed maintainers how much you want to push it.

ExecutionState::Idle => {
self.status = ExecutionStatus::Finished;
if self.outputs.is_empty() {
cx.emit(ExecutionViewFinishedEmpty);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While not likely with any of the kernels, if an output comes after an idle then we may be keeping a loose checkmark when it should be cleared out.

}

return (Vec::new(), None);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one edge case to deal with, though it's not too big a deal. If you run the last line in a script where there's no newline the checkmark ends up after the line you actually ran.

Image

As an alternative, this could be emitted as a bit of an output "marker" so that if there were display updates that come in after (likely via a callback) then we can toss the output.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

//github.com/ Whether to show small single-line outputs inline instead of in a block.
//github.com/
//github.com/ Default: true
pub inline_output: bool,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this now and loving it.

let snapshot = buffer.read(cx).snapshot(cx);

let mut blocks_to_remove: HashSet<CustomBlockId> = HashSet::default();
let mut gutter_ranges_to_remove: Vec<Range<Anchor>> = Vec::new();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this one is a holdover from the gutter change moved to the other PR. If it's not too big a deal I'd take this out for the PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this is related to just gutter highlighting and invalidation, so gutters become ungreen/invalidated when you change the lines of code related. Hope that's ok to keep, if not i can move it to second pr

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty

@rgbkrk rgbkrk added the area:repl repl, jupyter, notebooks, etc label Jan 6, 2026
@miguelraz miguelraz changed the title repl: Add inlay repl output display, execution numbers in gutter, and skip empty lines on execution repl: Add inlay repl output display, and skip empty lines on execution Jan 6, 2026
@miguelraz miguelraz changed the title repl: Add inlay repl output display, and skip empty lines on execution repl: Add inlay repl output display and skip empty lines on execution Jan 6, 2026
@miguelraz
Copy link
Copy Markdown
Contributor

I changed the title and the release notes to note that gutters are no longer a part of this PR.

@miguelraz miguelraz changed the title repl: Add inlay repl output display and skip empty lines on execution repl: Add inlay repl output display, skip empty lines on execution, and gutter execution display Jan 7, 2026
@miguelraz miguelraz merged commit f3e5e3e into zed-industries:main Jan 7, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Community PRs to Done in Quality Week – December 2025 Jan 7, 2026
@rgbkrk
Copy link
Copy Markdown
Collaborator

rgbkrk commented Jan 7, 2026

🎉

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

Projects

Development

Successfully merging this pull request may close these issues.

Display of REPL tick on the right side.

5 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/zed-industries/zed/pull/44523

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy