jack-michaud / ast-grep.github.io

Website for ast-grep!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ast-grep

ast-grep(sg)

ast-grep(sg) is a lightning fast and user friendly tool for code searching, linting, rewriting at large scale.

This is the website source for ast-grep!

Setup Guide

Unfortunately wasm-pack does not support compiling C dependency with stdlib. We have to use emcc.

We have to use web-tree-sitter

~~

  1. Install emcc
  2. rustup target add wasm32-unknown-emscripten
  3. cargo install -f wasm-bindgen-cli
  4. EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry" cargo build --target wasm32-unknown-emscripten
  5. wasm-bindgen --target web ../../target/wasm32-unknown-emscripten/debug/ast_grep_wasm.wasm --out-dir pkg

Reference

https://github.com/MolotovCherry/tree-sitter-wasm rustwasm/wasm-pack#741 https://stackoverflow.com/questions/67474533/error-in-compiling-rust-into-webassembly-using-emscripten-on-windows https://github.com/rustwasm/wasm-pack/blob/master/src/command/build.rs ~~

ast-grep playground

Pre-requisite

It requires tree-sitter.wasm and tree-sitter-{lang}.wasm available in public directory.

Language specific wasm must be built with the same emcc version of the tree-sitter.wasm.

Mismatching emcc version will raise RuntimeError.

Reference

About

Website for ast-grep!

License:MIT License


Languages

Language:Vue 63.6%Language:TypeScript 14.0%Language:Rust 13.0%Language:CSS 9.3%