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 dedents from reformat #179

Closed cursive-ide closed 6 years ago

cursive-ide commented 6 years ago

While testing the multi-change-bug branch, I found the following problem. I reformatted this:

{:a                 {:b              (Integer/valueOf (-> ""
                                                          (.length)))}}

expecting to get this:

{:a {:b (Integer/valueOf (-> ""
                             (.length)))}}

However parinfer breaks this code to look like this:

{:a {:b (Integer/valueOf (-> "")
                             (.length))}}

Sandbox repro code:

const code = `
{:a {:b (Integer/valueOf (-> ""
                             (.length)))}}
`;

console.log(parinfer.smartMode(code, {
  changes: [
    {lineNo:1, x:4, oldText: '                ', newText: ''},
    {lineNo:1, x:8, oldText: '             ', newText: ''},
    {lineNo:2, x:29, oldText: '                             ', newText: ''},
  ],
}).text);
shaunlebron commented 6 years ago

fixed by #181