Improve hover for function docs#387
Conversation
|
Thanks for the work! The hover help looks much better. I did some minor updates to the code to make it consistent with other usages in languageserver. One issue I'm curious about is that it might be a bit heavy that we need to import rmarkdown which relies on pandoc to do the work. Do we already depend on it? |
|
I add a check |
R/workspace.R
Outdated
| # enc2utf8(repr::repr_text(hfile)) | ||
| html <- enc2utf8(repr::repr_html(hfile)) | ||
| html_to_markdown(html) | ||
| md <- html_to_markdown(html) |
There was a problem hiding this comment.
As html_to_markdown could be quite heavy, shall we cache the markdown results (at least per session)?
There was a problem hiding this comment.
Agree. A simple dict to cache help results should be working.
I guess moving rmarkdwon to |
|
@ManuelHentschel Just notice that Although the spec says it should follow gfm, I tried Do we check the version of pandoc via |
|
From the release notes of pandoc:
I guess we might need to use |
|
Fixed via 5f1d88e. |
This PR tries to improve the quality of function documentation in hovers.
To test:
Hover e.g. over these expressions:
Known issues:Some special characters (e.g. the quotes in the documentation foris.na) get rendered incorrectly.(Edit: fixed by specifying the encoding to be utf-8)