Fork me on GitHub
#parinfer
<
2017-07-12
>
shaunlebron01:07:13

@cfleming: good point! I think I can just adjust result.indentDelta at commitChar since we can detect when characters are added/deleted there

shaunlebron02:07:00

@cfleming: had a chance to look at it, this kind of thing can only happen when forceBalance is true, and i did a quick sandbox test, and it seems to work well with the fix i described

shaunlebron02:07:05

pushed 3.0.1 with the fix

shaunlebron02:07:58

unfortunately none of the indentMode tests are running with forceBalance, but I made an issue to fix that and will be able to verify more fully then

shaunlebron02:07:14

@sekao: yeah, rubber-ducking is definitely what it is! I didn’t open reddit/twitter/hackernews at all, which is a miracle

cfleming02:07:37

Ok. I found a case yesterday which didn’t work correctly, at least in Atom - I haven’t had time to make a test case yet.

cfleming02:07:01

(if (or true
        false)
  (do-something))

cfleming02:07:24

If I use lisp-paredit to wrap the (or...) in parens, I get:

cfleming02:07:42

(if ((or true
          false))
  (do-something))

cfleming02:07:00

The false is indented one space too many.

rgdelato02:07:19

ah, yeah, I should note that forceBalance is defaulted to true in my fork because @chrisoakman doesn't like the v2 changes (and my fork was originally an actual PR)

shaunlebron02:07:39

@cfleming: hmm, can’t reproduce in sandbox.js. you can try this there:

console.log(parinfer.testIndentMode(`
(if ((or true
    +
        false))
              +
  (do-something))
`));

shaunlebron02:07:17

I get the following output:

(if ((or true
         false))
  (do-something))

cfleming03:07:42

@shaunlebron Ok, I’ll check it out later. It might also be a problem with the Atom integration - @rgdelato might have an idea why.

cfleming03:07:08

Possibly the changes are not in sorted order, or something like that?

shaunlebron03:07:51

actually, the changes can be given in any order I just realized, since I’m just creating a map from it

eraserhd15:07:54

Are there any notes on making better tabstops from the parinfer output?

eraserhd15:07:10

For example, when the char is (, the next nice indent is either +2 or +1+first-word-length

eraserhd15:07:43

Oh, is the open char always (x-1) on lineNo?

shaunlebron15:07:33

the tabstops are the positions of the parent open-parens

shaunlebron15:07:17

your example is the intended usage—determining your own offset from the open paren

shaunlebron15:07:25

lemme get an example

shaunlebron15:07:17

lemme know if that answers your question

eraserhd16:07:43

I love your tests, by the way. I do that sort of thing a bunch, and people usually whine about how much effort it is until they see it.

shaunlebron17:07:50

would love to see your take on these kinds of tests if public!

eraserhd17:07:44

Hmm, some are.

eraserhd17:07:22

Well, kind of. Here's from avi, a vim clone that I sort of don't work on anymore: https://github.com/maitria/avi/blob/master/test/avi/t_splits.clj#L67-L75

eraserhd17:07:08

My best was when working on iPad games. For Polar Puzzles, there were ascii characters for all the board pieces, and each case was run in all four rotations. https://itunes.apple.com/us/app/polar-puzzles-free/id450788000?mt=8