diff --git a/CHANGELOG.md b/CHANGELOG.md index af232c0474..1c382a3194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ #### :bug: Bug fix - Reanalyze: make optional args analysis liveness-aware, preventing false positives when functions are only called from dead code. https://github.com/rescript-lang/rescript/pull/8082 +- Fix: do not warn for "editor" field in `rescript.json`. https://github.com/rescript-lang/rescript/pull/8084 #### :memo: Documentation diff --git a/rewatch/CompilerConfigurationSpec.md b/rewatch/CompilerConfigurationSpec.md index a3fd3c22a5..e8e77df335 100644 --- a/rewatch/CompilerConfigurationSpec.md +++ b/rewatch/CompilerConfigurationSpec.md @@ -4,7 +4,6 @@ This document contains a list of all bsconfig parameters with remarks, and wheth | Parameter | JSON type | Remark | Implemented? | | --------------------- | ----------------------- | ------ | :----------: | -| version | string | | [_] | | name | string | | [x] | | namespace | boolean | | [x] | | namespace | string | | [x] | @@ -33,6 +32,7 @@ This document contains a list of all bsconfig parameters with remarks, and wheth | suffix | Suffix | | [x] | | reanalyze | Reanalyze | | [_] | | experimental-features | ExperimentalFeatures | | [x] | +| editor | object | VS Code tooling only; ignored by rewatch | [x] | ### Source diff --git a/rewatch/src/config.rs b/rewatch/src/config.rs index 13b507a2f4..151cde100a 100644 --- a/rewatch/src/config.rs +++ b/rewatch/src/config.rs @@ -297,6 +297,9 @@ pub struct Config { pub experimental_features: Option>, #[serde(rename = "gentypeconfig")] pub gentype_config: Option, + // Used by the VS Code extension; ignored by rewatch but should not emit warnings. + // Payload is not validated here, only in the VS Code extension. + pub editor: Option, // this is a new feature of rewatch, and it's not part of the rescript.json spec #[serde(rename = "namespace-entry")] pub namespace_entry: Option, @@ -698,7 +701,6 @@ impl Config { fn is_unsupported_field(&self, field: &str) -> bool { const UNSUPPORTED_TOP_LEVEL_FIELDS: &[&str] = &[ - "version", "ignored-dirs", "generators", "cut-generators", @@ -779,6 +781,7 @@ pub mod tests { namespace: None, jsx: None, gentype_config: None, + editor: None, namespace_entry: None, deprecation_warnings: vec![], experimental_features: None, @@ -1114,6 +1117,28 @@ pub mod tests { assert!(config.get_unknown_fields().is_empty()); } + #[test] + fn test_editor_field_supported() { + let json = r#" + { + "name": "testrepo", + "sources": { + "dir": "src", + "subdirs": true + }, + "editor": { + "reason": { + "profile": "development" + } + } + } + "#; + + let config = Config::new_from_json_string(json).expect("a valid json string"); + assert!(config.get_unsupported_fields().is_empty()); + assert!(config.get_unknown_fields().is_empty()); + } + #[test] fn test_compiler_flags() { let json = r#"