parinfer

pez 2018-11-22T16:50:19.055100Z

There is something I am not getting with parenMode. This test is trying to confirm that relative indent is preserved:

(let [o (jsify {:cursorLine 1
                :cursorX 3
                :prevCursorLine 1
                :prevCursorX 2
                :changes {:lineNo 1
                          :x 3 
                          :oldText "" 
                          :newText " "}})
      result (parinfer/parenMode "(comment\n   (foo bar\n       baz))" o)]
  (cljify result))
=> {:text "(comment\n   (foo bar\n       baz))", :cursorX 3, :cursorLine 1, :success true, :tabStops [{:ch "(", :x 0, :lineNo 0}], :parenTrails [{:lineNo 2, :startX 10, :endX 12}]}
I am trying to simulate that that (foo is indented two spaces, then the user has entered a space, I am expecting to see baz get one more space in front of it. But it is left untouched. Only when (foo has one less space than baz does bazstart to “move”. What am doing wrong?

pez 2018-11-22T16:56:50.055200Z

I get this. :sad:

pez 2018-11-22T19:19:39.055500Z

That above gif makes it look very sluggish. It is because it was 15fps, The move of the first line happens before the second move, because I don’t know how to make vscode defer rendering until the whole operation is done. But it doesn’t really show in reality. I tried to up the fps in this gif, making it more “accurate”.