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

feat: added doc-generator #3350

Closed
wants to merge 28 commits into from
Closed

Conversation

Sakapoi
Copy link

@Sakapoi Sakapoi commented Oct 30, 2023

Description

Added generator of documentation pages for Noir lang.

Problem*

Resolves #3362

Summary*

With this documentation generator, you can create Rust doc-like documentation pages for Noir lang.

Additional Context

Documentation*

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [Exceptional Case] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@ghost
Copy link

ghost commented Nov 2, 2023

I don’t think tokens are a good representation for generating documentation.

Found a couple of issues:

struct GrumpkinScalar {
    low: Field,
    high: Field,
}
thread 'main' panicked at 'attempt to subtract with overflow', tooling/doc_generator/src/output.rs:164:58
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It hangs with this code:

// Map<V>
 struct B<T_C> {}

impl<T_C> B<T_C> {
    fn new(new_concrete_t_c_constructor: fn () -> T_C) -> B<T_C> {
        B { new_concrete_t_c_constructor }
    }
}
/**/

It seems that the documentation lexer is implemented incorrectly in the fork.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: UnterminatedBlockComment { span: Span(Span { start: ByteIndex(11), end: ByteIndex(13) }) }', tooling/doc_generator/src/getters.rs:455:45
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
trait MyTrait {
}
thread 'main' panicked at 'attempt to subtract with overflow', tooling/doc_generator/src/getters.rs:304:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

it seems there are still a lot of problems, but yes

tooling/doc_generator/Cargo.toml Outdated Show resolved Hide resolved
tooling/doc_generator/src/main.rs Outdated Show resolved Hide resolved
@kevaundray
Copy link
Contributor

@f01dab1e what is the status of this PR?

@ghost
Copy link

ghost commented Dec 1, 2023

@kevaundray, I think you can do a merge

@kevaundray
Copy link
Contributor

Before merging, can you check how this looks like on aztec-package contracts? If it doesn't work, then it makes sense to create a separate issue

@ghost
Copy link

ghost commented Dec 1, 2023

@kevaundray

I wanted to share some feedback and issues I've encountered:

  • Uninformative error messages.

  • Lack of Workspace Support: Currently, there seems to be no support for workspaces. This feature would greatly enhance the user experience, especially for those handling multiple projects.

  • File Path Interface Design: The interface requires specifying the path to a file rather than to a package. This approach feels a bit unintuitive and could potentially be streamlined for better usability.

  • No Integration with nargo: I noticed that there's no integration with nargo. Implementing this could improve the workflow significantly, especially for those already relying on nargo for their projects.

  • Issues with 'mod filename': When using the 'mod filename', it doesn't function as expected. The system seems to hardcode to input_files/{module name}.nr. Removing this leads to issues due to relative paths, making it impossible to read the file correctly.

@ghost
Copy link

ghost commented Dec 1, 2023

In an HTML file, the source code of a function is sometimes distorted or simply truncated.

@TomAFrench
Copy link
Member

Looks like this is directly parsing Noir source code. This is going to add extra maintenance overhead on keeping this in sync with the main parser.

I'd like to follow librustdoc and have the docs generated from the AST

@TomAFrench TomAFrench closed this Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation generator
3 participants