tree-sitter--tuple-to-struct-definition.md

  1+++
  2repository_url = "git@github.com:tree-sitter/tree-sitter"
  3revision = "24007727d42b4caceda3095ac685c463fae1ba1a"
  4+++
  5
  6## Edit History
  7
  8```diff
  9--- a/tree-sitter/crates/loader/src/loader.rs
 10+++ b/tree-sitter/crates/loader/src/loader.rs
 11@@ -604,7 +604,7 @@
 12
 13 pub struct Loader {
 14     pub parser_lib_path: PathBuf,
 15-    languages_by_id: Vec<(PathBuf, OnceCell<Language>, Option<Vec<PathBuf>>)>,
 16+    languages_by_id: Vec<LanguageEntry>,
 17     language_configurations: Vec<LanguageConfiguration<'static>>,
 18     language_configuration_ids_by_file_type: HashMap<String, Vec<usize>>,
 19     language_configuration_in_current_path: Option<usize>,
 20--- a/tree-sitter/crates/loader/src/loader.rs
 21+++ b/tree-sitter/crates/loader/src/loader.rs
 22@@ -621,6 +621,8 @@
 23     wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
 24 }
 25
 26+str
 27 pub struct CompileConfig<'a> {
 28     pub src_path: &'a Path,
 29     pub header_paths: Vec<&'a Path>,
 30```
 31
 32## Cursor Position
 33
 34```tree-sitter/crates/loader/src/loader.rs
 35    sanitize_build: bool,
 36    force_rebuild: bool,
 37
 38    #[cfg(feature = "wasm")]
 39    wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
 40}
 41
 42str
 43// ^[CURSOR_POSITION]
 44pub struct CompileConfig<'a> {
 45    pub src_path: &'a Path,
 46    pub header_paths: Vec<&'a Path>,
 47    pub parser_path: PathBuf,
 48    pub scanner_path: Option<PathBuf>,
 49    pub external_files: Option<&'a [PathBuf]>,
 50```
 51
 52## Expected Patch
 53
 54```diff
 55--- a/tree-sitter/crates/loader/src/loader.rs
 56+++ b/tree-sitter/crates/loader/src/loader.rs
 57@@ -621,6 +621,8 @@
 58     wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
 59 }
 60
 61-str
 62+struct LanguageEntry {
 63+    path: PathBuf,
 64+    language: OnceCell<Language>,
 65+    external_files: Option<Vec<PathBuf>>,
 66+}
 67+
 68 pub struct CompileConfig<'a> {
 69     pub src_path: &'a Path,
 70     pub header_paths: Vec<&'a Path>,
 71```
 72
 73```diff
 74--- a/tree-sitter/crates/loader/src/loader.rs
 75+++ b/tree-sitter/crates/loader/src/loader.rs
 76@@ -621,6 +621,8 @@
 77     wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
 78 }
 79
 80-str
 81+struct LanguageEntry {
 82+    path: PathBuf,
 83+    language: OnceCell<Language>,
 84+    dependencies: Option<Vec<PathBuf>>,
 85+}
 86+
 87 pub struct CompileConfig<'a> {
 88     pub src_path: &'a Path,
 89     pub header_paths: Vec<&'a Path>,
 90```
 91
 92
 93```diff
 94--- a/tree-sitter/crates/loader/src/loader.rs
 95+++ b/tree-sitter/crates/loader/src/loader.rs
 96@@ -621,6 +621,8 @@
 97     wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
 98 }
 99
100-str
101+struct LanguageEntry {
102+    path: PathBuf,
103+    language: OnceCell<Language>,
104+    extra_files: Option<Vec<PathBuf>>,
105+}
106+
107 pub struct CompileConfig<'a> {
108     pub src_path: &'a Path,
109     pub header_paths: Vec<&'a Path>,
110```
111
112```diff
113--- a/tree-sitter/crates/loader/src/loader.rs
114+++ b/tree-sitter/crates/loader/src/loader.rs
115@@ -621,6 +621,8 @@
116     wasm_store: Mutex<Option<tree_sitter::WasmStore>>,
117 }
118
119-str
120+struct LanguageEntry(PathBuf, OnceCell<Language>, Option<Vec<PathBuf>>);
121+
122 pub struct CompileConfig<'a> {
123     pub src_path: &'a Path,
124     pub header_paths: Vec<&'a Path>,
125```