-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rhai documentation generation #18
Comments
Hi @schungx! Function metadata is definitely very useful, however when it comes to documentation I am very much looking for a parallel to tealr, Specifically the It would be amazing if rhai also had vscode supported static typing via such definition files, since then it would parallel the functionality available via I know @lenscas is working on extending tealr's functionality to apply to more than just teal definition files, so once that's complete, this could maybe be applied to rhai! |
@makspll though it will be possible for people to create their own template for type definitions (and documentation pages), keep in mind that for the foreseeable future tealr's way of storing type information very much mimics teal's syntax. That means that in order to do this you would basically need to write a parser to go from teal to rhai. It also means that some type information is lost because teal doesn't (yet) supports it. For example Option is marked the same as T. I would love to change this to something more generic but that is such a big change that I won't be able to make it myself for a long time. |
Ah, thanks for chiming in! Or help make |
There is https://github.com/rhaiscript/lsp which is in the works... it uses a Rhai-based definition file format to document functions, but still under development at this point and very raw. There is no typing support yet. I understand your point now. |
Oh this is fantastic to see, I will be keeping an eye on that project |
However, without much knowledge of Teal, but from a general overall read of the tealr README, it seems to auto-gen documentation based on actual functions code (and comments), then format said documentation into a nice view. Rhai can do that currently, via: Register function -> capture metadata as JSON -> format JSON with template engine -> web pages The LSP in the future will load this JSON and provide function docs. Unless I'm mistaken about tealr, what it provides is already available for Rhai. Also, there is |
Yes it is possible to use what's already available in rhai to generate documentation, It's just this templating step is not something I am interested in developing at this moment (writing an interface for bevy in multiple languages is alot of work), hence why I am looking for a more opinionated out-of-the box solution. rhai-doc is great, but it works the other way round to what I'd like, I want to document the API available to scripts not the other way round. Hope this makes sense. |
Ah. Understood now. Makes sense! I like OOTB solutions also!
In fact, I hear you. Unfortunately It is way simpler to use something like |
That's fair! I think another reason I don't want to roll a custom solution, is that the way documentation should look would likely end up an endless bike-shedding issue. If the It's interesting that there's not been demand, I think in this case documentation of this sort is very very important, and not just for external users and modders, but for the developer themselves since making a moddable game means writing a mod for your own game! |
Hi, I see your comment on "Rhai currently does not have any utilities existing for generating documentation (for the rust provided API), once something comes out we'll include it."
May I point you to the
metadata
feature which provides metadata (including comments) on Rust/Rhai functions: https://rhai.rs/book/engine/metadata/index.htmlThe text was updated successfully, but these errors were encountered: