Skip to content

Commit 8c9747e

Browse files
committed
Don't apply partial edits
1 parent 636d984 commit 8c9747e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

apps/vscode/src/providers/format.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,14 @@ async function formatBlock(doc: TextDocument, block: TokenMath | TokenCodeBlock,
233233
new Position(edit.range.end.line + block.range.start.line + 1, edit.range.end.character)
234234
);
235235
return new TextEdit(range, edit.newText);
236-
})
237-
.filter(edit => blockRange.contains(edit.range));
236+
});
237+
238+
// Bail if any edit is out of range. We used to filter these edits out but
239+
// this could bork the cell.
240+
if (edits.some(edit => !blockRange.contains(edit.range))) {
241+
return [];
242+
}
243+
238244
return adjustedEdits;
239245
}
240246
}

0 commit comments

Comments
 (0)