-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Tracking for the new formatter:
The design of
rustfmtis to leave code functionality in tact, but also do more than just move white space. For instance,
long generic parameters can be cleaned up with awhereclause addition and formatting of those parameters after it. I
think that's a really great characteristic that keeps code uniform and even teaches users the standard practices.It uses an
ASTfor most of the formatting, but for macros it uses tokens or otherwise leaves them untouched. Most macros aren't formatted, unless necessary like theformat!macro since it takes in variables that result in aString.
rustfmtcan recognize when something won't benefit from being formatted and opts that portion of the code out of the formatting process. If code doesn't fit the conditions of what would need formatting, e.g. a user created diagram, then it will
just leave it alone.
Please feel free to hop in and take on some of this if it interests you:
- husk of the formatter, config settings &
swayfmt.tomlAdded foundation forsway-fmtv2 #1425 Addsforc-fmt-v2plugin #1803 @eureka-cpu - imports Adds
ItemUsetosway-fmt-v2#2295 @eureka-cpu - literals @eureka-cpu
- whitespace sway-fmt-v2 should be able to handle indentations correctly. #1888 Adds associated functions for
NewlineStyle#1894 Adds associated functions for handling of indentation #1911 @eureka-cpu - expressions Add
exprformatting tosway-fmt-v2#2338 @eureka-cpu - collections @eureka-cpu
- user defined @kayagokalp
- items
- abi Add
abihandling tosway-fmt-v2#2043 Addabihandling tosway-fmt-v2#2044 @eureka-cpu - const sway-fmt-v2 should be able to format consts #2005 @kayagokalp
- enum
swayfmtv2 should be able to format enums #1873 @kayagokalp - fn Adds
ItemFnformatting tosway-fmt-v2#2173 @eureka-cpu - impl Adds
implformatting tosfv2#2403 @eureka-cpu - storage Add
storageformatting tosway-fmt-v2#2069 @kayagokalp - struct
sway-fmt-v2should be able to formatstructs#2053 @kayagokalp - trait Adds
ItemTraittosway-fmt-v2#2294 @eureka-cpu - use Adds
ItemUsetosway-fmt-v2#2295 @eureka-cpu - comments ( blocker:
sway-parseonly lexes comments, and doesn't give spans #1517 ) @mitchmindtree & @kayagokalp (Add means of comment formatting tosway-fmt-v2#2229, Inserting Comments #2311) breakandcontinueHandlebreakandcontinueinsway-fmt-v2#2118 (pendingbreakandcontinue#2112) @eureka-cpu
- abi Add
- attributes Add
attributehandling tosway-fmt-v2#2012 Addsattributehandling tosway-fmt-v2#2061 @eureka-cpu - Contract call arguments: Formatting contract call arguments #992 Add
exprformatting tosway-fmt-v2#2338 @eureka-cpu - long conditionals Adds formatting for long conditional statements #2597 @eureka-cpu
swayfmt's goal is to be somewhat transparent. It should format Sway code to our standards, and if the user so decides it, they can add a swayfmt.toml to their root dir and it will assume only the changes present, and leave the rest to default.
Once completed add to CI documentor: #1806
Metadata
Metadata
Assignees
Labels
Type
Projects
Status