Skip to content

Add a watch mode for automatic formatting on file save #509

Open
@shikanime

Description

@shikanime

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

Yes, currently treefmt requires manual execution to format the code.

Describe the solution you'd like

I propose to add a new format watch mode to treefmt. This mode would allow treefmt to automatically format the code whenever the file is saved to disk. This could be achieved by integrating with IDEs or using a file watcher to detect changes, perhaps using watchman.

Describe alternatives you've considered

One alternative is to manually format the code after each save. However, this is inefficient and easy to forget. Another alternative is to use an IDE extension that provides automatic formatting for treefmt. However, treefmt-nix doesn't export the config file, so implementing it in every IDE would be double work.

Additional context

Afaik, it would be implementing a new walk provider that returns an unbounded number of files to process until we kill the process. If it's relevant, I have a good enough idea of how to implement it if you'd like.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions