dart-archive / eclipse3

DEPRECATED - NO LONGER maintained/supported - Eclipse plugins and Dart Editor
8 stars 6 forks source link

Analysis server overlay out of sync after typing text and then quickly undo-ing #41

Open DartBot opened 9 years ago

DartBot commented 9 years ago

Issue by stereotype441 Originally opened as https://github.com/dart-lang/sdk/issues/22223


I just encountered a sequence of actions which caused editor to send an improper overlay state to the analysis server. Here's what I did:

  1. Clicked on the file pkg/analysis_server/lib/src/analysis_server.dart in the "files" pane of editor. My cursor was positioned at the top of the file.
  2. Typed "pub" (this was a mistake--I was intending to type Cmd-J to start an incremental search before typing "pub").
  3. Quickly realized my mistake and typed Cmd-Z to undo.
  4. Typed Cmd-J followed by "pub", which took me to the first instance of the word "pub" in the file.

At this point I noticed that my semantic highlighting was incorrect.

Looking at the analysis server log, I see that during step 2, editor sent an "analysis.updateContent" message to the server containing instructing it to add an overlay for the file, with contents containing the text "pub" that I erroneously typed. This is as expected.

However, I would have expected that to be followed by an "analysis.updateContent" message instructing the server to remove the overlay at the time I typed Cmd-Z to undo. There was no such message.

This left the server and the editor in an inconsistent state--the server thought the file had unsaved changes (the three accidentally typed characters), where as the editor thought that the file was in the "saved" state.

Speculation: perhaps the reconciler does not properly detect a transition from "unsaved" to "saved" state when that transition happens as the result of an undo.

I have saved the analyzer log. I will now see if I can reproduce the bug.

DartBot commented 9 years ago

Comment by stereotype441


After several attempts I was able to reproduce the bug by typing a single character at the top of the file, waiting a short amount of time (perhaps ~0.5 second), and then pressing Alt-Z to undo. However, the repro is not very reliable. I suspect that the bug is very sensitive to the exact timing of the keypresses.

I will continue investigating.


Set owner to @stereotype441.

DartBot commented 9 years ago

Comment by clayberg


cc @scheglov. Removed Priority-Unassigned label. Added Priority-Medium label.