Tree-sitter grammar for the Blink programming language.
Provides syntax highlighting and structural parsing for .bl files in editors and tools that support tree-sitter.
Add to your nvim-treesitter config:
require("nvim-treesitter.parsers").get_parser_configs().blink = {
install_info = {
url = "https://github.com/blinklang/tree-sitter-blink",
files = { "src/parser.c" },
branch = "main",
},
filetype = "bl",
}Then install:
:TSInstall blink
Add to ~/.config/helix/languages.toml:
[[language]]
name = "blink"
scope = "source.blink"
file-types = ["bl"]
roots = []
comment-token = "//"
[language.grammar]
source = { git = "https://github.com/blinklang/tree-sitter-blink", rev = "main" }Then fetch and build:
hx --grammar fetch && hx --grammar buildast-grep enables syntax-aware search and rewrite on Blink source files.
Run this one-liner to download, compile, and configure:
curl -sSL https://raw.githubusercontent.com/blinklang/tree-sitter-blink/main/install-ast-grep.sh | bashThis compiles the grammar and installs it to ~/.config/ast-grep/. The script will print an alias to add to your shell profile:
ast-grep() { command ast-grep --config ~/.config/ast-grep/sgconfig.yml "$@"; }Then:
# Find all calls to foo with one argument
ast-grep run -p 'foo($X)' -l blink src/
# Rename foo to bar across all .bl files
ast-grep run -p 'foo($X)' -r 'bar($X)' -l blink src/Requirements: a C compiler (gcc or clang) and curl.
See CONTRIBUTING.md for how to work on the grammar.