├── .gitignore ├── cgmanifest.json ├── RELEASING.md ├── CODE_OF_CONDUCT.md ├── tsconfig.json ├── SUPPORT.md ├── CHANGELOG.md ├── LICENSE ├── package.json ├── README.md ├── SECURITY.md └── patches └── remove-ureq-xtask.patch /.gitignore: -------------------------------------------------------------------------------- 1 | wasm/ 2 | tree-sitter/ 3 | 4 | # Dependency directories 5 | node_modules/ 6 | -------------------------------------------------------------------------------- /cgmanifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "registrations": [ 3 | { 4 | "component": { 5 | "type": "git", 6 | "git": { 7 | "name": "tree-sitter", 8 | "repositoryUrl": "https://github.com/tree-sitter/tree-sitter", 9 | "commitHash": "fc15f621334a262039ffaded5937e2844f88da61" 10 | } 11 | }, 12 | "license": "MIT", 13 | "version": "0.25.1" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # How to release 2 | 3 | 1. Edit the version in `package.json`: 4 | - If you're adding a language, update the minor version. 5 | - If the version of Tree-Sitter itself has changed, update at least the minor version. 6 | - Otherwise, update the patch version. 7 | 8 | 2. Update the `CHANGELOG.md`. 9 | 10 | 3. Run the [pipeline](https://dev.azure.com/monacotools/Monaco/_build?definitionId=585) with the "Publish tree-sitter-wasm" option. -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Microsoft Open Source Code of Conduct 2 | 3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 4 | 5 | Resources: 6 | 7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) 8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) 9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns 10 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": ["ES2020", "ES2022.Object"], 6 | "sourceMap": true, 7 | "rootDir": ".", 8 | /* Strict Type-Checking Option */ 9 | "strict": true /* enable all strict type-checking options */, 10 | /* Additional Checks */ 11 | "noUnusedLocals": true /* Report errors on unused locals. */, 12 | "noImplicitOverride": true /* Force use of `override` keyword. */, 13 | "allowSyntheticDefaultImports": true 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /SUPPORT.md: -------------------------------------------------------------------------------- 1 | # Support 2 | 3 | ## How to file issues and get help 4 | 5 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing 6 | issues before filing new issues to avoid duplicates. For new issues, file your bug or 7 | feature request as a new Issue. 8 | 9 | For help and questions about using this project, please also open an issue. 10 | 11 | ## Microsoft Support Policy 12 | 13 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above. 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.3.0 4 | 5 | = Adopt Tree-Sitter 0.25.10, up from 0.25.2 6 | - Update all grammars to latest versions 7 | 8 | ## 0.2.0 9 | 10 | - Add bash 11 | - Add powershell 12 | 13 | ## 0.1.5 14 | 15 | - Add php 16 | 17 | ## 0.1.4 18 | 19 | - Add css 20 | 21 | ## 0.1.3 22 | 23 | - Pick up Tree-Sitter 0.25.2 24 | 25 | ## 0.1.2 26 | 27 | - Add ini 28 | 29 | ## 0.1.1 30 | 31 | - Fix some issues where various VS Code tools wouldn't work 32 | 33 | ## 0.1.0 34 | 35 | - Adopt Tree-Sitter 0.25.1, up from 0.23.0 36 | 37 | ## 0.0.2 38 | 39 | - Adds a main entry point in package.json 40 | 41 | ## 0.0.1 42 | 43 | - Initial release 44 | - Builds tree-sitter wasm 45 | - Adds tree-sitter-typescript -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@vscode/tree-sitter-wasm", 3 | "version": "0.3.0", 4 | "description": "Pre-built WASM files for Tree-Sitter and Tree-Sitter languages that VS Code uses", 5 | "scripts": { 6 | "build-wasm": "ts-node ./build/main.ts", 7 | "install-emsdk": "sudo rm -rf /opt/dev/emsdk && sudo ./build/setup-emsdk.sh" 8 | }, 9 | "author": "Visual Studio Code Team", 10 | "license": "MIT", 11 | "files": [ 12 | "wasm", 13 | "LICENSE", 14 | "README.md", 15 | "SECURITY.md", 16 | "cgmanifest.json" 17 | ], 18 | "main": "wasm/tree-sitter.js", 19 | "types": "wasm/web-tree-sitter.d.ts", 20 | "devDependencies": { 21 | "@types/node": "^20.14.6", 22 | "tree-sitter-bash": "^0.25.0", 23 | "tree-sitter-cli": "^0.25.10", 24 | "tree-sitter-css": "^0.25.0", 25 | "tree-sitter-go": "^0.25.0", 26 | "tree-sitter-java": "^0.23.5", 27 | "tree-sitter-javascript": "^0.25.0", 28 | "tree-sitter-php": "0.24.2", 29 | "tree-sitter-python": "^0.25.0", 30 | "tree-sitter-regex": "^0.25.0", 31 | "tree-sitter-ruby": "^0.23.1", 32 | "tree-sitter-typescript": "^0.23.2", 33 | "ts-node": "^10.9.2" 34 | }, 35 | "repository": { 36 | "type": "git", 37 | "url": "https://github.com/Microsoft/vscode-tree-sitter-wasm.git" 38 | }, 39 | "bugs": { 40 | "url": "https://github.com/Microsoft/vscode-tree-sitter-wasm/issues" 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pre-built Tree-Sitter wasm files 2 | 3 | This repository contains scripts and build pipelines for building the Tree-Sitter and Tree-Sitter grammar WebAssembly files used by VS Code. 4 | 5 | ## Contributing 6 | 7 | This project welcomes contributions and suggestions. Most contributions require you to agree to a 8 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us 9 | the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. 10 | 11 | When you submit a pull request, a CLA bot will automatically determine whether you need to provide 12 | a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions 13 | provided by the bot. You will only need to do this once across all repos using our CLA. 14 | 15 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). 16 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or 17 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. 18 | 19 | ### Build steps 20 | 21 | > Note: If you're using Windows, you'll need to use WSL. Ensure Docker integration for WSL is enabled before attempting to build. Without this integration, the build process may encounter errors. 22 | 23 | First, install all of the dependencies using `npm install`, use the `--force` flag if needed. You will also need to install [emscripten](https://emscripten.org/docs/getting_started/downloads.html). 24 | 25 | Then, build the the wasm files using `npm run build-wasm`, which will do the following: 26 | - Clone the tree-sitter repository 27 | - Build the tree-sitter WebAssembly bindings 28 | - Build the tree-sitter grammars listed in https://github.com/microsoft/vscode-tree-sitter-wasm/blob/alexr00/0.0.1/build/main.ts 29 | 30 | ## Trademarks 31 | 32 | This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft 33 | trademarks or logos is subject to and must follow 34 | [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). 35 | Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. 36 | Any use of third-party trademarks or logos are subject to those third-party's policies. 37 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## Security 4 | 5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin). 6 | 7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below. 8 | 9 | ## Reporting Security Issues 10 | 11 | **Please do not report security vulnerabilities through public GitHub issues.** 12 | 13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report). 14 | 15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp). 16 | 17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). 18 | 19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: 20 | 21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) 22 | * Full paths of source file(s) related to the manifestation of the issue 23 | * The location of the affected source code (tag/branch/commit or direct URL) 24 | * Any special configuration required to reproduce the issue 25 | * Step-by-step instructions to reproduce the issue 26 | * Proof-of-concept or exploit code (if possible) 27 | * Impact of the issue, including how an attacker might exploit the issue 28 | 29 | This information will help us triage your report more quickly. 30 | 31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs. 32 | 33 | ## Preferred Languages 34 | 35 | We prefer all communications to be in English. 36 | 37 | ## Policy 38 | 39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd). 40 | 41 | 42 | -------------------------------------------------------------------------------- /patches/remove-ureq-xtask.patch: -------------------------------------------------------------------------------- 1 | diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml 2 | index a4000f9..f9630fc 100644 3 | --- a/xtask/Cargo.toml 4 | +++ b/xtask/Cargo.toml 5 | @@ -27,6 +27,5 @@ regex.workspace = true 6 | semver.workspace = true 7 | serde.workspace = true 8 | serde_json.workspace = true 9 | -ureq = "3.0.0" 10 | notify = "8.0.0" 11 | notify-debouncer-full = "0.5.0" 12 | diff --git a/xtask/src/main.rs b/xtask/src/main.rs 13 | index b02136f..069c670 100644 14 | --- a/xtask/src/main.rs 15 | +++ b/xtask/src/main.rs 16 | @@ -6,7 +6,6 @@ mod clippy; 17 | mod fetch; 18 | mod generate; 19 | mod test; 20 | -mod upgrade_emscripten; 21 | mod upgrade_wasmtime; 22 | 23 | use std::path::Path; 24 | @@ -48,9 +47,7 @@ enum Commands { 25 | /// Run the WASM test suite 26 | TestWasm, 27 | /// Upgrade the wasmtime dependency. 28 | - UpgradeWasmtime(UpgradeWasmtime), 29 | - /// Upgrade the emscripten file. 30 | - UpgradeEmscripten, 31 | + UpgradeWasmtime(UpgradeWasmtime) 32 | } 33 | 34 | #[derive(Args)] 35 | @@ -238,7 +235,6 @@ fn run() -> Result<()> { 36 | Commands::UpgradeWasmtime(upgrade_wasmtime_options) => { 37 | upgrade_wasmtime::run(&upgrade_wasmtime_options)?; 38 | } 39 | - Commands::UpgradeEmscripten => upgrade_emscripten::run()?, 40 | } 41 | 42 | Ok(()) 43 | diff --git a/xtask/src/upgrade_emscripten.rs b/xtask/src/upgrade_emscripten.rs 44 | deleted file mode 100644 45 | index 9736e64..0000000 46 | --- a/xtask/src/upgrade_emscripten.rs 47 | +++ /dev/null 48 | @@ -1,41 +0,0 @@ 49 | -use std::{fs, path::Path}; 50 | - 51 | -use anyhow::{anyhow, Result}; 52 | -use git2::Repository; 53 | -use serde_json::Value; 54 | - 55 | -use crate::create_commit; 56 | - 57 | -pub fn run() -> Result<()> { 58 | - let response = ureq::get("https://api.github.com/repos/emscripten-core/emsdk/tags") 59 | - .call()? 60 | - .body_mut() 61 | - .read_to_string()?; 62 | - 63 | - let json = serde_json::from_str::(&response)?; 64 | - let version = json 65 | - .as_array() 66 | - .and_then(|arr| arr.first()) 67 | - .and_then(|tag| tag["name"].as_str()) 68 | - .ok_or(anyhow!("No tags found"))?; 69 | - 70 | - let version_file = Path::new(env!("CARGO_MANIFEST_DIR")) 71 | - .parent() 72 | - .unwrap() 73 | - .join("cli") 74 | - .join("loader") 75 | - .join("emscripten-version"); 76 | - 77 | - fs::write(version_file, version)?; 78 | - 79 | - println!("Upgraded emscripten version to {version}"); 80 | - 81 | - let repo = Repository::open(".")?; 82 | - create_commit( 83 | - &repo, 84 | - &format!("build(deps): bump emscripten to {version}"), 85 | - &["cli/loader/emscripten-version"], 86 | - )?; 87 | - 88 | - Ok(()) 89 | -} 90 | --------------------------------------------------------------------------------