Disable auto-indent entirely for markdown

This commit is contained in:
Max Brunsfeld 2022-06-16 14:20:09 -07:00
parent bb63f57073
commit 216a275ef2
4 changed files with 125 additions and 83 deletions

View file

@ -784,6 +784,47 @@ fn test_autoindent_with_edit_at_end_of_buffer(cx: &mut MutableAppContext) {
});
}
#[gpui::test]
fn test_autoindent_disabled(cx: &mut MutableAppContext) {
cx.add_model(|cx| {
let text = "
* one
- a
- b
* two
"
.unindent();
let mut buffer = Buffer::new(0, text, cx).with_language(
Arc::new(Language::new(
LanguageConfig {
name: "Markdown".into(),
..Default::default()
},
Some(tree_sitter_json::language()),
)),
cx,
);
buffer.edit_with_autoindent(
[(Point::new(3, 0)..Point::new(3, 0), "\n")],
IndentSize::spaces(4),
cx,
);
assert_eq!(
buffer.text(),
"
* one
- a
- b
* two
"
.unindent()
);
buffer
});
}
#[gpui::test]
fn test_serialization(cx: &mut gpui::MutableAppContext) {
let mut now = Instant::now();