parinfer

shaunlebron 2017-07-12T01:40:13.206109Z

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

shaunlebron 2017-07-12T02:17:00.629700Z

@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

shaunlebron 2017-07-12T02:17:05.630701Z

pushed 3.0.1 with the fix

shaunlebron 2017-07-12T02:17:58.640080Z

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

shaunlebron 2017-07-12T02:21:14.675782Z

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

cfleming 2017-07-12T02:21:37.680183Z

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.

cfleming 2017-07-12T02:22:01.684817Z

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

cfleming 2017-07-12T02:22:24.689129Z

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

cfleming 2017-07-12T02:22:42.692483Z

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

cfleming 2017-07-12T02:23:00.695335Z

The false is indented one space too many.

cfleming 2017-07-12T02:24:40.713554Z

@shaunlebron ^^

rgdelato 2017-07-12T02:27:19.742585Z

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)

shaunlebron 2017-07-12T02:41:39.899752Z

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

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

shaunlebron 2017-07-12T02:42:17.906256Z

I get the following output:

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

cfleming 2017-07-12T03:03:42.138987Z

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

cfleming 2017-07-12T03:04:08.143496Z

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

shaunlebron 2017-07-12T03:27:51.383907Z

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

eraserhd 2017-07-12T15:30:54.561186Z

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

eraserhd 2017-07-12T15:32:10.610919Z

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

eraserhd 2017-07-12T15:36:43.789352Z

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

shaunlebron 2017-07-12T15:37:33.821096Z

the tabstops are the positions of the parent open-parens

shaunlebron 2017-07-12T15:38:17.849171Z

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

shaunlebron 2017-07-12T15:41:25.970366Z

lemme get an example

shaunlebron 2017-07-12T15:45:25.125632Z

@eraserhd the test cases for tabstops shows examples of where the tabstops are: https://github.com/shaunlebron/parinfer/blob/master/lib/test/cases/indent-mode.md#tab-stops

shaunlebron 2017-07-12T15:46:17.159618Z

lemme know if that answers your question

eraserhd 2017-07-12T16:52:11.529577Z

yup

eraserhd 2017-07-12T16:52:43.548570Z

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.

👍 1
shaunlebron 2017-07-12T17:05:50.002526Z

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

eraserhd 2017-07-12T17:11:44.196832Z

Hmm, some are.

eraserhd 2017-07-12T17:14:22.283658Z

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

eraserhd 2017-07-12T17:14:56.302661Z

I was trying to rewrite them to do this: https://github.com/maitria/avi/blob/master/test/spec.txt

eraserhd 2017-07-12T17:17:08.375772Z

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