parinfer

cfleming 2018-02-15T22:34:18.000244Z

@shaunlebron I’m looking at the thing we talked about the other day, where in Atom having a selection means that smart mode is disabled.

cfleming 2018-02-15T22:35:00.000428Z

This is tricky again in IntelliJ because of the many-many mapping between editors and documents.

cfleming 2018-02-15T22:35:26.000501Z

I’m thinking about disabling smart mode for processing a particular document, when any editor looking at that document has a selection.

cfleming 2018-02-15T22:35:59.000207Z

Either that, or just not implementing that feature, and then the user would have to indent the lines they want and then outdent the following lines.

cfleming 2018-02-15T22:36:16.000317Z

Which isn’t ideal, but is at least predictable in tricky cases.

cfleming 2018-02-15T22:36:53.000048Z

Any opinions?

shaunlebron 2018-02-16T22:23:29.000263Z

yeah, I don’t think there’s an ideal solution for intellij then

shaunlebron 2018-02-16T22:24:03.000306Z

when a selection is made, it’s hypothetically nice to fallback to indent mode

shaunlebron 2018-02-16T22:24:19.000009Z

so maybe exposing that as a mode?

shaunlebron 2018-02-16T22:24:29.000345Z

i don’t like that idea either honestly

shaunlebron 2018-02-16T22:25:01.000048Z

might be best to look at actual problem cases and go from there

cfleming 2018-02-18T21:10:41.000068Z

I actually have dedicated indent/dedent actions for indenting/dedenting lines. I think the best solution is for those to adjust the parens as part of the action itself.

cfleming 2018-02-18T21:11:18.000032Z

That should cover all cases I can think of, since indenting/dedenting with space/backspace can’t work with the selection active.

shaunlebron 2018-02-18T21:14:10.000043Z

i’m not following, an example would help

cfleming 2018-02-18T21:15:16.000103Z

So the cases that require this handling are basically indenting and dedenting selected lines, per the last example in your video.

cfleming 2018-02-18T21:15:53.000068Z

In Cursive, that indenting and dedenting use custom actions that I wrote, since they handle the indenting to indent points.

cfleming 2018-02-18T21:16:58.000081Z

What I can do is just move the parens around as in indent mode as part of those actions, that will effectively mean that those actions (and just those actions) will have the indent mode behaviour.

cfleming 2018-02-18T21:17:14.000087Z

Does that make sense?

shaunlebron 2018-02-18T21:24:00.000037Z

yeah that makes sense, so you’re binding indent/dedent actions to run indent mode instead of smart mode

shaunlebron 2018-02-18T21:25:14.000068Z

so indent/dedent commands run indent mode, but space/delete runs smart mode

cfleming 2018-02-18T21:26:17.000059Z

Something like that - either I can check the last executed action, or I can explicitly run indent mode as part of the action itself.