@@ -120,6 +120,7 @@ def __init__(self, session_view: SessionViewProtocol, buffer_id: int, uri: Docum
120
120
self ._diagnostics_are_visible = False
121
121
self .document_diagnostic_needs_refresh = False
122
122
self ._document_diagnostic_pending_response = None # type: Optional[int]
123
+ self ._last_synced_version = 0
123
124
self ._last_text_change_time = 0.0
124
125
self ._diagnostics_debouncer_async = DebouncerNonThreadSafe (async_thread = True )
125
126
self ._workspace_diagnostics_debouncer_async = DebouncerNonThreadSafe (async_thread = True )
@@ -156,6 +157,7 @@ def _check_did_open(self, view: sublime.View) -> None:
156
157
self .session .send_notification (did_open (view , language_id ))
157
158
self .opened = True
158
159
version = view .change_count ()
160
+ self ._last_synced_version = version
159
161
self ._do_color_boxes_async (view , version )
160
162
self .do_document_diagnostic_async (view , version )
161
163
self .do_semantic_tokens_async (view , view .size () > HUGE_FILE_SIZE )
@@ -277,6 +279,8 @@ def should_notify_did_close(self) -> bool:
277
279
278
280
def on_text_changed_async (self , view : sublime .View , change_count : int ,
279
281
changes : Iterable [sublime .TextChange ]) -> None :
282
+ if change_count <= self ._last_synced_version :
283
+ return
280
284
self ._last_text_change_time = time .time ()
281
285
last_change = list (changes )[- 1 ]
282
286
if last_change .a .pt == 0 and last_change .b .pt == 0 and last_change .str == '' and view .size () != 0 :
@@ -319,6 +323,7 @@ def purge_changes_async(self, view: sublime.View) -> None:
319
323
try :
320
324
notification = did_change (view , version , changes )
321
325
self .session .send_notification (notification )
326
+ self ._last_synced_version = version
322
327
except MissingUriError :
323
328
return # we're closing
324
329
finally :
0 commit comments