Here’s another interesting problem:
(defn empty-panel [text]
(let [status-text (extend-class StatusText []
(isStatusVisible [this] true))
panel (extend-class JPanel []
(paintComponent [this g]
(.paintComponent ^JPanel this ^Graphics g)
(.paint status-text this g)))]
(doto status-text
(.attachTo panel)
(.setText text))
panel))
I then rename panel
, and start typing a totally new name, so I press delete and then start typing.
When I do that, the panel
in (.attachTo panel)
disappears, and parinfer deletes the space in there.
And when I confirm the new name, I get something like (.attachTonew-name)
I need to be able to supply extra holding locations, I guess.
I think that will be ok, since I have already modified my version to accept multiple carets. I haven’t tested the edge cases with that yet though.
I suspect it will be weird if you have the same file open in multiple editors and are editing a line that the caret is on in another editor.
The holding stuff really complicates the integration though.
I can’t think of a good alternative but it’s tricky.
i’m not understanding how the rename operation happens
might be easier to diagnose this problem with a list of changes
that the rename operation produces
@shaunlebron Let me record a video
Watch what happens to the .attachTo
near the bottom.
The issue is that the symbol to be renamed is deleted temporarily if I delete the whole name, and the paren isn’t held because the caret isn’t there.
I think I can create some extra hold locations from the template positions during the rename.
I’m not sure if they should participate in the hold release mechanism or not - probably, I guess.
i.e. they’ll be basically just like caret positions that don’t have a previous position.
Actually, perhaps they could have a previous position, and I’ll pretend there is a caret inside each template location at the same offset as the actual caret is within its template location.
(the “templates” here are all the points where the inline rename happens)
yeah, if you already have multiple cursor support, it should work by placing a cursor at the end of each template
Right.
I’ll check the API to see how easy that is.
nice gif! should be easier to communicate these subtleties now
@shaunlebron That works a treat
You can see the parens being held both near count
and at the end of the form.
very cool, i noticed the )
being held at last line
i take it you’re not using forceBalance
?
No, I’m not.
I haven’t ported your recent changes yet.
Thinking about it, I should create those carets for the indentation check as well.
I can’t think of a situation when that might affect the indentation, but I’m sure there are plenty of weird edge cases I haven’t thought of.
well i’m only recommending forceBalance: false
if it’s enabled, it doesn’t support )
being on its own line