On this page ...

Projections and Indentation

Indentation in a projection directly affects its display. Thus, in the following example literal text will appear eight spaces farther to the right than This is.

// Insurance/src/defs/editor-indentation.edit#L6-L14

Text {
[
This is
        literal text
      that is projected in the
                editor
  for every concept of type Text.
]
}

However, this is not the complete story. Any whitespace before the line with the least indentation is ignored. Therefore, you can indent the projection block as a whole without affecting its appearance. The next example produces the exact same result as the previous.

// Insurance/src/defs/editor-indentation.edit#L16-L24

Text2 {
            [
            This is
                    literal text
                  that is projected in the
                            editor
              for every concept of type Text.
            ]
}

In the following example, the line with the least indentation is for every concept of type Text. It will not be indented. On the other hand, the text This is will be indented 10 spaces, literal text will be indented 8 spaces, etc.

// Insurance/src/defs/editor-indentation.edit#L26-L34

Text3 {
    [
                 This is
               literal text
          that is projected in the
                  editor
       for every concept of type Text.
            ]
}

When determining of the least indent, the indentation of the closing bracket is also considered. Therefore, the following example will take the closing bracket as margin, and even the line for every concept of type Text. will be indented with three spaces.

// Insurance/src/defs/editor-indentation.edit#L37-L45

    [
                 This is
               literal text
          that is projected in the
                  editor
       for every concept of type Text.
    ]
}
Indentation is incremental
Any indentation applied to a property is added to the indentation of that property’s projection. Thus, when a `Text` element is used within another projection, the indentation that is defined by the projection in the definition for `Text` will be preceded by any indentation defined in the projection for the enclosing concept.
© 2018 - 2025 Freon contributors - Freon is open source under the MIT License.