Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I think this is an important feature for any programming tool to have.
Maybe there is a less insane approach to get that documentation text (though if there was, probably it would be implemented already), but I just parse it with
html-parsing
lib, extract relevant pieces of the documentaion for the selected element, convert this pieces of html into a Markdown string, and put that Markdown inhover
response.Demonstration:
demo.mp4
Looks surprisingly decent.
I've tried to make generated Markdown as human-readable as possible (in general, Markdown can be extremely human unreadable), so even if the used text editor doesn't support Markdown (for some incomprehensible reason), it still should be fairly usable. Here is an example of generated Markdown and how it would look in VS Code
And I've also fixed a couple of small bugs.
Links that contain a closing paren (

)
) aren't rendered correctly in Atom (because Atom's Md parser treats it as a link 'delimiter'). Now the links are encoded properly.Screenshot with the bug:
Currently links aren't constructed correctly if the documentation is not in a usual place (by usual I mean something like

C:/Program Files/Racket/doc/...
). For example, on Ubuntu, when Racket is installed from the default packet manager (i.e.apt install racket
), docs are located in/usr/share/doc/racket/...
. The problem here is thatracket
part goes afterdoc
. The current approach was to simple split path by/doc/
and I've just changed it to simply splittling by/doc/(racket/)?
, which is enough for this particular case.That kinda fixes Unable to get document for symbols imported from
racket
#72.Screenshot with the bug:
I really don't know why, but sometimes URLs come without url-tags (like

#(def._((quote._~23~25kernel)._hasheq))
), but 'raw' tags (i.e.'(def ((quote #%kernel) hasheq))
) are still there. I've solved it by additionaly converting this 'raw' tags into url-tags when original url-tags are not present.Screenshot with the bug:
I hope I did everything right, never programmed anything significant in lisp.