theme_importer: Make VS Code theme parsing more lenient (#7292)

This PR updates the `theme_importer` to use `serde_json_lenient` to
parse VS Code themes.

This should allow us to parse themes that have trailing commas and such,
in addition to the comment support that we already had.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-02-02 12:09:05 -05:00 committed by GitHub
parent 3995c22414
commit 5360c0ea28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 11 deletions

View file

@ -9,7 +9,6 @@ use std::path::PathBuf;
use anyhow::{Context, Result};
use clap::{Parser, Subcommand};
use indexmap::IndexMap;
use json_comments::StripComments;
use log::LevelFilter;
use schemars::schema_for;
use serde::Deserialize;
@ -132,8 +131,7 @@ fn main() -> Result<()> {
}
};
let theme_without_comments = StripComments::new(theme_file);
let vscode_theme: VsCodeTheme = serde_json::from_reader(theme_without_comments)
let vscode_theme: VsCodeTheme = serde_json_lenient::from_reader(theme_file)
.context(format!("failed to parse theme {theme_file_path:?}"))?;
let theme_metadata = ThemeMetadata {