feat: add hls-document-link-plugin to support LSP document links#4898
feat: add hls-document-link-plugin to support LSP document links#4898jetjinser wants to merge 9 commits intohaskell:masterfrom
hls-document-link-plugin to support LSP document links#4898Conversation
hls-document-link-plugin to support LSP document links
| -- custom Eq to ignore some details, such as specific URI | ||
| -- not symmetry |
There was a problem hiding this comment.
| -- custom Eq to ignore some details, such as specific URI | |
| -- not symmetry | |
| -- Custom Eq to ignore some details, such as specific URI. | |
| -- This is not a lawful instance as it doesn't obey the `symmetry` law. Use at your own risk and only in tests. |
|
Also, I am wondering whether this has any overlap with #4746 and the |
Screencast_20260418_150352.webmThis is the behaviour on vscode... I suppose that's not the expected behaviour? |
Yes. The links provided in this PR share the same source as the 'Documentation' links in the hover messages. The goal here is to expose that information through a more native and convenient LSP feature (DocumentLink). Therefore, documentLink provides a local hackage link, not the online link provided in #4746. |
I’ve done some local testing and noticed the same behavior in VSCodium.
EDIT: "workbench.externalUriOpeners": {
"file:///*": "simpleBrowser.open"
},Ideally, this might work? However, I still couldn't get it to open in either an internal or external browser. |
I think this might be a lsp consumer problem. I'm using Helix and by default all I wonder, what's the hueristic nvim uses to determine whether to open files with |
Nvim doesn't attempt any heuristics. It simply uses It's possible that Neovim doesn't have a particular reason to open HTML, while a GUI editor does, and the former distinguishes between |
Disabling should work, otherwise this is a VSCode / theme setting, so not in the scope of this PR |

This PR introduces a new plugin
hls-document-link-pluginthat adds LSP documentLink support to Haskell Language Server.This plugin automatically extracts documentation links for symbols in source code. These links are the same ones that power the
[Documentation]link in the hover information.Changes
hls-document-link-plugin– extracts clickable links and provides them as document links. Editors can then open these links directly from the source code.documentLinkOnoption to enable/disable the feature (default:True).Usage
In Neovim 0.12 or later, you can place the cursor on the link and press
gxto open it directly in your default browser.The feature can be turned off by setting
documentLinkOn: falsein the HLS configuration.Note. The
getDocumentLinkshelper forlsp-testis implemented manually here, but a same change is also pending in haskell/lsp#638. After that PR is merged and the dependency is updated, this part can be simplified.