From d5c350a6e8b8b38777493af72d1152d8a7d24efb Mon Sep 17 00:00:00 2001 From: jwortmann Date: Fri, 3 May 2024 10:45:58 +0200 Subject: [PATCH 1/2] Disable CI on Mac (#2462) * Disable coverage for UnitTesting in CI * Revert "Disable coverage for UnitTesting in CI" This reverts commit ed571317ea7c9078501cb4565d117a4bde86bb93. * Use the sledgehammer method --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ce5bfa1d0..061936a93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macOS-latest, windows-latest] + os: + - ubuntu-latest + # - macOS-latest + - windows-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From cdb2430ed18afd69f7adfb94915e265473623643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Troels=20Bj=C3=B8rnskov?= Date: Fri, 3 May 2024 10:49:37 +0200 Subject: [PATCH 2/2] Use caret for point to look up symbol (#2440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Use caret for point to look up symbol This commit changes the hover functionality such that the caret, not the beginning of the selection, is used for the symbol lookup. * Simplify --------- Co-authored-by: Janos Wortmann Co-authored-by: Предраг Николић --- plugin/core/registry.py | 2 +- plugin/hover.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/plugin/core/registry.py b/plugin/core/registry.py index ea9deab2f..1ba7c9041 100644 --- a/plugin/core/registry.py +++ b/plugin/core/registry.py @@ -41,7 +41,7 @@ def get_position(view: sublime.View, event: dict | None = None, point: int | Non if x is not None and y is not None: return view.window_to_text((x, y)) try: - return view.sel()[0].begin() + return view.sel()[0].b except IndexError: return None diff --git a/plugin/hover.py b/plugin/hover.py index 9466aa128..b3d9ddae4 100644 --- a/plugin/hover.py +++ b/plugin/hover.py @@ -16,6 +16,7 @@ from .core.protocol import Position from .core.protocol import Range from .core.protocol import Request +from .core.registry import get_position from .core.registry import LspTextCommand from .core.registry import windows from .core.sessions import AbstractViewListener @@ -23,7 +24,6 @@ from .core.settings import userprefs from .core.url import parse_uri from .core.views import diagnostic_severity -from .core.views import first_selection_region from .core.views import format_code_actions_for_quick_panel from .core.views import format_diagnostic_for_html from .core.views import FORMAT_MARKED_STRING @@ -115,17 +115,12 @@ def run( point: int | None = None, event: dict | None = None ) -> None: - temp_point = point - if temp_point is None: - region = first_selection_region(self.view) - if region is not None: - temp_point = region.begin() - if temp_point is None: + hover_point = get_position(self.view, event, point) + if hover_point is None: return wm = windows.lookup(self.view.window()) if not wm: return - hover_point = temp_point self._base_dir = wm.get_project_path(self.view.file_name() or "") self._hover_responses: list[tuple[Hover, MarkdownLangMap | None]] = [] self._document_links: list[DocumentLink] = []