Skip to content

Commit 9e30185

Browse files
authored
Set completions from the async thread (#2563)
1 parent 9be040d commit 9e30185

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plugin/documents.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .core.constants import DOCUMENT_HIGHLIGHT_KIND_SCOPES
88
from .core.constants import HOVER_ENABLED_KEY
99
from .core.constants import RegionKey
10+
from .core.constants import ST_VERSION
1011
from .core.logging import debug
1112
from .core.open import open_in_browser
1213
from .core.panels import PanelName
@@ -618,8 +619,11 @@ def _on_query_completions_resolved_async(
618619
flags: sublime.AutoCompleteFlags = sublime.AutoCompleteFlags.NONE
619620
) -> None:
620621
self._completions_task = None
621-
# Resolve on the main thread to prevent any sort of data race for _set_target (see sublime_plugin.py).
622-
sublime.set_timeout(lambda: clist.set_completions(completions, flags))
622+
if ST_VERSION >= 4184: # https://github.com/sublimehq/sublime_text/issues/6249#issuecomment-2502804237
623+
clist.set_completions(completions, flags)
624+
else:
625+
# Resolve on the main thread to prevent any sort of data race for _set_target (see sublime_plugin.py).
626+
sublime.set_timeout(lambda: clist.set_completions(completions, flags))
623627

624628
# --- textDocument/signatureHelp -----------------------------------------------------------------------------------
625629

0 commit comments

Comments
 (0)