Skip to content

Enable edit prediction and Copilot for untitled buffers - #45764

Merged
osiewicz merged 7 commits into
zed-industries:mainfrom
tacshi:fix/buffer_prediction
Apr 27, 2026
Merged

Enable edit prediction and Copilot for untitled buffers#45764
osiewicz merged 7 commits into
zed-industries:mainfrom
tacshi:fix/buffer_prediction

Conversation

@tacshi

@tacshi tacshi commented Dec 28, 2025

Copy link
Copy Markdown

Closes #45631

Recording:

buffer_prediction.mp4

Release Notes:

  • copilot: Edit predictions now work in temporary files

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Dec 28, 2025
@SomeoneToIgnore SomeoneToIgnore added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label Dec 28, 2025
Comment thread crates/edit_prediction/src/zeta2.rs Outdated
Copilot AI review requested due to automatic review settings March 6, 2026 09:44
@zed-industries-bot

zed-industries-bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor
Messages
📖

This PR includes links to the following GitHub Issues: #45631
If this PR aims to close an issue, please include a Closes #ISSUE line at the top of the PR body.

Generated by 🚫 dangerJS against 1c680f0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Enables edit predictions (including Copilot) to work for buffers that have no on-disk file association (e.g., buffers created via workspace: new file), addressing the regression described in #45631.

Changes:

  • Register singleton buffers with Copilot even when the buffer has no associated file.
  • Use a unique synthetic path (untitled-{remote_id}) for Zeta requests when the buffer has no file, avoiding collisions between multiple untitled buffers.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/zed/src/zed/edit_prediction_registry.rs Removes the “must have a file” gate so Copilot can register untitled buffers.
crates/edit_prediction/src/zeta.rs Changes Zeta’s fallback excerpt path from a constant to a per-buffer synthetic path based on remote_id.
Comments suppressed due to low confidence (1)

crates/zed/src/zed/edit_prediction_registry.rs:267

  • The Copilot provider behavior was changed to register singleton buffers even when they have no associated file. There’s no regression test covering this untitled-buffer path (this file already has gpui tests), so it’s easy for the original file().is_some() guard to accidentally come back. Consider adding a test that constructs an editor with a singleton buffer without a file handle and asserts that Copilot registration still happens when the provider is Copilot.
        Some(EditPredictionProviderConfig::Copilot) => {
            let ep_store = edit_prediction::EditPredictionStore::global(client, &user_store, cx);
            let Some(project) = editor.project().cloned() else {
                return;
            };
            let copilot =
                ep_store.update(cx, |this, cx| this.start_copilot_for_project(&project, cx));

            if let Some(copilot) = copilot {
                if let Some(buffer) = singleton_buffer {
                    copilot.update(cx, |copilot, cx| {
                        copilot.register_buffer(&buffer, cx);
                    });
                }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/edit_prediction/src/zeta.rs Outdated
Comment thread crates/edit_prediction/src/zeta.rs Outdated
@tacshi
tacshi force-pushed the fix/buffer_prediction branch from 5b8cdc3 to 7bcbd8a Compare March 6, 2026 16:55
@tacshi
tacshi requested a review from osiewicz March 6, 2026 16:56
@cla-bot

cla-bot Bot commented Mar 19, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tacshi 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'.

@cla-bot cla-bot Bot removed the cla-signed The user has signed the Contributor License Agreement label Mar 19, 2026
@tacshi

tacshi commented Mar 20, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot

cla-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @tacshi 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'.

@cla-bot

cla-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

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

@tacshi

tacshi commented Mar 20, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 20, 2026
@cla-bot

cla-bot Bot commented Mar 20, 2026

Copy link
Copy Markdown

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

@tacshi

tacshi commented Mar 20, 2026

Copy link
Copy Markdown
Author

The previous account was deleted due to a login issue, so a cla recheck is needed.

@osiewicz
osiewicz enabled auto-merge (squash) April 16, 2026 16:59
@osiewicz

Copy link
Copy Markdown
Member

Thank you! Sorry for keeping you waiting.

@osiewicz
osiewicz added this pull request to the merge queue Apr 27, 2026
Merged via the queue into zed-industries:main with commit b178949 Apr 27, 2026
31 checks passed
@tacshi
tacshi deleted the fix/buffer_prediction branch April 27, 2026 10:51
tomhoule pushed a commit that referenced this pull request Apr 27, 2026
Closes [#45631](#45631)

Recording:


https://github.com/user-attachments/assets/a5143eb4-fae3-42a7-9d64-fb7c42ee97c2


Release Notes:

- copilot: Edit predictions now work in temporary files

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
ebaah46 pushed a commit to ebaah46/zed that referenced this pull request May 6, 2026
…es#45764)

Closes [zed-industries#45631](zed-industries#45631)

Recording:


https://github.com/user-attachments/assets/a5143eb4-fae3-42a7-9d64-fb7c42ee97c2


Release Notes:

- copilot: Edit predictions now work in temporary files

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
kathbigra pushed a commit to kathbigra/zed that referenced this pull request May 10, 2026
…es#45764)

Closes [zed-industries#45631](zed-industries#45631)

Recording:


https://github.com/user-attachments/assets/a5143eb4-fae3-42a7-9d64-fb7c42ee97c2


Release Notes:

- copilot: Edit predictions now work in temporary files

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…es#45764)

Closes [zed-industries#45631](zed-industries#45631)

Recording:


https://github.com/user-attachments/assets/a5143eb4-fae3-42a7-9d64-fb7c42ee97c2


Release Notes:

- copilot: Edit predictions now work in temporary files

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…es#45764)

Closes [zed-industries#45631](zed-industries#45631)

Recording:


https://github.com/user-attachments/assets/a5143eb4-fae3-42a7-9d64-fb7c42ee97c2


Release Notes:

- copilot: Edit predictions now work in temporary files

---------

Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix that edit predictions do not work for buffers without files, like ones started from workspace: new file

6 participants