numtide / treefmt

one CLI to format your repo [maintainers=@zimbatm,@brianmcgee]
https://treefmt.com
MIT License
614 stars 38 forks source link

Range formatting #276

Open veselyn opened 7 months ago

veselyn commented 7 months ago

Is your feature request related to a problem? Please describe.

I would like to be able to format specific ranges of files.

For example, given the following file:

if true; then
fi

if false;       then
  fi

I would be able to format only the second if statement.

Describe the solution you'd like

Two parameters for the CLI:

Additional context

A popular code editor, Neovim, has support for range formatting but it requires the formatter to have options to specify the range.

brianmcgee commented 2 months ago

If I understand correctly, this would be only used in conjunction with --stdin mode?

veselyn commented 2 months ago

If I understand correctly, this would be only used in conjunction with --stdin mode?

Correct! :)

brianmcgee commented 2 months ago

Should be easy enough to add :slightly_smiling_face: