Fork me on GitHub
#parinfer
<
2016-04-22
>
shaunlebron04:04:22

A cursive user discovered a major bug in Parinfer that is now fixed in 1.8.1

cfleming04:04:46

@shaunlebron: Thanks for the quick fix!

shaunlebron04:04:57

thanks for reporting!

cfleming04:04:40

I was planning to try to modify the integration so that it would only run the initial paren mode on first modification rather than file opening, but I can’t figure out a way to do that.

shaunlebron04:04:01

yeah, that seems tricky 😕

cfleming04:04:33

Yeah - I can hook into the action system and do it before any action, but actions are everything from editor actions to moving to another editor.

cfleming04:04:00

So it would always trigger - there’s no way to detect an action that will modify the doc. And once the doc is being modified it’s too late.

shaunlebron04:04:07

I don’t think that spacex video is any consolation here

cfleming04:04:34

No, I’m going to have to go with nanorobots performing heart surgery, or something.

cfleming04:04:51

It’s been a bad problem because I have a “toggle structural editing style” action which cycles through none, parinfer, paredit. That previously would modify the doc while passing through parinfer mode.

cfleming04:04:05

It was pretty annoying for people.

cfleming04:04:31

(it was even worse because of a bug that wouldn’t run paren mode when it should, so it would actually break code).

shaunlebron04:04:35

I would remove it from the toggle cycle

cfleming04:04:54

It’s now configurable - users can select which modes they want to appear in the toggle.

cfleming04:04:15

I know several users basically toggle between parinfer and paredit.

cfleming04:04:43

And some may want to go none <-> parinfer or none <-> paredit

shaunlebron04:04:34

what is the default toggle cycle then

shaunlebron04:04:57

and would a localized (non-global) paren mode help here?

cfleming04:04:12

Definitely.

cfleming04:04:55

I’m still thinking about options for a local hybrid mode. I’m using parinfer myself at the moment, and there’s a lot I like about it that I’ll have to try to replicate in whatever I come up with.

cfleming04:04:48

In particular, I often leave dangling parens at the end of test forms so that I can easily add a new case just by duplicating the line. Using parinfer I can just duplicate the line anyway and it all gets tidied up.

cfleming04:04:58

That is really nice.

shaunlebron04:04:24

can you undo the paren mode changes if you can detect that the user toggled through parinfer without any manual modifications?

cfleming04:04:32

But it is definitely a problem that files are modified after just looking at them.

cfleming04:04:41

Maybe, but it’s clunky.

cfleming04:04:02

IntelliJ maintains history of all file modifications, and that would show up there.

cfleming04:04:51

I considered doing the action system hook and whitelisting some actions that a user would typically use to navigate between files, but that’s fragile.

cfleming04:04:14

(I even considered analysing the bytecode of all actions in the platform to see which ones definitely don’t modify the document, but that’s probably crazy).

shaunlebron04:04:34

java bytecode?

shaunlebron04:04:47

yeah definitely crazy

cfleming04:04:55

Or I could potentially use the IntelliJ API to analyse the source.

shaunlebron04:04:47

I just don’t have enough context on this to comment one way or the other

cfleming04:04:54

Yeah, no problem.

shaunlebron04:04:09

is there something else I can help with? I’ve been refocusing on cljs api docs in secret

cfleming04:04:34

No, thanks - I’m just patching bugs for the moment. Once I have a hybrid mode to test I’d love some feedback.

cfleming04:04:21

Doing the real-time indentation is tricky to make performant, so not sure when I’ll get that going.

shaunlebron04:04:03

i’ve been in Atom for the past couple weeks trying out Parinfer

shaunlebron04:04:56

I’ll switch to cursive for the next couple weeks to get more familiar with it. will let you know how it goes, and happy to give feedback on others things as they come

shaunlebron04:04:11

real-time indentation?

cfleming04:04:42

Ok, thanks. I’m going to push a release probably Monday fixing some pretty bad bugs, and I’ll get that 1.8.1 fix in there too.

cfleming04:04:27

I mean, doing something like paren mode which maintains indentation, but having it be aware of semantics, i.e. how different forms need to be indented.

cfleming04:04:45

Like emacs aggressive-indent mode.

shaunlebron04:04:26

ah, yes. that stuff needs to be synchronous if you do it with paren mode. i see what you mean now

shaunlebron04:04:49

i have to jet, getting late

shaunlebron04:04:58

catch up soon