parinfer / parinfer.js

Let's simplify the way we write Lisp
https://shaunlebron.github.io/parinfer
MIT License
1.76k stars 40 forks source link

test multiple changes #180

Closed shaunlebron closed 6 years ago

shaunlebron commented 6 years ago

Problems:

To allow both multiple and overlapping changes, I will support multiple in blocks.

```in
(foo
 +++
bar)
+++
```

```in
(foo
  bar)
++
```

```out
(foo
  bar)
```

This parses to the following data:

{
  text: "()",
  options: {
    changes: [
      {lineNo: 0, x:1, oldText: '', newText: 'foo\nbar'},  // from first `in`
      {lineNo: 1, x:0, oldText: '', newText: '  '} // from second `in`
    ]
  }
}

Some details:

shaunlebron commented 6 years ago

I forgot that multiple changes are already supported. For example:

  (foo
++
    bar)
++

For the sake of naive diff parsing, I suppose I only allowed a single contiguous diff per line. So we still need support for overlapping changes.

I updated the documentation and allowed multiple in blocks for this purpose: https://github.com/shaunlebron/parinfer/commit/d4195d8f26b6c92d65bff2af5b9d391001c251fd

shaunlebron commented 6 years ago

fixed by #181