treefmt icon indicating copy to clipboard operation
treefmt copied to clipboard

`cue fmt` always writes to the files

Open zimbatm opened this issue 3 years ago • 2 comments

Describe the bug

cue fmt doesn't respect the treefmt spec and writes to the file, even if no changes occurred in the formatting.

To Reproduce

Run cue fmt somefile.cue && stat somefile.cue twice and see that the timestamp has changed twice.

Expected behavior

No change.

Additional context

This seems to be a known issue with Cue already: https://github.com/cue-lang/cue/issues/363

zimbatm avatar Dec 17 '21 10:12 zimbatm

I wanted to fix upstream but at the point where the config is written back, the code has only an AST available. I think the AST would have to somehow be extended to carry a "modified" flag.

zimbatm avatar Dec 20 '21 09:12 zimbatm