parinfer

sekao 2017-01-27T01:10:55.000058Z

@cfleming i'm not actually running paren mode. it just happens to behave a bit like it. i'm using the work i previously did to figure out what the "correct" indentation is for a given line based on the tools.reader info. after every key press, i look at the subsequent lines. if they are not at their "correct" indentation level, i fix them.

sekao 2017-01-27T01:12:00.000059Z

the code doing that is all in cross-parinfer's add-indent function, which is pretty garbage and hard to read right now

cfleming 2017-01-27T01:13:59.000060Z

@sekao Interesting, thanks. Is that code somewhere I can take a look at?

cfleming 2017-01-27T01:14:25.000061Z

You’re basically just correcting indentation on the form surrounding the current change, is that correct?

sekao 2017-01-27T01:15:48.000062Z

here's the function. apologies in advance for the eye bleed 😄 https://github.com/oakes/cross-parinfer/blob/master/src/cross_parinfer/core.cljc#L89

sekao 2017-01-27T01:17:46.000064Z

i plan on refactoring soon but the readme actually mentions how to use what i call :normal mode

cfleming 2017-01-27T01:19:41.000065Z

I see, interesting. Are you using it? Does it work well in practice?

cfleming 2017-01-27T01:19:58.000066Z

I guess you adjust the indentation before running indent mode, right?

sekao 2017-01-27T01:20:06.000067Z

yes

sekao 2017-01-27T01:20:10.000068Z

you can try it here http://oakes.github.io/paren-soup/

sekao 2017-01-27T01:20:20.000069Z

i haven't really tested it enough so there could still be problems

sekao 2017-01-27T01:25:21.000070Z

the one case where it doesn't work is when typing an open delimiter to wrap existing code. that still requires manual re-indentation

tianshu 2017-01-27T08:34:13.000072Z

@sekao I met a wired behavior, I delete all content in the first textarea, then I input the following content:

(defn hello [name]
  (print "hell
 
Before I close the string quote, textarea will append one empty line at end for each character I typed in the string.

sekao 2017-01-27T17:41:37.000073Z

ah good catch, i'll check it out

sekao 2017-01-27T18:04:09.000074Z

thanks @doglooksgood i fixed the issue. if you do a force refresh on that page it should no longer have that behavior