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

multiple indents from wrap #173

Closed shaunlebron closed 6 years ago

shaunlebron commented 7 years ago

Parinfer does not handle the list of changes in the following example. (operation wraps and formats an expression)

Sandbox code:

const code = `
((reduce-kv (fn [m k v]
            {}
            {})))
`;

console.log(parinfer.smartMode(code, {
  changes: [
    {lineNo:1, x:0, oldText: '', newText: '('},
    {lineNo:2, x:11, oldText: '', newText: ' '},
    {lineNo:3, x:11, oldText: '', newText: ' '},
    {lineNo:3, x:16, oldText: '', newText: ')'},
  ],
}).text);

produces:

((reduce-kv (fn [m k v]
            {
            {}})))
cursive-ide commented 7 years ago

Minor nitpick - the last newText should be ) (closing paren), not (. It doesn't seem to affect the bug though.

shaunlebron commented 7 years ago

ah yes, thanks. it doesn't affect the bug because parinfer currently only uses the length of newText.