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

Improvements for DocumentLink in hover popup #2098

Merged
merged 3 commits into from
Oct 25, 2022

Conversation

jwortmann
Copy link
Member

I think it would be better for the popup on hover over a DocumentLink, to already indicate that it will be opened in a browser if that is the case. Otherwise it could be a bit surprising for users, because most of the time these are links to a location in another file.

-> Adjust label to "Open in Browser" if the target is not a file uri.

And in case there are multiple sessions at the same time, which all provide DocumentLinks, then combine them into a single link and open a quick panel with the target URIs to choose from when clicked, instead of just putting multiple links into the hover popup.

- Already indicate in the link label if it's a link to a website and
  will be opened in a browser.

- If there are links from multiple sessions, open a quick panel to show
  the link targets and let the user select, instead of adding several
  similar looking links into the hover popup.
elif len(self._document_links) == 1:
link = self._document_links[0]
target = link.get("target")
label = "Follow Link" if link.get("target", "file:").startswith("file:") else "Open in Browser"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably go with Open in Browser if starts with http and otherwise Follow Link because there could be cases where link would use a custom protocol like virtual: or something and it would be a link to a local content.

Copy link
Member

@rchl rchl Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but I see that _on_navigate handler would then have to be somehow changed to follow that logic...

@rchl rchl merged commit 56c693b into sublimelsp:main Oct 25, 2022
@jwortmann jwortmann deleted the document-link-improvements branch October 25, 2022 19:01
rchl added a commit that referenced this pull request Jan 16, 2023
* main:
  Add elixir to language ids (#2100)
  Add jinja to language ids (#2099)
  Improvements for DocumentLink in hover popup (#2098)
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.

2 participants