A superclass of FormattingOptions
where attributes are optional.
The intended use is that users take a “default” FormattingOptions
object and apply some
SparseFormattingOptions
on top of it using combinedOptions()
; this way, they don't have
to specify every option each time that they need to provide FormattingOptions
somewhere.
Anything
Object
SparseFormattingOptions
Basic
Identifiable
Object
Anything
Initializer |
SparseFormattingOptions(IndentMode? indentMode = null, Integer|Unlimited? maxLineLength = null, LineBreakStrategy? lineBreakStrategy = null, Boolean? braceOnOwnLine = null, Boolean? spaceBeforeParamListOpeningParen = null, Boolean? spaceAfterParamListOpeningParen = null, Boolean? spaceBeforeParamListClosingParen = null, Boolean? spaceAfterParamListClosingParen = null, All|{String*}? inlineAnnotations = null, Boolean? spaceBeforeMethodOrClassPositionalArgumentList = null, Boolean? spaceBeforeAnnotationPositionalArgumentList = null, Range<Integer>? lineBreaksBetweenImportElements = null, Boolean? spaceAroundImportAliasEqualsSign = null, Range<Integer>? lineBreaksBeforeLineComment = null, Range<Integer>? lineBreaksAfterLineComment = null, Range<Integer>? lineBreaksBeforeSingleComment = null, Range<Integer>? lineBreaksAfterSingleComment = null, Range<Integer>? lineBreaksBeforeMultiComment = null, Range<Integer>? lineBreaksAfterMultiComment = null, Range<Integer>? lineBreaksInTypeParameterList = null, Boolean? spaceAfterSequenceEnumerationOpeningBrace = null, Boolean? spaceBeforeSequenceEnumerationClosingBrace = null, Boolean? spaceAfterValueIteratorOpeningParenthesis = null, Boolean? spaceBeforeValueIteratorClosingParenthesis = null, Boolean? failFast = null, Boolean? spaceAfterTypeArgListComma = null, Boolean? spaceAfterTypeParamListComma = null, Boolean? spaceAroundTypeParamListEqualsSign = null, Integer? indentBeforeTypeInfo = null, Boolean? indentBlankLines = null, LineBreak? lineBreak = null, Boolean? elseOnOwnLine = null, Boolean? spaceAroundSatisfiesOf = null, Boolean? spaceAfterControlStructureKeyword = null, Integer? spaceOptionalAroundOperatorLevel = null) Parameters:
|
Attributes | |
braceOnOwnLine | shared default Boolean? braceOnOwnLine Decide whether to keep an opening brace ('{') on the same line (One True Style) or put them on the next line (Allman Style). |
elseOnOwnLine | shared default Boolean? elseOnOwnLine Decide whether if (something) { // ... } else { // ... } vs. if (something) { // ... } else { // ... } |
failFast | shared default Boolean? failFast Decide whether, in the case of an error, the formatter should attempt to recover and continue or immediately exit. This is mostly for internal use; in the finished formatter, there shouldn’t be any errors when formatting syntactically valid code. |
indentBeforeTypeInfo | shared default Integer? indentBeforeTypeInfo By how many levels For example: // 2 class Foo() extends Bar() satisfies Baz {} // vs // 1 class Foo() extends Bar() satisfies Baz {} |
indentBlankLines | shared default Boolean? indentBlankLines Decide whether blank lines should be indented or not. |
indentMode | shared default IndentMode? indentMode The indentation mode. |
inlineAnnotations | shared default All|{String*}? inlineAnnotations Decide which annotations should be on the same line as their declaration.
If you give an by ("John Doe") throws (`class Anything`) shared formal void foo(); where If the value of this option is It should be noted that the annotations can look weird if you put “inline” annotations before or between “own-line” annotations: shared by ("John Doe") formal throws (`class Anything`) void foo(); Don’t do that. (You can already see in this small example how the combination “shared by” can be potentially confusing.) |
lineBreak | shared default LineBreak? lineBreak The character(s) used to break lines, or |
lineBreakStrategy | shared default LineBreakStrategy? lineBreakStrategy The strategy to determine where lines should be broken to accomodate |
lineBreaksAfterLineComment | shared default Range<Integer>? lineBreaksAfterLineComment The range of line breaks allowed after a line comment ( Note that the minimum value of the range must be |
lineBreaksAfterMultiComment | shared default Range<Integer>? lineBreaksAfterMultiComment The range of line breaks allowed after a multi-line comment ( |
lineBreaksAfterSingleComment | shared default Range<Integer>? lineBreaksAfterSingleComment The range of line breaks allowed after a single-line multi comment ( |
lineBreaksBeforeLineComment | shared default Range<Integer>? lineBreaksBeforeLineComment The range of line breaks allowed before a line comment ( |
lineBreaksBeforeMultiComment | shared default Range<Integer>? lineBreaksBeforeMultiComment The range of line breaks allowed before a multi-line comment ( |
lineBreaksBeforeSingleComment | shared default Range<Integer>? lineBreaksBeforeSingleComment The range of line breaks allowed before a single-line multi comment ( |
lineBreaksBetweenImportElements | shared default Range<Integer>? lineBreaksBetweenImportElements The range of line breaks allowed between import elements.
import java.lang { Thread, JString=String, Runtime { runtime } }
import java.lang { Thread, JString=String, Runtime { runtime } }
import java.lang { Thread, JString=String, Runtime { runtime } } (Of course, wider ranges like |
lineBreaksInTypeParameterList | shared default Range<Integer>? lineBreaksInTypeParameterList The range of line breaks allowed in a type parameter list. |
maxLineLength | shared default Integer|Unlimited? maxLineLength The maximum line length, or |
spaceAfterControlStructureKeyword | shared default Boolean? spaceAfterControlStructureKeyword Decide whether there should be a space between a control structure keyword and its opening parenthesis. This applies to the following keywords:
|
spaceAfterParamListClosingParen | shared default Boolean? spaceAfterParamListClosingParen Decide whether to put a space after the closing parenthesis (')') of a method definition’s parameter list or not. This only applies when the parameter list is followed by a brace (as is the case for simple functions and classes). If it is instead followed by a fat arrow, a space is always added; if it’s followed by a semicolon (formal), or a comma or closing paren (parameter list of functional parameter), no space is be added. For example: |
spaceAfterParamListOpeningParen | shared default Boolean? spaceAfterParamListOpeningParen Decide whether to put a space after the opening parenthesis ('(') of a method definition’s parameter list or not. For example: |
spaceAfterSequenceEnumerationOpeningBrace | shared default Boolean? spaceAfterSequenceEnumerationOpeningBrace Decide whether there should be a space after the opening brace of a sequence enumeration. For example: |
spaceAfterTypeArgListComma | shared default Boolean? spaceAfterTypeArgListComma Decide whether there should be a space after commas in a type argument list. For example: |
spaceAfterTypeParamListComma | shared default Boolean? spaceAfterTypeParamListComma Decide whether there should be a space after commas in a type parameter list. For example: |
spaceAfterValueIteratorOpeningParenthesis | shared default Boolean? spaceAfterValueIteratorOpeningParenthesis Decide whether there should be a space after the opening parenthesis of a value iterator. For example: |
spaceAroundImportAliasEqualsSign | shared default Boolean? spaceAroundImportAliasEqualsSign Decide if there should be spaces around the equals sign ('=') of an import alias, that is import java.lang { JString=String } // vs import java.lang { JString = String } |
spaceAroundSatisfiesOf | shared default Boolean? spaceAroundSatisfiesOf Decide whether there should be spaces around satisfied interfaces and case types. For example: class MyClass() satisfies MyInterface&MyOtherInterface of CaseType1|CaseType2 { ... } vs. class MyClass() satisfies MyInterface & MyOtherInterface of CaseType1 | CaseType2 { ... } |
spaceAroundTypeParamListEqualsSign | shared default Boolean? spaceAroundTypeParamListEqualsSign Decide whether there should be a space around equals signs in a type parameter list. For example: |
spaceBeforeAnnotationPositionalArgumentList | shared default Boolean? spaceBeforeAnnotationPositionalArgumentList Decide if there should be a space in front of a positional argument list for an annotation. A positional argument list is the complement of a named argument list, i. e. what you’d probably know as simply an argument list: process.arguments.filter("--help --usage --version".split().contains); // '----------positional argument list---------' |
spaceBeforeMethodOrClassPositionalArgumentList | shared default Boolean? spaceBeforeMethodOrClassPositionalArgumentList Decide if there should be a space in front of a positional argument list for a method or class. A positional argument list is the complement of a named argument list, i. e. what you’d probably know as simply an argument list: process.arguments.filter("--help --usage --version".split().contains); // '----------positional argument list---------' |
spaceBeforeParamListClosingParen | shared default Boolean? spaceBeforeParamListClosingParen Decide whether to put a space before the closing parenthesis (')') of a method definition’s parameter list or not. For example: |
spaceBeforeParamListOpeningParen | shared default Boolean? spaceBeforeParamListOpeningParen Decide whether to put a space before the opening parenthesis ('(') of a method definition’s parameter list or not. For example: |
spaceBeforeSequenceEnumerationClosingBrace | shared default Boolean? spaceBeforeSequenceEnumerationClosingBrace Decide whether there should be a space before the closing brace of a sequence enumeration. For example: |
spaceBeforeValueIteratorClosingParenthesis | shared default Boolean? spaceBeforeValueIteratorClosingParenthesis Decide whether there should be a space before the closing parenthesis of a value iterator. For example: |
spaceOptionalAroundOperatorLevel | shared default Integer? spaceOptionalAroundOperatorLevel The maximum operator layer for which spaces are optional. If the spaces around an operator are optional, then the formatter omits them when the operator is nested within other operators, for instance: value hollowCubeVolume = w*h*d - iW*iH*iD; // (inner) width/height/depth The operator layers are listed in the Ceylon Language Specification, table 6.1; a brief summary is:
Spaces are optional around all operators of level up to the value of this option.
The default value is value sum = 1 + 2 + 3; value hollowCubeVolume = w*h*d - iW*iH*iD; // (inner) width/height/depth value allEqual = a==b && b==c && c==d; value regular = start..end; value shifted = start+offset .. end+offset; If you don’t like the look of |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Inherited Methods |
Methods inherited from: Object equals |