emacs-lsp/lsp-haskell

Unable to click Documentation/Source links in lsp-ui-doc

unhammer opened this issue · 3 comments

There's a popup that shows when I hover or have mark on a symbol with the documentation, types and links saying Documentation and Source. Nothing happens when I click on these, except a message shows saying
markdown-follow-link-at-point: Point is not at a Markdown link or URL. But they show the file:///url of the haddock file on hover.

If I M-x lsp-ui-doc-focus-frame I can navigate to the Documentation link and C-h c to find out that the text property help-echo indeed has the file:///url as its string and keymap
(keymap (mouse-2 . markdown-follow-link-at-point) (follow-link . mouse-face))
but there's no actual markdown text there. I can (buffer-substring-no-properties) and that tells me it's just the string Documentation (not [Documentation](file:///url)), but it's displayed as if it's a link with text properties that change the face.

Sorry if this is in the wrong repo (is HLS formatting the wrong way or is lsp-doc or … I have no idea what does what in lsp).

quick workaround:

(defun my-lsp-goto-docs (&optional source)
  "Browse documentation (or SOURCE on prefix arg) from lsp-ui-doc."
  (interactive "P")
  (if-let* ((link-text (if source
                           "Source"
                         "Documentation"))
            (url (lsp-ui-doc--with-buffer
                   (goto-char (point-max))
                   (when (search-backward link-text nil 'noerror)
                     (get-text-property (point) 'help-echo)))))
      (eww url)
    (message "No %s link found" link-text)))
(define-key lsp-mode-map (kbd "C-c M-.") #'my-lsp-goto-docs)

I think this is probably a lsp-ui issue. And indeed, a quick search found emacs-lsp/lsp-ui#452. Going to close for now, fee free to reopen if it turns out to be haskell-specific.

Aha, thanks for the pointer!