GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ast-grep/ast-grep.github.io: Website for ast-grep!

BranchesTags
Open more actions menu

Latest commit

 

History

2,103 Commits
2,103 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
tests
tests
 
 
website
website
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.oxlintrc.json
.oxlintrc.json
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
AGENTS.md
AGENTS.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
dprint.json
dprint.json
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
renovate.json
renovate.json
 
 
rust-toolchain
rust-toolchain
 
 
rustfmt.toml
rustfmt.toml
 
 
tsconfig.json
tsconfig.json
 
 
tsconfig.node.json
tsconfig.node.json
 
 

Repository files navigation

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

To setup:

  1. Install wasm-pack https://rustwasm.github.io/wasm-pack/, pnpm, cargo
  2. Clone the repo
  3. wasm-pack build --target web. This will build the wasm in pkg folder
  4. pnpm install
  5. pnpm dev
  6. visit localhost:5173. This will make vitepress cache the dependency.
  7. Run the following script, which is needed for dev-time wasm bundling:
    cd website/.vitepress/cache/deps
    ln -s ../../../../pkg/ast_grep_wasm_bg.wasm
    cd ../../../..

Upgrate tree-sitter Guide

You need to upgrade tree-sitter to the latest version.

You also need to copy the tree-sitter.wasm to the public directory because vite's building convention.

You will usually have weird error messages like tree-sitter.wasm is not found or having wrong LinkError of undefined methods like exit.


emcc setup is not used any more

~~

  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 wasm-bindgen/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

  • tree-sitter/tree-sitter#1593
  • tree-sitter/tree-sitter#1829
  • https://github.com/tree-sitter/tree-sitter/pull/2830/files

About

Website for ast-grep!

ast-grep.github.io/

Resources

Readme
MIT license
Activity
Custom properties

Stars

66 stars

Watchers

2 watching

Forks

87 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.