-
Notifications
You must be signed in to change notification settings - Fork 185
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
Add support for textDocument/documentLink request #1974
Conversation
Awesome work @jwortmann. I do see that the "follow link" link is being positioned incorrectly with respect to the CSS? See screenshot below. (for clangd one doesn't really need textDocument/documentLink because "goto definition" also opens the link to the #include) Couple of boring questions:
|
Thanks for the feedback. I will try to fix the CSS alignment in the popup, but it is a bit inconvenient, because if I add padding, it doesn't look nice if the link is the only content of the popup. And probably needs some tweaking dependent on whether users have disabled the "show_symbol_action_links".
Yes, it is the same case for LSP-TexLab. In general "document links" and "goto definition" seem to have overlapping functionality. I would guess that the "document links" are supposed to allow a distinct UI presentation for links in the source code, like the underlining or a popup on mouse hover.
Added.
Hm, not sure if this is necessary, because there is already the popup on mouse hover and I think navigation via this popup is faster than using right click and then selecting a sub-menu entry of the context menu.
Also done. If you want, you could add a mouse binding too: // Default.sublime-mousemap
[
{
"button": "button1", "count": 1, "modifiers": ["alt"],
"press_command": "lsp_open_link"
},
] It works fine for the links, but unfortunately this example with "Alt + click" would take priority over (and therefore disable) the built-in ability of subtractive selections (Windows & Linux) or column-wise selections (macOS).
It is not necessarily blue, the color depends on whatever the color scheme uses for the And the diagnostics for info & hint are dotted, so it should be easy to distinguish those. What we perhaps could do, is to use no underline ("none") as default value for the "link_highlight_style" setting? |
Any opinions about the default value for the link style? I'm undecided now, or even slightly lean to remove the underlining ("none"). I think as soon as you discover what your language server treats as links, the underlining provides little value. But maybe I'm biased, because it doesn't look very nice in my own color scheme. By the way, Dockerfiles are an example where the links provide an actual feature not covered by "Goto Definition". For example in FROM debian:latest the link on |
Since the work to implement this feature was made, I think the results should be easily discoverable by the user. Otherwise it's kind of a dead feature. So personally I think we should keep the default underline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
I just noticed another example is LSP-json for schema files, where you can do a "follow link" on a |
* main: Cut 1.16.3 Add support for textDocument/documentLink request (#1974) Don't expose disabled code actions
Is this useful? Tested with LSP-TexLab:
A strange (or maybe just inaccurate) thing in the LSP specs is that a "document link"
but the type for
DocumentLink.target
isDocumentUri
, and not the more generalURI
(they both are defined asstring
though).Initially I figured it might be good to make the links available in the right click context menu, similar to what
Default/open_context_url.py
does for website links, and to run the request only on demand when you open the context menu. But then we can't show the underlines for the links, and it would probably make the context menu very slow (I don't know if it would even be possible to run the request from thesublime_plugin.TextCommand.is_enabled()
and wait for a response). So I guess to run the request in the background after text changed and show the link in a hover popup (like what VS Code does) is better and looks nicer.TODO
documentLink/resolve
(when the "target" is not provided in the initial response)Questions