Skip to content

--fmt drops trailing comment on a recipe line #3773

Closed

Description

@chinmayajha

just --fmt drops a trailing comment on a recipe line when the recipe has a body. Trailing comments on settings, assignments, aliases and body-less recipes are kept.

x := "1" # kept

a: # kept, no body

b: a # dropped
    echo {{ x }}
$ just --fmt --check
 x := "1" # kept

 a: # kept, no body

-b: a # dropped
+b: a
     echo {{ x }}
error: formatted justfile differs from original

just --dump drops it too. Seen on 1.59.0 and on master (7b7b51b).

Looks like parse_recipe eats the comment in expect_eol() before parsing the body, while other items push it as an Item::Comment.

Activity

  1. casey commented on Nov 11, 2026

    @casey
    Owner

    Thanks for the report! Fixed in #3775.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions