Skip to content
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

[Ignore this PR] Ci/investigate failing ubuntu test #2441

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -30,18 +30,3 @@ jobs:
- uses: SublimeText/UnitTesting/actions/run-tests@v1
with:
coverage: true

Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- run: sudo apt update
- run: sudo apt install --no-install-recommends -y x11-xserver-utils
- run: pip3 install mypy==1.7.1 flake8==5.0.4 pyright==1.1.339 --user
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: mypy stubs
- run: flake8 plugin tests
- run: pyright plugin
21 changes: 12 additions & 9 deletions plugin/session_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,9 @@ def _check_did_open(self, view: sublime.View) -> None:
self._do_document_link_async(view, version)
self.session.notify_plugin_on_session_buffer_change(self)

def _check_did_close(self) -> None:
def _check_did_close(self, view: sublime.View) -> None:
if self.opened and self.should_notify_did_close():
self.purge_changes_async(view, suppress_requests=True)
self.session.send_notification(did_close(uri=self._last_known_uri))
self.opened = False

Expand Down Expand Up @@ -202,9 +203,9 @@ def remove_session_view(self, sv: SessionViewProtocol) -> None:
self._clear_semantic_token_regions(sv.view)
self.session_views.remove(sv)
if len(self.session_views) == 0:
self._on_before_destroy()
self._on_before_destroy(sv.view)

def _on_before_destroy(self) -> None:
def _on_before_destroy(self, view: sublime.View) -> None:
self.remove_all_inlay_hints()
if self.has_capability("diagnosticProvider") and self.session.config.diagnostics_mode == "open_files":
self.session.m_textDocument_publishDiagnostics({'uri': self._last_known_uri, 'diagnostics': []})
Expand All @@ -216,7 +217,7 @@ def _on_before_destroy(self) -> None:
# in unregistering ourselves from the session.
if not self.session.exiting:
# Only send textDocument/didClose when we are the only view left (i.e. there are no other clones).
self._check_did_close()
self._check_did_close(view)
self.session.unregister_session_buffer_async(self)

def register_capability_async(
Expand Down Expand Up @@ -308,15 +309,15 @@ def on_revert_async(self, view: sublime.View) -> None:

on_reload_async = on_revert_async

def purge_changes_async(self, view: sublime.View) -> None:
def purge_changes_async(self, view: sublime.View, suppress_requests: bool = False) -> None:
if self._pending_changes is None:
return
sync_kind = self.text_sync_kind()
if sync_kind == TextDocumentSyncKind.None_:
return
if sync_kind == TextDocumentSyncKind.Full:
changes = None
version = view.change_count()
version = view.change_count() or self._pending_changes.version
else:
changes = self._pending_changes.changes
version = self._pending_changes.version
Expand All @@ -329,12 +330,14 @@ def purge_changes_async(self, view: sublime.View) -> None:
finally:
self._pending_changes = None
self.session.notify_plugin_on_session_buffer_change(self)
sublime.set_timeout_async(lambda: self._on_after_change_async(view, version))
sublime.set_timeout_async(lambda: self._on_after_change_async(view, version, suppress_requests))

def _on_after_change_async(self, view: sublime.View, version: int) -> None:
def _on_after_change_async(self, view: sublime.View, version: int, suppress_requests: bool = False) -> None:
if self._is_saving:
self._has_changed_during_save = True
return
if suppress_requests or not view.is_valid():
return
self._do_color_boxes_async(view, version)
self.do_document_diagnostic_async(view, version)
if self.session.config.diagnostics_mode == "workspace" and \
Expand All @@ -357,7 +360,7 @@ def on_pre_save_async(self, view: sublime.View) -> None:
def on_post_save_async(self, view: sublime.View, new_uri: DocumentUri) -> None:
self._is_saving = False
if new_uri != self._last_known_uri:
self._check_did_close()
self._check_did_close(view)
self._last_known_uri = new_uri
self._check_did_open(view)
else:
Expand Down
Loading