-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 2.0.247 regression with structural editing, hangs at unbalance + structural delete #1573
Comments
@corasaurus-hex While my changes to the structural editing are most likely to have caused this. In the same release we also did the no-floating-promises update. Is there a possibility that could cause this? There are some promises involved in the Paredit backspace function: calva/src/cursor-doc/paredit.ts Line 813 in 6947821
|
@corasaurus-hex I now tried with fd3be49 which has the no-floating-promise changes and then things worked, so this regression is not caused by that. |
Making the test runner skip it t not croak CI.
Some expert digging by @corasaurus-hex shifted our attention to the formatter and I first suspected the cursor.rangeForCurrentForm(index) call, but e069624 did not agree. Then I saw calva-cursor-hang-1573-getfunctionname.mp4 |
One of them exposes #1573 (and is skipped for now)
This fixes the issue. /**
* Moves this cursor backwards to the open paren of the containing sexpr, or until the start of the document.
*/
backwardList(): boolean {
const cursor = this.clone();
while (cursor.backwardSexp()) {
// move backward until the cursor cannot move backward anymore
}
- if (cursor.getPrevToken().type === 'open') {
+ if (cursor.getPrevToken().type === 'open' && cursor.offsetStart !== this.offsetStart) {
this.set(cursor);
return true;
}
return false;
} However, it's very strange.... why did this not cause trouble until #1566? |
No, that broke backwardList totally. This is a much better fix: /**
* Moves this cursor backwards to the open paren of the containing sexpr, or until the start of the document.
*/
backwardList(): boolean {
const cursor = this.clone();
while (cursor.backwardSexp()) {
// move backward until the cursor cannot move backward anymore
}
if (cursor.getPrevToken().type === 'open') {
const checkCursor = cursor.clone();
if (checkCursor.backwardUpList() && checkCursor.forwardSexp()) {
this.set(cursor);
return true;
}
}
return false;
} |
Calva's structural editing hangs in some situations when there is unbalance in the document. Since structural editing was updated in 247, this is very probably a regression there.
This is my repro so far (the vertical bar is the cursor):
backspace
Two things happen. 1, the new text is:
Should be:
And, much, much worse: BOOM. Now Calva is essentially dead.
If you run with auto-closing parens on, this won't happen often. But of course might.
Using Calva 2.0.246 is safer.Update: Calva v2.0.249 reverts back to before the changes to the structural editing were merged.
The text was updated successfully, but these errors were encountered: