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

Handle custom URI schemes in hover text links #2339

Merged
merged 7 commits into from
Oct 20, 2023

Conversation

rwols
Copy link
Member

@rwols rwols commented Oct 15, 2023

Before this change, custom URI schemes would be delegated to the browser.

With this change, an attempt is made to look for a session that can handle the URI.

Moreover, if there is a fragment present in the URI, then it's assumed that that fragment encodes the (row, col) to jump to. This logic is somewhat dubious, but it's the only reasonable way (as far as I can see) to handle this.

Anoher approach could be to introduce a new on_open_uri2_async callback for plugins where they can also provide a (row, col) to jump to. But, then we would also require an opt-in switch for plugins where they would advertise that they can handle the "version 2" of on_open_uri.

(I've attached a GIF of goto-definition now working even for hover text links with Java, but I don't think the mouse cursor is visible)

jdtls-goto-def

Before this change, custom URI schemes would be delegated to the browser.

With this change, an attempt is made to look for a session that can
handle the URI.

Moreover, if there is a fragment present in the URI, then it's assumed that
that fragment encodes the (row, col) to jump to. This logic is somewhat
dubious, but it's the only reasonable way (as far as I can see) to handle
this.

Anoher approach could be to introduce a new on_open_uri2_async callback
for plugins where they can also provide a (row, col) to jump to. But,
then we would also require an opt-in switch for plugins where they would
advertise that they can handle the "version 2" of on_open_uri.
plugin/hover.py Show resolved Hide resolved
@rwols
Copy link
Member Author

rwols commented Oct 15, 2023

Related: sublimelsp/LSP-jdtls#43

plugin/core/views.py Outdated Show resolved Hide resolved
@rwols rwols requested review from jwortmann and rchl October 18, 2023 20:05
plugin/core/views.py Outdated Show resolved Hide resolved
plugin/core/views.py Outdated Show resolved Hide resolved
plugin/hover.py Outdated Show resolved Hide resolved
plugin/core/sessions.py Outdated Show resolved Hide resolved
@rwols rwols merged commit 876e924 into main Oct 20, 2023
4 checks passed
@rwols rwols deleted the feature/handle-custom-uris-in-hover-text branch October 20, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants