Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-core/src/snippets/active.rs')
| -rw-r--r-- | helix-core/src/snippets/active.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/helix-core/src/snippets/active.rs b/helix-core/src/snippets/active.rs index c5c743cd..98007ab6 100644 --- a/helix-core/src/snippets/active.rs +++ b/helix-core/src/snippets/active.rs @@ -252,4 +252,21 @@ mod tests { snippet.map(edit.changes()); assert!(!snippet.is_valid(&Selection::point(4))) } + + #[test] + fn tabstop_zero_with_placeholder() { + // The `$0` tabstop should not have placeholder text. When we receive a snippet like this + // (from older versions of clangd for example) we should discard the placeholder text. + let snippet = Snippet::parse("sizeof(${0:expression-or-type})").unwrap(); + let mut doc = Rope::from("\n"); + let (transaction, _, snippet) = snippet.render( + &doc, + &Selection::point(0), + |_| (0, 0), + &mut SnippetRenderCtx::test_ctx(), + ); + assert!(transaction.apply(&mut doc)); + assert_eq!(doc, "sizeof()\n"); + assert!(ActiveSnippet::new(snippet).is_none()); + } } |