snippets: Add a test case for parsing `${0:placeholder}`

This is an example snippet sent by older versions of clangd.
pull/12647/head
Michael Davis 2025-01-22 18:52:04 -05:00
parent 7dea2b0ddd
commit 032dadaf37
No known key found for this signature in database
1 changed files with 14 additions and 1 deletions

View File

@ -361,7 +361,20 @@ mod test {
Text(")".into()), Text(")".into()),
]), ]),
parse("match(${1:Arg1})") parse("match(${1:Arg1})")
) );
// The `$0` tabstop should not have placeholder text. The parser should handle this case
// normally and then the placeholder text should be discarded during elaboration.
assert_eq!(
Ok(vec![
Text("sizeof(".into()),
Placeholder {
tabstop: 0,
value: vec![Text("expression-or-type".into())],
},
Text(")".into()),
]),
parse("sizeof(${0:expression-or-type})")
);
} }
#[test] #[test]