File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ pub struct LanguageConfigurationJSON {
140140#[ derive( Serialize , Deserialize ) ]
141141#[ serde( rename_all = "kebab-case" ) ]
142142pub struct TreeSitterJSON {
143+ #[ serde( rename = "$schema" ) ]
144+ pub schema : Option < String > ,
143145 pub grammars : Vec < Grammar > ,
144146 pub metadata : Metadata ,
145147 #[ serde( default ) ]
Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ const TEST_BINDING_PY_TEMPLATE: &str = include_str!("./templates/test_binding.py
9393const PACKAGE_SWIFT_TEMPLATE : & str = include_str ! ( "./templates/package.swift" ) ;
9494const TESTS_SWIFT_TEMPLATE : & str = include_str ! ( "./templates/tests.swift" ) ;
9595
96+ const TREE_SITTER_JSON_SCHEMA : & str =
97+ "https://tree-sitter.github.io/tree-sitter/assets/schemas/config.schema.json" ;
98+
9699#[ must_use]
97100pub fn path_in_ignore ( repo_path : & Path ) -> bool {
98101 [
@@ -133,6 +136,7 @@ impl JsonConfigOpts {
133136 #[ must_use]
134137 pub fn to_tree_sitter_json ( self ) -> TreeSitterJSON {
135138 TreeSitterJSON {
139+ schema : Some ( TREE_SITTER_JSON_SCHEMA . to_string ( ) ) ,
136140 grammars : vec ! [ Grammar {
137141 name: self . name. clone( ) ,
138142 camelcase: Some ( self . camelcase) ,
@@ -226,6 +230,7 @@ pub fn migrate_package_json(repo_path: &Path) -> Result<bool> {
226230 let name = old_config. name . replace ( "tree-sitter-" , "" ) ;
227231
228232 let new_config = TreeSitterJSON {
233+ schema : Some ( TREE_SITTER_JSON_SCHEMA . to_string ( ) ) ,
229234 grammars : old_config
230235 . tree_sitter
231236 . unwrap ( )
You can’t perform that action at this time.
0 commit comments