wordplaydev / wordplay

An accessible, language-inclusive programming language and IDE for creating interactive typography on the web.
Other
61 stars 28 forks source link

Typing `:` to bind a value truncates the project file #509

Closed azmec closed 3 months ago

azmec commented 3 months ago

Expected behavior

When typing a name to bind a value to, lines of code other than the one being typed on should not be mutated.

Actual behavior

When typing a name to bind a value to, the file is truncated up to an unrelated line of code.

  1. Copy and past the below code into a Wordplay project.
    
    currentTime: Time(relative: ⊥)
    oldTime: currentTime

g: Group(Stack('>') [ Phrase("Current Time (UTC): " + currentTime → '') Phrase("Old Time (UTC): " + oldTime → '') Phrase("Delta: " + ) ])

Stage([g])


2. Below the definition for `oldTime`, type `delta`.
3. Type `:`. Observe that the file has been truncated to the line containing `Phrase("Delta: " + )`.

## Screenshots

Below is a video recording the production of the bug.

https://github.com/wordplaydev/wordplay/assets/65310073/3ded5269-3348-4fc0-9498-d00325173773

## Environment

Desktop

- OS + version: Void Linux x86_64 6.6.35_1
- Browser + version: Firefox 127.0.2_1
amyjko commented 3 months ago

Minified test case:

a
b: [
]
'c'

Type : after a and everything after the [ disappears. If there is no new line after the [, this does not happen.