Skip to content

Commit 2a8242a

Browse files
authored
editor: Add Python auto-indent test for same row bracket pair (#31473)
We [recently](#31260) added a condition which fixes certain edge cases detecting indent ranges when a bracket pair is on the same row for suggested indent languages. This PR adds a test for that so we don't regress in the future. Ref: #31362 https://github.com/zed-industries/zed/blob/f9592c6b9273738808210c3a2ab7a366258c7f71/crates/language/src/buffer.rs#L2910 Release Notes: - N/A
1 parent d211f88 commit 2a8242a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

crates/editor/src/editor_tests.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20836,6 +20836,19 @@ async fn test_outdent_after_input_for_python(cx: &mut TestAppContext) {
2083620836
break
2083720837
else:ˇ
2083820838
"});
20839+
20840+
// test does not outdent on typing after line with square brackets
20841+
cx.set_state(indoc! {"
20842+
def f() -> list[str]:
20843+
ˇ
20844+
"});
20845+
cx.update_editor(|editor, window, cx| {
20846+
editor.handle_input("a", window, cx);
20847+
});
20848+
cx.assert_editor_state(indoc! {"
20849+
def f() -> list[str]:
20850+
20851+
"});
2083920852
}
2084020853

2084120854
#[gpui::test]

0 commit comments

Comments
 (0)