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

fix: preserve line comments on creating/ modifying rust code #382

Merged

Conversation

c12i
Copy link
Collaborator

@c12i c12i commented Oct 2, 2024

This PR ensures line comments are preserved on modifying or creating new rust files while running scaffold commands that do so.

While this PR addresses the problem, it does open up another issue which I think is tolerable for now: Developer manually written doc comments /// will end up getting converted to line comments // on running scaffolding commands that modify this file. While the comments will still be retained, they will take on a different format. I think this minor hiccup is tolerable, I will open up another issue so that we can keep track of it an make developers aware of this peculiarity.

Extra changes:


Fixes #167
Fixes holochain/Components#47

@c12i c12i changed the title fix: preserve comments on modifying rust code fix: preserve line comments on modifying rust code Oct 2, 2024
@c12i c12i requested a review from matthme October 2, 2024 13:12
@c12i c12i marked this pull request as ready for review October 2, 2024 13:12
@c12i c12i changed the title fix: preserve line comments on modifying rust code fix: preserve line comments on creating/ modifying rust code Oct 2, 2024
Copy link
Collaborator

@matthme matthme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@c12i c12i merged commit 5bf7183 into holochain:develop Oct 4, 2024
8 checks passed
@c12i c12i added the ShouldBackport/0.3 This change should be backported to develop-0.3 label Oct 4, 2024
@c12i c12i removed the ShouldBackport/0.3 This change should be backported to develop-0.3 label Oct 17, 2024
c12i added a commit to c12i/scaffolding that referenced this pull request Oct 17, 2024
…in#382)

* Refactor un_parse_pretty function

* Move important scaffold functions to the top of the module for easy accesss

* fix improper use of bool.then_some

* ensure line comments are preserved

* derive a convert rust line comments to doc comments util function and apply to map_rust_files function

* ensure initially generated comments are correctly formatted

* remove unnecessary inline attribute on unparse_pretty

* Replace once_cell::Lazy with standard lib LazyLock
c12i added a commit that referenced this pull request Oct 22, 2024
* feat: add optional cli flag to skip test code generation (#381)

* Bump crate version

* fix: preserve line comments on creating/ modifying rust code (#382)

* Refactor un_parse_pretty function

* Move important scaffold functions to the top of the module for easy accesss

* fix improper use of bool.then_some

* ensure line comments are preserved

* derive a convert rust line comments to doc comments util function and apply to map_rust_files function

* ensure initially generated comments are correctly formatted

* remove unnecessary inline attribute on unparse_pretty

* Replace once_cell::Lazy with standard lib LazyLock

* fix: Optimize nix flake (#384)

* optimize nix flake

* Supress clippy warnings

* nix flake update

* Replace LazyCell with once_cell::Lazy

* Cargo update dprint-plugin-typescript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants