You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| noBsfmt |`boolean`|`false`| Don't read a bsfmt.json file |
69
69
| bsfmtPath |`string`|`undefined`| Use a specified path to bsfmt.json instead of the default |
70
70
||||
71
-
All boolean, string, and integer [`bsfmt.json`](#bsfmtjson-options) options are supported as well. Complex options such as `keywordCaseOverride`or `typeCaseOverride` are not currently supported via the CLI and should be provided in the `bsfmt.json` or through the node API. Feel free to [open an issue](https://github.com/rokucommunity/brighterscript-formatter/issues/new) if you would like to see support for these options via the CLI.
71
+
All boolean, string, and integer [`bsfmt.json`](#bsfmtjson-options) options are supported as well. Complex options such as `keywordCaseOverride`, `typeCaseOverride`, `specificKeywordCaseOverride`, or `specificTypeCaseOverride` are not currently supported via the CLI and should be provided in the `bsfmt.json` or through the node API. Feel free to [open an issue](https://github.com/rokucommunity/brighterscript-formatter/issues/new) if you would like to see support for these options via the CLI.
72
72
73
73
74
74
@@ -83,7 +83,9 @@ All boolean, string, and integer [`bsfmt.json`](#bsfmtjson-options) options are
83
83
|compositeKeywords|`"split", "combine", "original"`|`"split"`| Forces all composite keywords (i.e. `elseif`, `endwhile`, etc...) to be consistent. If `"split"`, they are split into their alternatives (`else if`, `end while`). If `"combine"`', they are combined (`elseif`, `endwhile`). If `"original"` or falsey, they are not modified. |
84
84
|removeTrailingWhiteSpace|`boolean`|`true`| Remove (or don't remove) trailing whitespace at the end of each line |
85
85
|[keywordCaseOverride](#keywordCaseOverride)|`object`|`undefined`| Provides a way to override keyword case at the individual TokenType level|
86
-
|[typeCaseOverride](#typeCaseOverride)|`object`|`undefined`| Provides a way to override type keyword case at the individual TokenType level.Types are defined as keywords that are preceded by an `as` token.|
86
+
|[typeCaseOverride](#typeCaseOverride)|`object`|`undefined`| Provides a way to override type keyword case at the individual TokenType level. Types are defined as keywords that are preceded by an `as` token.|
87
+
|[specificKeywordCaseOverride](#specificKeywordCaseOverride)|`object`|`undefined`| Provides a way to override keyword case with a specific string at the individual keyword level|
88
+
|[specificTypeCaseOverride](#specificTypeCaseOverride)|`object`|`undefined`| Provides a way to override type keyword case with a specific string at the individual keyword level. Types are defined as keywords that are preceded by an `as` token. This accepts specific casing strings rather than case options like "upper" or "lower".|
87
89
|formatInteriorWhitespace|`boolean`|`true`| All whitespace between items is reduced to exactly 1 space character and certain keywords and operators are padded with whitespace. This is a catchall property that will also disable the following rules: `insertSpaceBeforeFunctionParenthesis`, `insertSpaceBetweenEmptyCurlyBraces`, `insertSpaceAroundParameterAssignment`, `insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces`|
88
90
|insertSpaceBeforeFunctionParenthesis|`boolean`|`false`| If true, a space is inserted to the left of an opening function declaration parenthesis. (i.e. `function main ()` or `function ()`). If false, all spacing is removed (i.e. `function main()` or `function()`).|
89
91
|insertSpaceBetweenEmptyCurlyBraces|`boolean`|`false`| If true, empty curly braces will contain exactly 1 whitespace char (i.e. `{ }`). If false, there will be zero whitespace chars between empty curly braces (i.e. `{}`) |
@@ -128,6 +130,33 @@ For more flexibility in how to format the case of types, you can specify the cas
128
130
129
131
A type is any token found directly after an `as` keyword.
130
132
133
+
### specificKeywordCaseOverride
134
+
For more flexibility in how to format the case of keywords, you can specify the case value preference for each individual keyword. Here's an example:
135
+
136
+
```js
137
+
{
138
+
"specificKeywordCaseOverride": {
139
+
"longinteger":"longInteger",
140
+
"endif":"EndIF"
141
+
}
142
+
}
143
+
```
144
+
145
+
The full list of keywords detected by this option can be found [here](https://github.com/rokucommunity/brighterscript-formatter/blob/095f9dc5ec418d46d3ea6197712f5d11f71d922f/src/Formatter.ts#L1145).
146
+
147
+
### specificTypeCaseOverride
148
+
For more flexibility in how to format the case of types, you can specify the case value preference for each individual type. Here's an example:
149
+
150
+
```js
151
+
{
152
+
"specificTypeCaseOverride": {
153
+
"longinteger":"LongInteger"
154
+
}
155
+
}
156
+
```
157
+
158
+
A type is any token found directly after an `as` keyword.
Copy file name to clipboardExpand all lines: bsfmt.schema.json
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -58,6 +58,14 @@
58
58
"default": true,
59
59
"description": "Removes all trailing whitespace at the end of each line."
60
60
},
61
+
"specificKeywordCaseOverride": {
62
+
"type": "object",
63
+
"description": "Allows overriding specific keywords at the individual keyword level.\nExample {\"longinteger\": \"LongInteger\"} would make longinteger LongInteger"
64
+
},
65
+
"specificTypeCaseOverride": {
66
+
"type": "object",
67
+
"description": "Allows overriding specific types at the individual type level.\nExample {\"longinteger\": \"longInteger\"} would make longinteger longInteger"
68
+
},
61
69
"keywordCaseOverride": {
62
70
"type": "object",
63
71
"description": "Allows overriding case at the individual keyword level.\nExample {\"string\": \"title\"} would make string always lower case regardless of keywordCase",
0 commit comments