Fork me on GitHub
#parinfer
<
2018-02-18
>
tianshu16:02:47

finally solved this. the logic still have some difference with the official version, but going to add tests to make current version usable and stable before going any further.

shaunlebron16:02:23

those are all the test cases I use to describe leading closers in smart mode

shaunlebron17:02:06

@doglooksgood in answer to your last question, the cursor holds the parens in position

shaunlebron17:02:39

whenever a close-paren is detected at the beginning of the line without a cursor to its left, paren-mode is run

shaunlebron17:02:57

actually, that’s wrong

shaunlebron17:02:51

when a leading close-paren is found, it exits to paren-mode

shaunlebron17:02:21

so paren-mode does all the handling of those cases

shaunlebron17:02:14

and that logic is just a single call to isCursorLeftOf to determine whether to keep the close-paren where it is, or to append it to the previous line

tianshu17:02:46

@shaunlebron i'm curious why smart mode not allow delete anymore in this case

(
 |)

tianshu17:02:02

when i have multiple close paren here, i move cursor right, one cursor will go to the trail position. but how can i get it back? i think this is kind of inconvenient.

shaunlebron17:02:17

there are two questions there

shaunlebron17:02:47

first question: why can’t you press delete at that position? paren-mode handles all cases with leading close-parens because I don’t know how else to fix all the edge cases related to them

shaunlebron17:02:34

this in turn constrains the indentation to keep the leading close-paren valid

shaunlebron17:02:55

it’s not great

shaunlebron17:02:53

but I don’t know if producing this is any better:

()
|)
 ^ error: imbalanced

shaunlebron17:02:47

second question: with multiple leading close-parens being held by the cursor, then moving cursor to the right, how do you move the displaced close-paren back to where it was before moving the cursor?

shaunlebron17:02:57

example, here:

{[(
    )]}
    ^ cursor before this character
then after moving cursor to right:
{[()
   ]}
   ^ cursor before this character

shaunlebron17:02:50

answer: I really want to communicate that the cursor is responsible for holding these parens in place. this is part of the language that is consistent to a few other areas.

shaunlebron17:02:23

I’m not sure what the use-case is for keeping it in place

shaunlebron17:02:45

i only keep the parens in place in this example because the user could be typing something there

shaunlebron17:02:18

but when the cursor leaves, that’s no longer true, so it is a paren whose position has to be normalized

shaunlebron17:02:08

and I can only use the cursor position to denote where the user may be typing

shaunlebron17:02:57

we should be asking these type of detailed questions in this forum so the discussion doesn’t disappear: http://parinfer.trydiscourse.com/

shaunlebron17:02:08

@doglooksgood do you want to ask your future questions there so I can answer in good detail in a more permanent place? you have really good questions

shaunlebron17:02:17

i noticed that our @logbot stopped logging our chats in november of last year 😞 https://clojurians-log.clojureverse.org/parinfer/index.html

shaunlebron17:02:39

reported in #community-development

seancorfield17:02:54

@logbot is still logging everything. The website that displays the logs is broken.

shaunlebron18:02:02

i’m moving the discourse channel to http://talk.parinfer.io/

shaunlebron18:02:14

it’ll take a while

shaunlebron18:02:33

i decided against putting it in clojureverse since it won’t be clojure-specific in the future (cc: @martinklepsch )

martinklepsch19:02:13

If you did it to not shy away people not looking for Clojure specifically, makes perfect sense 👍 If you did it because you think it would not be appropriate on ClojureVerse long-term we could have talked about it beforehand 🙂

shaunlebron21:02:42

it doesn’t make sense for a racket user to ask questions about parinfer in clojureverse for example

martinklepsch22:02:41

Yeah, that’s what I meant with the first, sounds sensible 🙂

shaunlebron23:02:09

cool. i do like the idea of all clojure-related projects having discussions there. i’ll try to advocate for that when I see the opportunity

tianshu22:02:51

@shaunlebron Hi, i just had a sleep. I'd like to move this stuff to a better place.

tianshu22:02:36

just for this question, I noticed parinfer v1 has a option called preview cursor scope, I can't remember it very clearly. but I think it's when i delete the critical indent whitespace, the close paren will move up, and If I insert the whitespace, the close paren will come back. Is that true? If it is, why don't act like that? I've been thinking for a while, because I write parinfer-mode with my understanding instead of port it function by funtion, I wonder if there's some serious rules here, so we can tell users how parinfer work in few semtences.