Skip to content

Commit 7a8b482

Browse files
committed
Check for SessionViews instead
1 parent 213f533 commit 7a8b482

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

plugin/documents.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,11 @@ def session_views_async(self) -> list[SessionView]:
328328
return list(self._session_views.values())
329329

330330
def on_text_changed_async(self, change_count: int, changes: Iterable[sublime.TextChange]) -> None:
331-
if not self.sessions_async():
331+
session_views = self.session_views_async()
332+
if not session_views:
332333
return
333334
if self.view.is_primary():
334-
for sv in self.session_views_async():
335+
for sv in session_views:
335336
sv.on_text_changed_async(change_count, changes)
336337
self._on_view_updated_async()
337338

@@ -366,11 +367,12 @@ def on_activated_async(self) -> None:
366367
return
367368
if not self._registered:
368369
self._register_async()
369-
if not self.sessions_async():
370+
session_views = self.session_views_async()
371+
if not session_views:
370372
return
371373
if userprefs().show_code_actions:
372374
self._do_code_actions_async()
373-
for sv in self.session_views_async():
375+
for sv in session_views:
374376
if sv.code_lenses_needs_refresh:
375377
sv.set_code_lenses_pending_refresh(needs_refresh=False)
376378
sv.start_code_lenses_async()
@@ -386,7 +388,7 @@ def on_activated_async(self) -> None:
386388
sb.do_inlay_hints_async(self.view)
387389

388390
def on_selection_modified_async(self) -> None:
389-
if not self.sessions_async():
391+
if not self.session_views_async():
390392
return
391393
first_region, _ = self._update_stored_selection_async()
392394
if first_region is None:
@@ -489,7 +491,7 @@ def on_query_context(self, key: str, operator: int, operand: Any, match_all: boo
489491
return None
490492

491493
def on_hover(self, point: int, hover_zone: int) -> None:
492-
if not self.sessions_async():
494+
if not self.session_views_async():
493495
return
494496
if self.view.is_popup_visible():
495497
return
@@ -533,7 +535,7 @@ def _on_hover_gutter_async(self, point: int) -> None:
533535
on_navigate=lambda href: self._on_navigate(href, point))
534536

535537
def on_text_command(self, command_name: str, args: dict | None) -> tuple[str, dict] | None:
536-
if not self.sessions_async():
538+
if not self.session_views_async():
537539
return None
538540
if command_name == "auto_complete":
539541
self._auto_complete_triggered_manually = True
@@ -550,7 +552,7 @@ def on_text_command(self, command_name: str, args: dict | None) -> tuple[str, di
550552
return None
551553

552554
def on_post_text_command(self, command_name: str, args: dict[str, Any] | None) -> None:
553-
if not self.sessions_async():
555+
if not self.session_views_async():
554556
return
555557
if command_name == 'paste':
556558
format_on_paste = self.view.settings().get('lsp_format_on_paste', userprefs().lsp_format_on_paste)
@@ -565,7 +567,7 @@ def on_post_text_command(self, command_name: str, args: dict[str, Any] | None) -
565567
self.view.hide_popup()
566568

567569
def on_query_completions(self, prefix: str, locations: list[int]) -> sublime.CompletionList | None:
568-
if not self.sessions_async():
570+
if not self.session_views_async():
569571
return None
570572
completion_list = sublime.CompletionList()
571573
triggered_manually = self._auto_complete_triggered_manually

0 commit comments

Comments
 (0)