snippets: Preserve leading whitespace (#31933)

Closes #18481

Release Notes:

- Snippet insertions now preserve leading whitespace instead of using
language-specific auto-indentation.
This commit is contained in:
Michael Sloan
2025-06-03 02:37:06 +00:00
committed by GitHub
parent feeda7fa37
commit 56d4c0af9f
3 changed files with 119 additions and 98 deletions
@@ -532,7 +532,9 @@ impl EditorTestContext {
#[track_caller]
pub fn assert_editor_selections(&mut self, expected_selections: Vec<Range<usize>>) {
let expected_marked_text =
generate_marked_text(&self.buffer_text(), &expected_selections, true);
generate_marked_text(&self.buffer_text(), &expected_selections, true)
.replace(" \n", "•\n");
self.assert_selections(expected_selections, expected_marked_text)
}
@@ -561,7 +563,8 @@ impl EditorTestContext {
) {
let actual_selections = self.editor_selections();
let actual_marked_text =
generate_marked_text(&self.buffer_text(), &actual_selections, true);
generate_marked_text(&self.buffer_text(), &actual_selections, true)
.replace(" \n", "•\n");
if expected_selections != actual_selections {
pretty_assertions::assert_eq!(
actual_marked_text,