diff --git a/crates/biome_css_factory/src/generated/syntax_factory.rs b/crates/biome_css_factory/src/generated/syntax_factory.rs index 9d84b03e31ab..e466c2bf9c33 100644 --- a/crates/biome_css_factory/src/generated/syntax_factory.rs +++ b/crates/biome_css_factory/src/generated/syntax_factory.rs @@ -268,9 +268,7 @@ impl SyntaxFactory for CssSyntaxFactory { let mut unmatched_count = 3usize; let mut group_slot_map = [false; 3usize]; for _ in 0usize..3usize { - let Some(element) = ¤t_element else { - break; - }; + let Some (element) = & current_element else { break ; } ; if !group_slot_map[0usize] && AnyCssLineWidth::can_cast(element.kind()) { group_slot_map[0usize] = true; } else if !group_slot_map[1usize] && CssLineStyle::can_cast(element.kind()) { diff --git a/crates/biome_deserialize/src/json.rs b/crates/biome_deserialize/src/json.rs index 1d9bc2832e57..dbddc4b04705 100644 --- a/crates/biome_deserialize/src/json.rs +++ b/crates/biome_deserialize/src/json.rs @@ -15,6 +15,8 @@ use biome_rowan::{AstNode, AstSeparatedList}; /// To implement [Deserializable], it can need to implement [DeserializationVisitor] that allows /// visiting a value. /// +/// `name` corresponds to the name used in a diagnostic to designate the deserialized value. +/// /// ## Examples /// /// ``` @@ -75,19 +77,20 @@ use biome_rowan::{AstNode, AstSeparatedList}; /// } /// /// let source = r#"{ "lorem": "ipsum" }"#; -/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default()); +/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); /// assert!(!deserialized.has_errors()); /// assert_eq!(deserialized.into_deserialized().unwrap(), NewConfiguration { lorem: "ipsum".to_string() }); /// ``` pub fn deserialize_from_json_str( source: &str, options: JsonParserOptions, + name: &str, ) -> Deserialized { let parse = parse_json(source, options); let Deserialized { diagnostics, deserialized, - } = deserialize_from_json_ast::(&parse.tree()); + } = deserialize_from_json_ast::(&parse.tree(), name); let mut errors = parse .into_diagnostics() .into_iter() @@ -106,12 +109,17 @@ pub fn deserialize_from_json_str( } /// Attempts to deserialize a JSON AST, given the `Output`. -pub fn deserialize_from_json_ast(parse: &JsonRoot) -> Deserialized { +/// +/// `name` corresponds to the name used in a diagnostic to designate the deserialized value. +pub fn deserialize_from_json_ast( + parse: &JsonRoot, + name: &str, +) -> Deserialized { let mut diagnostics = vec![]; let deserialized = parse .value() .ok() - .and_then(|value| Output::deserialize(&value, "", &mut diagnostics)); + .and_then(|value| Output::deserialize(&value, name, &mut diagnostics)); Deserialized { diagnostics: diagnostics.into_iter().map(Error::from).collect::>(), deserialized, @@ -198,7 +206,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::<()>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::<()>(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -209,7 +217,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert!(deserialized.unwrap()); @@ -217,7 +225,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -228,7 +236,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0.5)); } @@ -239,7 +247,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0.5)); } @@ -250,7 +258,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(-1)); @@ -258,7 +266,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -269,7 +277,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(-1)); @@ -277,7 +285,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -288,7 +296,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(-1)); @@ -296,7 +304,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -307,7 +315,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(-1)); @@ -315,7 +323,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -326,7 +334,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(-1)); @@ -334,7 +342,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -345,7 +353,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0)); @@ -353,7 +361,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -364,7 +372,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0)); @@ -372,7 +380,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -383,7 +391,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0)); @@ -391,7 +399,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -402,7 +410,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0)); @@ -410,7 +418,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -421,7 +429,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, Some(0)); @@ -429,7 +437,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -440,7 +448,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, NonZeroU8::new(1)); @@ -448,7 +456,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -459,7 +467,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, NonZeroU16::new(1)); @@ -467,7 +475,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -478,7 +486,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, NonZeroU32::new(1)); @@ -486,7 +494,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -497,7 +505,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, NonZeroU64::new(1)); @@ -505,7 +513,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -516,7 +524,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized, NonZeroUsize::new(1)); @@ -524,7 +532,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -535,7 +543,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(&source, JsonParserOptions::default()); + } = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized.unwrap().text(), u128::MAX.to_string()); @@ -543,7 +551,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -554,7 +562,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized.unwrap(), "string"); @@ -562,7 +570,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::(source, JsonParserOptions::default()); + } = deserialize_from_json_str::(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -573,7 +581,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized.unwrap(), vec![0, 1]); @@ -581,7 +589,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -592,7 +600,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized.unwrap(), HashSet::from([0, 1])); @@ -600,7 +608,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -611,7 +619,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(diagnostics.is_empty()); assert_eq!(deserialized.unwrap(), IndexSet::from([0, 1])); @@ -619,7 +627,7 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>(source, JsonParserOptions::default(), ""); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -630,7 +638,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(diagnostics.is_empty()); assert_eq!( deserialized.unwrap(), @@ -641,7 +653,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -652,7 +668,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(diagnostics.is_empty()); assert_eq!( deserialized.unwrap(), @@ -663,7 +683,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } @@ -674,7 +698,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(diagnostics.is_empty()); assert_eq!( deserialized.unwrap(), @@ -685,7 +713,11 @@ mod tests { let Deserialized { deserialized, diagnostics, - } = deserialize_from_json_str::>(source, JsonParserOptions::default()); + } = deserialize_from_json_str::>( + source, + JsonParserOptions::default(), + "", + ); assert!(!diagnostics.is_empty()); assert!(deserialized.is_none()); } diff --git a/crates/biome_deserialize/src/lib.rs b/crates/biome_deserialize/src/lib.rs index e20e881a1c02..e844b77ee367 100644 --- a/crates/biome_deserialize/src/lib.rs +++ b/crates/biome_deserialize/src/lib.rs @@ -86,14 +86,14 @@ pub use string_set::StringSet; /// use biome_json_parser::JsonParserOptions; /// /// let source = r#""A""#; -/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default()); +/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); /// assert!(!deserialized.has_errors()); /// assert!(matches!(deserialized.into_deserialized(), Some(Variant::A))); /// ``` pub trait Deserializable: Sized { /// Returns the deserialized form of `value`, or `None` if it failed. /// Any diagnostics emitted during deserialization are appended to `diagnostics`. - /// `name` corresponds to the name used in a diagnostic to designate the value. + /// `name` corresponds to the name used in a diagnostic to designate the deserialized value. fn deserialize( value: &impl DeserializableValue, name: &str, @@ -197,7 +197,7 @@ pub trait DeserializableValue: Sized { /// use biome_json_parser::JsonParserOptions; /// /// let source = r#"{ "name": "Isaac Asimov" }"#; -/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default()); +/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); /// assert!(!deserialized.has_errors()); /// assert_eq!(deserialized.into_deserialized(), Some(Person { name: "Isaac Asimov".to_string() })); /// ``` @@ -252,12 +252,12 @@ pub trait DeserializableValue: Sized { /// use biome_json_parser::JsonParserOptions; /// /// let source = r#" "string" "#; -/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default()); +/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); /// assert!(!deserialized.has_errors()); /// assert_eq!(deserialized.into_deserialized(), Some(Union::Str("string".to_string()))); /// /// let source = "true"; -/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default()); +/// let deserialized = deserialize_from_json_str::(&source, JsonParserOptions::default(), ""); /// assert!(!deserialized.has_errors()); /// assert_eq!(deserialized.into_deserialized(), Some(Union::Bool(true))); /// ``` diff --git a/crates/biome_project/src/node_js_project/package_json.rs b/crates/biome_project/src/node_js_project/package_json.rs index 76fc41c3febe..603db54cb96a 100644 --- a/crates/biome_project/src/node_js_project/package_json.rs +++ b/crates/biome_project/src/node_js_project/package_json.rs @@ -24,7 +24,7 @@ impl Manifest for PackageJson { type Language = JsonLanguage; fn deserialize_manifest(root: &LanguageRoot) -> Deserialized { - deserialize_from_json_ast::(root) + deserialize_from_json_ast::(root, "") } } diff --git a/crates/biome_service/src/configuration/diagnostics.rs b/crates/biome_service/src/configuration/diagnostics.rs index e94c883a0824..2d243e96364d 100644 --- a/crates/biome_service/src/configuration/diagnostics.rs +++ b/crates/biome_service/src/configuration/diagnostics.rs @@ -319,7 +319,7 @@ mod test { fn deserialization_error() { let content = "{ \n\n\"formatter\" }"; let result = - deserialize_from_json_str::(content, JsonParserOptions::default()); + deserialize_from_json_str::(content, JsonParserOptions::default(), ""); assert!(result.has_errors()); for diagnostic in result.into_diagnostics() { @@ -343,7 +343,7 @@ mod test { } }"#; let _result = - deserialize_from_json_str::(content, JsonParserOptions::default()) + deserialize_from_json_str::(content, JsonParserOptions::default(), "") .into_deserialized() .unwrap_or_default(); } diff --git a/crates/biome_service/src/configuration/mod.rs b/crates/biome_service/src/configuration/mod.rs index 254e567d5ea6..4f231678a6d1 100644 --- a/crates/biome_service/src/configuration/mod.rs +++ b/crates/biome_service/src/configuration/mod.rs @@ -623,7 +623,7 @@ fn load_config( file_path, } = auto_search_result; let deserialized = - deserialize_from_json_str::(&content, JsonParserOptions::default()); + deserialize_from_json_str::(&content, JsonParserOptions::default(), ""); Ok(Some(ConfigurationPayload { deserialized, configuration_file_path: file_path, @@ -803,6 +803,7 @@ impl LoadedConfiguration { let deserialized = deserialize_from_json_str::( content.as_str(), JsonParserOptions::default(), + "", ); deserialized_configurations.push(deserialized) } diff --git a/crates/biome_service/src/file_handlers/json.rs b/crates/biome_service/src/file_handlers/json.rs index dc03a7277d03..6115348d397d 100644 --- a/crates/biome_service/src/file_handlers/json.rs +++ b/crates/biome_service/src/file_handlers/json.rs @@ -269,7 +269,7 @@ fn lint(params: LintParams) -> LintResults { // if we're parsing the `biome.json` file, we deserialize it, so we can emit diagnostics for // malformed configuration if params.path.ends_with(ROME_JSON) || params.path.ends_with(BIOME_JSON) { - let deserialized = deserialize_from_json_ast::(&root); + let deserialized = deserialize_from_json_ast::(&root, ""); diagnostics.extend( deserialized .into_diagnostics() diff --git a/crates/biome_service/tests/spec_tests.rs b/crates/biome_service/tests/spec_tests.rs index a8391c49905b..348c2db01ff3 100644 --- a/crates/biome_service/tests/spec_tests.rs +++ b/crates/biome_service/tests/spec_tests.rs @@ -20,12 +20,14 @@ fn run_invalid_configurations(input: &'static str, _: &str, _: &str, _: &str) { "json" => deserialize_from_json_str::( input_code.as_str(), JsonParserOptions::default(), + "", ), "jsonc" => deserialize_from_json_str::( input_code.as_str(), JsonParserOptions::default() .with_allow_comments() .with_allow_trailing_commas(), + "", ), _ => { panic!("Extension not supported"); @@ -69,10 +71,12 @@ fn run_valid_configurations(input: &'static str, _: &str, _: &str, _: &str) { "json" => deserialize_from_json_str::( input_code.as_str(), JsonParserOptions::default(), + "", ), "jsonc" => deserialize_from_json_str::( input_code.as_str(), JsonParserOptions::default().with_allow_comments(), + "", ), _ => { panic!("Extension not supported"); @@ -116,7 +120,8 @@ fn quick_test() { } } }"#; - let result = deserialize_from_json_str::(source, JsonParserOptions::default()); + let result = + deserialize_from_json_str::(source, JsonParserOptions::default(), ""); dbg!(result.diagnostics()); assert!(!result.has_errors()); diff --git a/crates/biome_test_utils/src/lib.rs b/crates/biome_test_utils/src/lib.rs index 95b3e652ee6f..eed684339a28 100644 --- a/crates/biome_test_utils/src/lib.rs +++ b/crates/biome_test_utils/src/lib.rs @@ -41,6 +41,7 @@ pub fn create_analyzer_options( let deserialized = biome_deserialize::json::deserialize_from_json_str::( json.as_str(), JsonParserOptions::default(), + "", ); if deserialized.has_errors() { diagnostics.extend( diff --git a/crates/biome_unicode_table/src/tables.rs b/crates/biome_unicode_table/src/tables.rs index 3ed00b032140..7700038e9f9c 100644 --- a/crates/biome_unicode_table/src/tables.rs +++ b/crates/biome_unicode_table/src/tables.rs @@ -318,6 +318,7 @@ pub mod derived_property { ('ῠ', 'Ῥ'), ('ῲ', 'ῴ'), ('ῶ', 'ῼ'), + ('\u{200c}', '\u{200d}'), ('‿', '⁀'), ('⁔', '⁔'), ('ⁱ', 'ⁱ'), @@ -362,8 +363,7 @@ pub mod derived_property { ('〸', '〼'), ('ぁ', 'ゖ'), ('\u{3099}', 'ゟ'), - ('ァ', 'ヺ'), - ('ー', 'ヿ'), + ('ァ', 'ヿ'), ('ㄅ', 'ㄯ'), ('ㄱ', 'ㆎ'), ('ㆠ', 'ㆿ'), @@ -441,7 +441,7 @@ pub mod derived_property { ('A', 'Z'), ('_', '_'), ('a', 'z'), - ('ヲ', 'ᄒ'), + ('・', 'ᄒ'), ('ᅡ', 'ᅦ'), ('ᅧ', 'ᅬ'), ('ᅭ', 'ᅲ'), @@ -782,6 +782,7 @@ pub mod derived_property { ('𫝀', '𫠝'), ('𫠠', '𬺡'), ('𬺰', '𮯠'), + ('\u{2ebf0}', '\u{2ee5d}'), ('丽', '𪘀'), ('𰀀', '𱍊'), ('𱍐', '𲎯'), @@ -1447,6 +1448,7 @@ pub mod derived_property { ('𫝀', '𫠝'), ('𫠠', '𬺡'), ('𬺰', '𮯠'), + ('\u{2ebf0}', '\u{2ee5d}'), ('丽', '𪘀'), ('𰀀', '𱍊'), ('𱍐', '𲎯'),