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

feat(forc-fmt): enhance forc-fmt --path behaviour flexibility #4152

Open
eightfilms opened this issue Feb 22, 2023 · 0 comments
Open

feat(forc-fmt): enhance forc-fmt --path behaviour flexibility #4152

eightfilms opened this issue Feb 22, 2023 · 0 comments
Labels
enhancement New feature or request formatter
Milestone

Comments

@eightfilms
Copy link
Contributor

eightfilms commented Feb 22, 2023

In this PR I discovered that there was some bug introduced with a previous PR i made refactoring forc-fmt. We should enhance the flexibility of forc-fmt to allow different behavior based on the --path input:

  1. If --path points to a sway file, it only formats that file.
  2. If --path points to a directory, it walks the directory and formats all sway files within.
  3. If --path points to a package manifest, it only formats the source of that package.
  4. If --path points to a workspace manifest, if formats all the member packages.

Currently forc-fmt only works on point 2. A PR should be opened to address 3 and 4.

As for 1, Further conversations with @mitchmindtree has also led to some insights regarding the desired behaviour of forc-fmt, which was emulated after cargo fmt:

cargo fmt is meant to work on workspaces/manifests and rustfmt is more primitive in the sense that it accepts only a file/list of files to format. In our case, we do not distribute swayfmt + forc-fmt. A previous PR i made introduced single file formatting file forc fmt <PATH_TO_FILE>. This is to emulate rustfmt.

I was thinking if we should keep this behavior, but I think for consistency's sake, we should also include --path for single file formatting.

@eightfilms eightfilms self-assigned this Feb 22, 2023
@mitchmindtree mitchmindtree changed the title feat(forc-fmt): enhance forc-fmt flexibility feat(forc-fmt): enhance forc-fmt --path behaviour flexibility Feb 22, 2023
@eightfilms eightfilms removed their assignment Feb 22, 2023
@eureka-cpu eureka-cpu added this to the swayfmt milestone Sep 19, 2023
@JoshuaBatty JoshuaBatty added the enhancement New feature or request label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request formatter
Projects
None yet
Development

No branches or pull requests

3 participants