Especially unexperienced MPS users often try to type too much text without pressing Ctrl-Space, or type at incorrect places ("red text").
MPS stores these entries at some weird places, but not with the model. Thus, the unbound text is not part of version control, cannot be shared, etc.
How do we handle this in LIonWeb?
Option A: Don't store
Do the same as MPS: Assume the "red text" is not part of the model.
(A tool might keep track of it independent of the model.)
Pro:
- Compatible with MPS
- No weird structures in serialization
Con:
- Our tool either "forgets" user input, or needs additional storage
Option B: Extra serialization entry per node
A tool finds the "closest" node for each invalid text, and stores the text (+ some localization info) with the node.
Example:
M2:
concept Person
property name: String
property age: Int
containment address: Address
concept Address
property street: String
property city: String
Projection (plain: constant text, italic: user input, bold: error):
My firstname is Alice with age of 29years, I live in main streetAvenue in Tokyo.
[
{
"type": "Person",
"id": "aaaa",
"properties": {
"name": "Alice",
"age": "29"
},
"children": {
"address": [
"bbbb"
]
},
"redText": [
{
"position": "projection start + 3 characters",
"text": "first"
},
{
"position": "after age property",
"text": "years"
}
]
},
{
"type": "Address",
"id": "bbbb",
"properties": {
"street": "main",
"city": "Tokyo"
},
"redText": [
{
"position": "+7",
"text": "Avenue"
}
]
}
]
Pro:
- Keeps red text context as much as possible
- No additional storage needed
- Non-model content clearly separated
Con:
- Position info depends on projection
- Complicates serialization format
Option C: Annotation on node
Assumes we support annotations
Same as option B, but store redText entry as annotation to the node (instead of separate member in the node serialization).
Pro:
- Keeps red text context as much as possible
- No additional storage needed
- Less invasive on serialization format
Con:
Option D: Store globally with model
Keep a list of "redText" separate of nodes in serialization.
Pro:
- Don't need to find context node
Con:
- No scoping: If we request only a part of the model, we always have to send all red text known to the whole system
- position info gets even more complicated
Especially unexperienced MPS users often try to type too much text without pressing Ctrl-Space, or type at incorrect places ("red text").
MPS stores these entries at some weird places, but not with the model. Thus, the unbound text is not part of version control, cannot be shared, etc.
How do we handle this in LIonWeb?
Option A: Don't store
Do the same as MPS: Assume the "red text" is not part of the model.
(A tool might keep track of it independent of the model.)
Pro:
Con:
Option B: Extra serialization entry per node
A tool finds the "closest" node for each invalid text, and stores the text (+ some localization info) with the node.
Example:
M2:
Projection (plain: constant text, italic: user input, bold: error):
[ { "type": "Person", "id": "aaaa", "properties": { "name": "Alice", "age": "29" }, "children": { "address": [ "bbbb" ] }, "redText": [ { "position": "projection start + 3 characters", "text": "first" }, { "position": "after age property", "text": "years" } ] }, { "type": "Address", "id": "bbbb", "properties": { "street": "main", "city": "Tokyo" }, "redText": [ { "position": "+7", "text": "Avenue" } ] } ]Pro:
Con:
Option C: Annotation on node
Assumes we support annotations
Same as option B, but store
redTextentry as annotation to the node (instead of separate member in the node serialization).Pro:
Con:
Option D: Store globally with model
Keep a list of "redText" separate of nodes in serialization.
Pro:
Con: