From 5e449e7dda1aa370bb88a6c9a44035e61757afbc Mon Sep 17 00:00:00 2001 From: Ming Date: Sun, 8 Jun 2025 16:54:02 -0400 Subject: [PATCH] feat: `SnippetGenerator` can handle JSON fields (#42) --- src/snippet/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/snippet/mod.rs b/src/snippet/mod.rs index 020e6b588..4bff855f0 100644 --- a/src/snippet/mod.rs +++ b/src/snippet/mod.rs @@ -413,6 +413,14 @@ impl SnippetGenerator { let term_value = term.value(); let term_str = if let Some(term_str) = term_value.as_str() { term_str + } else if let Some(json_value_bytes) = + term_value.as_json_value_bytes().map(|v| v.to_owned()) + { + if let Some(json_str) = json_value_bytes.as_str() { + &json_str.to_string() + } else { + continue; + } } else { continue; };