[ZeroBrane Studio] Re: Tooltips from LDoc comments

  • From: Paul K <paul@xxxxxxxxxxxxx>
  • To: "zerobrane@xxxxxxxxxxxxx" <zerobrane@xxxxxxxxxxxxx>
  • Date: Wed, 29 Oct 2014 11:11:21 -0700

Hi Krisztian,

> Does exist some automated way to create some in-ZBS documentation from our 
> already existing LDoc one? Or was this question answered in another thread?

Thank you for the reminder. No, there is currently no way to create
in-ZBS documentation from LDoc descriptions.

Adding this functionality would require several changes: (1) an
extension to the current parser that parses code in the editor window
(lua_parser_loose.lua) to handle LDoc style comments; (2) tracking of
parsed comments in the token list; and (3) using that token list in
populating the list of tooltip descriptions. 2 is not difficult, but 1
and 3 are non-trivial. A side benefit may be that implementing 3 could
possibly enable not only tooltips, but also auto-complete suggestions
for local and global variables as well.

Note that it may not be sufficient to parse the current file as it's
likely that the descriptions are in a different file, and that file
may not even be currently opened in the IDE. This would require either
scanning (and caching results) for all the files in the project or
checking the current file and looking for "require/loadfile/dofile"
calls to figure out what other files may need to be scanned.

I think the current best option is to have a script that converts LDoc
descriptions into the description format that ZBS recognizes. With a
bit of work, you may even be able to keep it up-to-date tracking
onEditorLoad and onEditorSave events.

Do you have an example of LDoc comments in your code and what you'd
expect to see in the tooltip?

Paul.

Other related posts: