-
-
Notifications
You must be signed in to change notification settings - Fork 378
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
fix haddock documentation links (#2542) #2550
base: master
Are you sure you want to change the base?
Conversation
This doesn't completely resolve the issue. The source links seem to need further examination to sort out. But it does appear to solve the documentation link problems described in the linked issue.
Many thanks for the pr and the fixes
There is an issue in haddock about: haskell/haddock#1447, opened from the hls issue #2508 |
It would be great to add a regression test to check haddock doc links are not going to be broken. The test suite for hover is here: haskell-language-server/ghcide/test/exe/Main.hs Line 3867 in 3de244e
feel free to ask any question about |
Thanks for the pointer, I will do that and try to write some suitable tests. Should I do that in a separate PR? From reading those links about the source links, it seems that the issue I was experiencing with them is not the fault of HLS, but rather some combination of haddock changes and the vscode HLS extension? |
AS you consider, both options are fine
yeah, a combination of, i think haddock is inconsistent in its url generation, hls follow one schema and the vscode tried to fix it standalone 🤦 |
Okay, I have added a couple tests to check that names in the documentation links are getting encoded properly. If that looks good to you, then I think we could close the original issue, as the business with source links already has open issues in the appropriate places? |
Looks like one of the ghcide tests fails now? |
Yeah, at first glance it looks like some (older?) versions of GHC and/or HLS don't generate the Documentation links, which is making the tests fail. I'll see if I can add some conditionals to just run the tests for some versions. |
Sorry for the delay, it was a bit of a slog to look through the logs. It seems like many of the builds got timed out, and others skipped the
I admit to being completely lost as to why the Looking at the results, it would seem sensible to keep the def tests as-is, and just skip over all the hover tests. I've pushed a commit that does exactly that, so we'll see whether the tests pass this time or not. |
Possibly dumb question: could we actually depend on |
Perhaps that would be a better approach. I'm not very familiar with the internals of haddock, or HLS for that matter, so I just tried to hack something together that works. I suppose I had been implicitly assuming that the way haddock does this is relatively stable, i.e. it's not something that's likely to change often if at all. The function that I added called |
I'm not so much worried about Haddock changing how it does it, as there just being more awkward corners we hadn't thought about. If they don't expose it, though, nothing we can do. Maybe open an issue in |
Also, the tests didn't time out this time. Are you planning to investigate what's up with the disabled tests or just leave it for now? At least we should include a comment as to why they're disabled if we do that. |
Sad that this PR was closed without merging. Reopening in case someone can resubmit it, or at least salvage the tests |
This doesn't completely resolve the linked issue (#2542), but it does seem to solve the documentation link problems. I've looked through the haddock codebase and tried to mirror the way that it creates links/anchors, and it looks to be working. In the process of doing this I realized that there is another issue with the current links - they don't work for function names like
foldl'
that have apostrophes in them. This commit also fixes that problem.Getting the source links to behave is proving more difficult. I can't figure out how the module names are supposed to be formatted. I had thought, when writing the issue, that they should always be separated with dashes (like
GHC-Base.html
). But it seems that sometimes dots are needed (likeGHC.Base.html
). I'm at a loss trying to understand it. Any help would be welcome here.