Fork me on GitHub
#parinfer
<
2017-01-27
>
sekao01:01:55

@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.

sekao01:01:00

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

cfleming01:01:59

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

cfleming01:01:25

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

sekao01:01:48

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

sekao01:01:46

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

cfleming01:01:41

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

cfleming01:01:58

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

sekao01:01:20

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

sekao01:01:21

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

tianshu08:01:13

@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.

sekao17:01:37

ah good catch, i'll check it out

sekao18:01:09

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