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

"Preview/Initial"- Version sourcecode formatting feature #626

Merged
merged 23 commits into from Feb 26, 2024

Conversation

turleypol
Copy link
Member

@turleypol turleypol commented Feb 23, 2024

ecompile is now able to format files "-F" will output the result to stdout, "-Fi" will rewrite directly the file. The existing -A or -r are supported.
ecompile.cfg has several new settings to define the formatting

  • newline settings at eof
  • core-changes

KevinEady and others added 16 commits February 23, 2024 18:39
//LineWidth
FormatterLineWidth 80
// keep original keyword spelling
FormatterKeepKeywords 0
// number of spaces for ident
FormatterIdentLevel 2
// multiple newlines get merged to a single
FormatterMergeEmptyLines 1
// space between emtpy parenthesis eg foo() vs foo( )
FormatterEmptyParenthesisSpacing 0
// space between emtpy brackets eg struct{} vs struct{ }
FormatterEmptyBracketSpacing 0
// space after/before parenthesis in conditionals
// eg if ( true ) vs if (true)
FormatterConditionalParenthesisSpacing 1
// space after/before parenthesis
// eg foo( true ) vs foo(true)
FormatterParenthesisSpacing 1
// space after/before brackets
// eg array{ true } vs array{true}
FormatterBracketSpacing 1
// add space after delimiter comma or semi in for loops
// eg {1, 2, 3} vs {1,2,3}
FormatterDelimiterSpacing 1
// add space around assignment
// eg a := 1; vs a:=1;
FormatterAssignmentSpacing 1
// add space around comparison
// eg a == 1 vs a==1
FormatterComparisonSpacing 1
// add space around operations
// eg a + 1 vs a+1
FormatterOperatorSpacing 1
// use \r\n as newline instead of \n
FormatterWindowsLineEndings 0
// use tabs instead of spaces
FormatterUseTabs 0
// tab width
FormatterTabWidth 4
fixed line comments in group splitting
Comments get directly stored as FmtToken
started with a context enum
added check that all comments/rawlines got parsed
@coveralls
Copy link
Collaborator

coveralls commented Feb 23, 2024

Coverage Status

coverage: 52.496% (+0.6%) from 51.862%
when pulling 0f49e1b on escript-formatting-master
into a38d83b on master.

KevinEady
KevinEady previously approved these changes Feb 26, 2024
Copy link
Contributor

@KevinEady KevinEady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉

@turleypol turleypol merged commit 7627e3d into master Feb 26, 2024
68 checks passed
@turleypol turleypol deleted the escript-formatting-master branch February 26, 2024 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants