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

Preserve module doc and group attributes when formatting #2626

Open
quotidian-ennui opened this issue Feb 10, 2025 · 4 comments
Open

Preserve module doc and group attributes when formatting #2626

quotidian-ennui opened this issue Feb 10, 2025 · 4 comments

Comments

@quotidian-ennui
Copy link

The documentation says I can annotate modules with doc and group (amongst other things).

bsh ❯ just
Available recipes:
  [apps]
  pihole ... # Manage the pihole configuration

  [help]
  help       # Show recipes

When we format the justfile then we lose the [doc()] and [group()] tags.

bsh ❯ just --unstable --fmt --justfile Justfile
Wrote justfile to `/home/lchan/code/personal/just-fmt-repro/Justfile`

bsh ❯ just
Available recipes:
  pihole ...

  [help]
  help       # Show recipes

bsh ❯ cat Justfile
set positional-arguments := true

mod pihole "pihole.just"

[doc("Show recipes")]
[group("help")]
@help:
    just --list --list-prefix "  "
@quotidian-ennui
Copy link
Author

The justfiles as referenced above are here : https://github.com/quotidian-ennui/just-fmt-repro

@casey
Copy link
Owner

casey commented Feb 10, 2025

Can you copy and paste the before and after of the formatted justfile?

@quotidian-ennui
Copy link
Author

Before (as per https://github.com/quotidian-ennui/just-fmt-repro/blob/main/Justfile)

set positional-arguments := true

[doc("Manage the pihole configuration")]
[group("apps")]
mod pihole "pihole.just"

[group("help")]
[doc("Show recipes")]
@help:
    just --list --list-prefix "  "

After is as per the issue details (2nd code block):

set positional-arguments := true

mod pihole "pihole.just"

[doc("Show recipes")]
[group("help")]
@help:
    just --list --list-prefix "  "

@casey casey changed the title just --fmt --justfile removes doc & group directives from modules Preserve module doc and group attributes when formatting Feb 10, 2025
@casey
Copy link
Owner

casey commented Feb 10, 2025

Thanks! This is definitely a bug.

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

No branches or pull requests

2 participants