snippets: Fix snippets not updating while containing comments (#23755)

Closes #23699

Release Notes:

- Fixed issue where snippets would not update when a snippets file
contained comments.
This commit is contained in:
loczek 2025-01-28 10:37:48 +01:00 committed by GitHub
parent bb59e7f217
commit b99159c59b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 6 deletions

View file

@ -37,7 +37,8 @@ impl SnippetRegistry {
}
pub fn register_snippets(&self, file_path: &Path, contents: &str) -> Result<()> {
let snippets_in_file: crate::format::VSSnippetsFile = serde_json::from_str(contents)?;
let snippets_in_file: crate::format::VSSnippetsFile =
serde_json_lenient::from_str(contents)?;
let kind = file_path
.file_stem()
.and_then(|stem| stem.to_str().and_then(file_stem_to_key));