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
[New Feature]: Formatting a Ballerina module through project-level configurations #41280
Comments
Configuration ParametersThe configuration parameters that can be set using the General
|
+1 for the idea of having formatter-specific configurations in We need a way to provide the formatted configuration via an external file. Here is an example Ballerina.tomlformat.configPath = "https://foo.abc.com/bal-format.toml" |
We had an internal meeting and decided that we should as per the previous comment have a separate |
Updated formatting configurations following intellij and checkstyle naming configurations Formatting ConfigurationsTab and Indent
LineWrap
Brace Placement
Method Declaration Parameters
Method Call Parameters
If Statement
Spacing
Example Configuration[indent]
indentSize = 4
continuationIndentSize = 8
[wrapping]
maxLineLength = 120
simpleBlocksInOneLine = true
simpleMethodsInOneLine = true
[braces]
classBraceStyle = "NewLine"
methodBraceStyle = "NewLine"
[methodDeclaration]
parametersWrap = "ChopDown"
alignMultilineParameters = true
newLineAfterLeftParen = false
rightParenOnNewLine = false
[methodCall]
parametersWrap = "Wrap"
alignMultilineParameters = false
newLineAfterLeftParen = false
rightParenOnNewLine = false
[ifStatement]
elseOnNewLine = false
[spacing]
afterTypeCast = true
aroundRecordBraces = true
[import]
groupImports=true
sortImports=true
[query]
alignMultiLineQueries=false
|
Are we going to use same config names for this formatter? Shouldnt we reword them with our own wording? @sameerajayasoma |
I prefer to use familiar terms when possible to maintain familiarity. WDYT? |
How can I specify the path to this file? Do we have an opinionated filename for this file? |
The |
How can I specify this file path? I believe having an opinionated filename would be better. |
In the existing implementation you can specify the path to the toml configuration file within the
Example ballerina project with a We can give an opinionated file name like |
+1 for an opinionated file like Here are the semantics derived from what you've already specified in the previous comment:
If the format config path is an HTTP URL, then we should keep a cache inside the target directory. |
We seem to be using |
Also, under methodCall (or functionCall depending on what we decide to call it), we have parametersWrap and alignMultilineParameters. I think we should use argument instead of parameter? |
Description
Add a section to the
Ballerina.toml
file which contain project-level formatting configurations. As a starting point provide capability to set maximum character limit on a code line using theBallerina.toml
file. Further modify this to include more configuration parameters.Describe your problem(s)
No response
Describe your solution(s)
No response
Related area
-> Compilation
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: