ng
ng copied to clipboard
ng: devise a way to query documentation from the REPL
it would be nice if we could, without leaving the REPL, query the documentation related to a given identifier:
- documentation of a package
- documentation of a type, var, const, func, method, ...
python does it with the builtin doc()
function.
jupyter does it with a magic hook (appending ?
to an identifier)
julia does it via a dedicated mode (enabled by typing ?
at the prompt)
we could also do it by positionning the cursor on top of the identifier and hitting some special key (Shift+Tab, Ctrl+Space, or something)...
Agreed, something.
I committed a while back to sophisticated terminal emulator tricks when I added liner and used it for tab completion and history. So I'm tempted to continue in that vein and try the cursor+key trick. Vim does it with K
. I often forget the letter, and that's after 20 years of Vim, so maybe not K.
I am worried how a cursor would interact with scrolling. Right now ng doesn't mess with terminal scrolling, and it would be nice if that could still be true, even with a help cursor.
@crawshaw - very interesting project :)
However, very large docs will end up flooding the terminal and render them effectively useless. One could then argue that when the documentation
function is executing, we can implement custom controls (less
-like?) while in that mode so it feels like reading a man page.