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
+4 -1
View File
@@ -8929,7 +8929,10 @@ impl Editor {
.iter()
.cloned()
.map(|range| (range, snippet_text.clone()));
buffer.edit(edits, Some(AutoindentMode::EachLine), cx);
let autoindent_mode = AutoindentMode::Block {
original_indent_columns: Vec::new(),
};
buffer.edit(edits, Some(autoindent_mode), cx);
let snapshot = &*buffer.read(cx);
let snippet = &snippet;