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-02 20:37:06 -06:00 committed by GitHub
parent feeda7fa37
commit 56d4c0af9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 119 additions and 98 deletions

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;