parinfer

tianshu 2018-02-18T16:51:47.000107Z

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.

shaunlebron 2018-02-18T16:53:51.000013Z

@doglooksgood sorry, I meant to send you this yesterday: https://github.com/shaunlebron/parinfer/blob/master/lib/test/cases/smart-mode.md#leading-close-parens

shaunlebron 2018-02-18T16:54:23.000027Z

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

shaunlebron 2018-02-18T17:04:06.000069Z

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

shaunlebron 2018-02-18T17:04:39.000006Z

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

shaunlebron 2018-02-18T17:07:57.000063Z

actually, that’s wrong

shaunlebron 2018-02-18T17:08:51.000011Z

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

shaunlebron 2018-02-18T17:09:21.000004Z

so paren-mode does all the handling of those cases

shaunlebron 2018-02-18T17:10:14.000121Z

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

tianshu 2018-02-18T17:15:46.000001Z

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

(
 |)

tianshu 2018-02-18T17:18:02.000064Z

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.

shaunlebron 2018-02-18T17:27:17.000061Z

there are two questions there

shaunlebron 2018-02-18T17:28:47.000037Z

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

shaunlebron 2018-02-18T17:29:34.000066Z

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

shaunlebron 2018-02-18T17:29:55.000111Z

it’s not great

shaunlebron 2018-02-18T17:30:53.000055Z

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

()
|)
 ^ error: imbalanced

shaunlebron 2018-02-18T17:33:47.000051Z

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?

shaunlebron 2018-02-18T17:34:57.000059Z

example, here:

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

shaunlebron 2018-02-18T17:39:50.000046Z

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.

shaunlebron 2018-02-18T17:42:23.000021Z

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

shaunlebron 2018-02-18T17:42:45.000036Z

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

shaunlebron 2018-02-18T17:43:18.000096Z

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

shaunlebron 2018-02-18T17:44:08.000071Z

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

shaunlebron 2018-02-18T17:44:57.000075Z

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

shaunlebron 2018-02-18T17:46:08.000071Z

@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

shaunlebron 2018-02-18T17:49:17.000037Z

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

shaunlebron 2018-02-18T17:50:39.000058Z

reported in #community-development

seancorfield 2018-02-18T17:57:54.000016Z

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

shaunlebron 2018-02-18T18:27:02.000136Z

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

shaunlebron 2018-02-18T18:27:14.000031Z

it’ll take a while

shaunlebron 2018-02-18T18:29:33.000012Z

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

martinklepsch 2018-02-18T19:01:13.000099Z

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 🙂

shaunlebron 2018-02-18T21:07:42.000006Z

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

tianshu 2018-02-18T22:14:51.000165Z

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

tianshu 2018-02-18T22:45:36.000097Z

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.

martinklepsch 2018-02-18T22:47:41.000108Z

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

shaunlebron 2018-02-18T23:55:09.000084Z

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