Skip to content

fix: let the resource finish all write operation #1972

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
merged 1 commit into from
Mar 28, 2023
Merged

fix: let the resource finish all write operation #1972

merged 1 commit into from
Mar 28, 2023

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Mar 21, 2023

Motivation

As noted in eclipse-theia/theia#12327, there could be a race condition when saving the editor model. This PR customizes the file resource resolver to create instances that wait for all running write operations to finish before checking whether the resource is in sync.

Change description

Other information

It's not trivial to verify the changes. Without this PR, the bug can be reproduced with these steps.

to_verify_jumping_cursor.mp4

I could not reproduce it with my changes, although I repeated the steps ~100 times.

Reviewer checklist

Closes #437

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project topic: theia Related to the Theia IDE framework labels Mar 21, 2023
@kittaakos kittaakos self-assigned this Mar 21, 2023
before checking if it's in sync or not.

Closes #437

Signed-off-by: Akos Kitta <[email protected]>
@Willem43T
Copy link

Willem43T commented Mar 21, 2023

I downloaded the PR as a Windows 64 zip file and installed it. About lists it as

Version: 2.0.5-snapshot-baf98f0
Date: 2023-03-21T09:51:03.186Z
CLI Version: {3}

Copyright © 2023 Arduino SA

Next I loaded a sketch, enabled all the skip whitespace options, particularly the "trimAutoWhitespace" which provided the current work around.

Editing did not exhibit the, by now, well known cursor jumping randomly to the start of the line. I then closed the snapshot version, leaving the whitespace settings as is, and loaded my previous nightly. This immediately had the cursor jumping to the start problem. Back to the PR version and all seems to behave correctly. I will continue using this till it is merged into the next nightly. Should I experience any problems I will report here.

So it seems as if the proposed fix does exactly what it is intended to. Thanks for the hard work.

Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

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

I am able to consistently reproduce #437 on one of my computers with the build from main. I am not able to reproduce it on that machine with the build from this PR.

Thanks Akos! Excellent work tracking down the bug.

@kittaakos kittaakos merged commit 39ab836 into main Mar 28, 2023
@kittaakos kittaakos deleted the #437 branch March 28, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself topic: theia Related to the Theia IDE framework type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cursor randomly jumps to beginning of line
3 participants