Skip to content
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

Doc comments #4140

Open
aljazerzen opened this issue Jan 29, 2024 · 7 comments
Open

Doc comments #4140

aljazerzen opened this issue Jan 29, 2024 · 7 comments
Labels
language-design Changes to PRQL-the-language

Comments

@aljazerzen
Copy link
Member

aljazerzen commented Jan 29, 2024

Followup for discussion #4110

Bottom line is that this will be the syntax for documentation comments:

  • #. doc comment for the next statement
  • #! doc comment for the parent module
  • @annotation for the next statement
  • @!annotation for the parent statement

As with annotations, doc comments can attach to any statements (variables, types, modules) and will be available in the AST. We can make a tool that extracts this information and converts it to HTML, so it can be published somehow.

ATM, this would be most useful with std.prql module, which would benefit from exposing a bit more documentation (especially with arithmetic functions).

I would ask to refrain bike-shedding the syntax, unless there is a serious concern about usability.

@aljazerzen aljazerzen added the language-design Changes to PRQL-the-language label Jan 29, 2024
@vanillajonathan
Copy link
Collaborator

I look forward to doc comments in the AST. I am working on some code to generate HTML documentation from a .prql file. I intend to integrate it with prqlc if that is okay.

@aljazerzen
Copy link
Member Author

Sure - depending on how it is written it could be maintained in this repo as well. Would you be up for doing it in rust?

@vanillajonathan
Copy link
Collaborator

Yes, it is written in Rust, and my intention is for it to be in this repo and part of the prqlc CLI tool.

@aljazerzen
Copy link
Member Author

part of the prqlc CLI tool

It will probably have a bunch of HTML-related dependencies that we probably don't as dependencies of the prqlc. Could it be a separate binary?

@vanillajonathan
Copy link
Collaborator

It will probably have a bunch of HTML-related dependencies that we probably don't as dependencies of the prqlc. Could it be a separate binary?

Yes, it could be a separate binary, however right now it doesn't have any dependencies at all, the HTML is just a string in Rust.

Like:

let mut html = String::new();

html.push_str("<html>");
html.push_str("</html>");

@aljazerzen
Copy link
Member Author

Ah, ok that makes sense - I like your approach of making the initial version simple before adding too much dependencies. It can easily be part of prqlc then! Do you need any help with integrating with prqlc CLI?

@vanillajonathan
Copy link
Collaborator

I created a PR at #4152, yes I would like some help integrating t with the prqlc CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language-design Changes to PRQL-the-language
Projects
None yet
Development

No branches or pull requests

2 participants