Skip to content

fix(diff-editor)-performance #5581

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

Merged

Conversation

chezsmithy
Copy link
Contributor

@chezsmithy chezsmithy commented May 8, 2025

Description

When the diff editor was running in vscode it was frustrating that the progress would slowly start from the top of the file and make it's way to the bottom. Sometimes it felt like nothing was happening until the change cursor came into view.

I added code to change the focus in the editor depending on where the current edit is occuring. Interestingly this had the side effect of speeding the whole process up imensely for me. I'm curious if others see the same difference.

I also added code to push the viewport to the top of the file after all the edits are complete to give a visual indication that the process is done. Note, it might be better to focus the editor at the first diff but I didn't see an easy way to determine where that was without a more significant change.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Testing instructions

  1. Ask for logging to be added to @test.js
  2. Observe that after a bit of a wait the editing to the test.js file starts
  3. Note that the current line displayed in the editor window follows the changes being made.
  4. Observe the speed of applying those edits seems to be significantly improved. (side effect?)

Summary by mrge

Improved the diff editor in VS Code so the viewport follows edits as they happen, making progress clearer and speeding up the editing process.

  • UI Improvements
    • The editor now scrolls to each change as it is applied.
    • After all edits, the view returns to the top of the file to show completion.

@chezsmithy chezsmithy requested a review from a team as a code owner May 8, 2025 23:47
@chezsmithy chezsmithy requested review from Patrick-Erichsen and removed request for a team May 8, 2025 23:47
Copy link

netlify bot commented May 8, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 961d0c4
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/681e78184ce8110008431a0f

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 8, 2025
Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

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

Wow, very simple addition but makes a huge difference! I tested this with Edit to see how it would behave on a single-range change (i.e. not a full file) and it also worked great, the jump-to-first-line-of-range logic is quite nice.

Thanks for the attention to detail here!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 9, 2025
@chezsmithy
Copy link
Contributor Author

@Patrick-Erichsen thanks! I was a bit shocked by the performance change. I wonder if it has something to do with making changes in the editor outside the currently displayed viewport? None the less it's a quick win.

@Patrick-Erichsen Patrick-Erichsen merged commit babcf33 into continuedev:main May 12, 2025
48 of 51 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Issues and PRs May 12, 2025
@Patrick-Erichsen
Copy link
Collaborator

Let's keep an eye out for user feedback on this one. Since this effectively forces the viewport to follow along with edits it prevents users from pausing to read the code as it's streamed in.

@HQ1363
Copy link
Contributor

HQ1363 commented May 27, 2025

Jetbrains, it's also slow. Is there room for optimization?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants