-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42129 from poorna2152/formatter
Add support to provide formatting configurations through a configuration file
- Loading branch information
Showing
158 changed files
with
3,470 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
language-server/modules/langserver-core/src/test/resources/formatting/project/Ballerina.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[format] | ||
configPath = "Format.toml" |
13 changes: 13 additions & 0 deletions
13
language-server/modules/langserver-core/src/test/resources/formatting/project/Format.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[indent] | ||
indentSize = 2 | ||
|
||
[wrapping] | ||
maxLineLength = 80 | ||
simpleBlocksInOneLine = true | ||
simpleFunctionsInOneLine = true | ||
|
||
[functionDefinition] | ||
alignMultilineParameters = true | ||
|
||
[ifStatement] | ||
elseOnNewLine = true |
15 changes: 15 additions & 0 deletions
15
language-server/modules/langserver-core/src/test/resources/formatting/project/main.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
function getDateFormatIncludingDayName (string year,int month,int day, int dayNumber ) returns string { | ||
string? text = () ; | ||
match dayNumber { | ||
1 => {text = "Sunday";} | ||
2 => { text = "Monday";} | ||
3 => { text = "Tuesday"; } | ||
4 => {text = "Wednesday";} | ||
5 => {text = "Thursday" ;} | ||
6 => {text = "Friday";} | ||
7 => {text = "Saturday" ;} | ||
} | ||
if text !is () { return string`${year} ${month} ${text} ${day}`; | ||
} | ||
else { return string`${year} ${month} ${day}`; } | ||
} |
17 changes: 17 additions & 0 deletions
17
...age-server/modules/langserver-core/src/test/resources/formatting/projectExpected/main.bal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
function getDateFormatIncludingDayName(string year, int month, int day, | ||
int dayNumber) returns string { | ||
string? text = (); | ||
match dayNumber { | ||
1 => { text = "Sunday"; } | ||
2 => { text = "Monday"; } | ||
3 => { text = "Tuesday"; } | ||
4 => { text = "Wednesday"; } | ||
5 => { text = "Thursday"; } | ||
6 => { text = "Friday"; } | ||
7 => { text = "Saturday"; } | ||
} | ||
if text !is () { | ||
return string `${year} ${month} ${text} ${day}`; | ||
} | ||
else { return string `${year} ${month} ${day}`; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.