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

Use caret for point to look up symbol #2440

Merged
merged 4 commits into from
May 3, 2024
Merged
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
2 changes: 1 addition & 1 deletion plugin/core/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 3 additions & 8 deletions plugin/hover.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
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
from .core.sessions import SessionBufferProtocol
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
Expand Down Expand Up @@ -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] = []
Expand Down