Herrington Darkholme's Avatar

Herrington Darkholme

@hd-nvim.bsky.social

Author of https://ast-grep.github.io/

394 Followers  |  302 Following  |  90 Posts  |  Joined: 03.11.2024  |  1.8355

Latest posts by hd-nvim.bsky.social on Bluesky

I almost got brain aneurysm thinking that the query syntax of tree-sitter and ast-grep differ.

Fortunately that's not the case, but - contrary to Internet wisdom - query syntax is not compatible between languages (parsers).

Also, ast-grep's Playground is insanely useful:
1/2

06.11.2025 16:16 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
Talks: Custom Rust Linting (ast-grep) & Geospatial DataFrame lib (SedonaDB), Thu, Nov 13, 2025, 6:30 PM | Meetup Doors open at 6:30 p.m. to give attendees plenty of time to grab pizza and socialize, and the talk begin at 7:30 p.m. **Talk #1: Custom Rust Linting** **Herrington Darkhol

Excited for the #RustNYC talks Nov. 13!

Herrington Darkholme will present a comprehensive guide to building custom linting tools for #RustLang projects.

Matt Powers will speak about #SedonaDB, a geospatial compute engine that's built on #DataFusion.

Register: www.meetup.com/rust-nyc/eve...

09.11.2025 00:36 โ€” ๐Ÿ‘ 10    ๐Ÿ” 5    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Preview
feat(language): add hcl support by TheTeaCat ยท Pull Request #2147 ยท ast-grep/ast-grep Following #2103 and #2107 as per comment #419 (reply in thread) Summary by CodeRabbit New Features Added support for HashiCorp Configuration Language (HCL), including syntax highlighting, patte...

HCL support coming to ast-grep! Thanks TheTeaCat's contribution!๐Ÿš€
github.com/ast-grep/ast...

05.08.2025 16:05 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

#ast_grep_trick ast-grep's rule is heavily inspired by CSS selectors. The rule `identifier` node is `inside` the node `call_expression` is something similar to `call_expression > identifier`

28.07.2025 03:19 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Narrative Trickery: Fiction, Truth, and Authorial Subterfuge Readers often have passionate responses (both positive and negative) to books that first manipulate them into believing a seeming โ€˜truthโ€™ about the narrative only to later discover that they have been...

What is narrative trickery.

unsworks.unsw.edu.au/entities/pub...

15.07.2025 04:55 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

ast-grep is my personal hobby project, and all user feedback, whether good or bad, is voluntary. I don't request comments from users.
If you see statements that ast-grep's community is attacking others, they are fake rumors, or more precisely, narrative trickery.

15.07.2025 04:55 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
ast-grep | structural search/rewrite tool for many languages ast-grep is a fast and polyglot tool for code structural search, lint, rewriting at large scale.

ast-grep | structural search/rewrite tool for many languages https://ast-grep.github.io/

What on earth!

You can grep-replace parts of your code-base, but instead of string matching, you write AST matching expressions? That's wild.

09.07.2025 17:38 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Playground | ast-grep ast-grep playground is an online tool that lets you explore AST, debug custom lint rules, and inspect code rewriting with instant feedback.

ใƒชใƒ—ๅคฑ็คผใ—ใพใ™ใ€‚
ใพใŸๆฉŸไผšใŒใ‚ใ‚Œใฐใ€Linterใฎast-grepใ‚‚่ฉฆใ—ใฆใฟใฆใฏใ„ใ‹ใŒใงใ—ใ‚‡ใ†๏ผŸ
OXCใฎ้€Ÿใ•ใซใฏๅŠใณใพใ›ใ‚“ใŒใ€Biomeใ‚ˆใ‚Šใ‘ใฃใ“ใ†้€Ÿใ„ใงใ™ใ‚ˆใ€‚ใƒซใƒผใƒซไฝœๆˆใ‚‚ใ‚ˆใ‚Š็ฐกๅ˜ใ ใจๆ€ใ„ใพใ™ใ€‚
PlaygroundใŒใใฃใจๅฝนใซ็ซ‹ใกใพใ™๏ผ
ast-grep.github.io/playground.h...

09.07.2025 03:13 โ€” ๐Ÿ‘ 4    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Config Cheat Sheet | ast-grep ast-grep(sg) is a lightning fast and user friendly tool for code searching, linting, rewriting at large scale.

New cheat sheet for ast-grep's YAML configuration ast-grep.github.io/cheatsheet/y...

30.06.2025 04:00 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
ast-grep.el demonstration
YouTube video by SunskyXH ast-grep.el demonstration

ast-grep.el: Emacs meets structural search

www.youtube.com/watch?v=Bdua...

27.06.2025 15:43 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

it is a correct rule and verified by code example. (also approved from ast-grep author)

23.06.2025 18:46 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

letting AI write an ast-grep rule for me.
I'm using cursor, ast-grep mcp tool, custom cursor rule and gemini-2.5pro

19.06.2025 18:15 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
What should your mutexes be named?

What should your mutexes be named?

gaultier.github.io/blog/what_sh...

#programming #golang #structural-search #awk

10.06.2025 06:30 โ€” ๐Ÿ‘ 1    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

ast-grep rule cheat sheet

15.06.2025 13:57 โ€” ๐Ÿ‘ 2    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

Compare biomejs plugin with ast-grep in one picture: both syntax and speed.

04.06.2025 16:29 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Search Multi-language Documents in ast-grep | ast-grep ast-grep(sg) is a lightning fast and user friendly tool for code searching, linting, rewriting at large scale.

Parsing graphql in JavaScript with ast-grep is possible

ast-grep.github.io/advanced/lan...

30.05.2025 23:09 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

One pic to compare ast-grep rule syntax with biome plugin syntax.

The example shows the rule no-implicit-bool-jsx-attr,
e.g. <div draggable /> => <div draggable={true} />

29.05.2025 14:03 โ€” ๐Ÿ‘ 1    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

btw i use neovim + ghostty

05.05.2025 15:07 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

Solaris light + bat

05.05.2025 15:06 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Post image

A proof of concept to run ast-grep via OXC parser

04.05.2025 21:36 โ€” ๐Ÿ‘ 9    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Post image 04.05.2025 17:33 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Preview
ast-grep on current vim buffer ast-grep on current vim buffer. GitHub Gist: instantly share code, notes, and snippets.

just some (probably filthy) vimscript to get ast-grep to run on the current buffer and update it
cc @hd-nvim.bsky.social ๐Ÿ‘€

22.04.2025 16:23 โ€” ๐Ÿ‘ 3    ๐Ÿ” 1    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

amazing ๐Ÿ˜

22.04.2025 21:37 โ€” ๐Ÿ‘ 1    ๐Ÿ” 0    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0
Post image

Ohh I didn't see that ast-grep has a VSCode extension nowadays. This tool just keeps getting better. marketplace.visualstudio.com/items/?itemN...

18.04.2025 13:48 โ€” ๐Ÿ‘ 20    ๐Ÿ” 5    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

ast-grepใฏ่‡ชๅˆ†ใฟใŸใ„ใซใ‚ฝใƒ•ใƒˆใ‚ฆใ‚งใ‚ขใฎใƒใƒผใ‚ธใƒงใƒณใ‚ขใƒƒใƒ—ใ‚„ไปฃๆ›ฟๆกˆใธใฎ็งป่กŒใ‚’ใ‚ˆใใ‚„ใ‚‹ใ‚‚ใฎใซใฏๅฟ…ไฟฎ็ง‘็›ฎใ‹ใ‚‚ใ—ใ‚Œใ‚“

02.04.2025 23:20 โ€” ๐Ÿ‘ 2    ๐Ÿ” 1    ๐Ÿ’ฌ 0    ๐Ÿ“Œ 0

this use case is valid but does not fit in general AST design. composing a single node pattern + precedes/follows rules is better in terms of flexibility and genericity. e.g. babel/eslint does not have multiple-nodes API.

27.03.2025 21:48 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

what's your expectation here? returning a list of nodes?

26.03.2025 02:53 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Screenshot of some code.  It reads

// Parse each JSON line
for line in stdout. lines () {
if let Ok(json) = serde_json:: from_str:: <Value>(line) {
if let Some(obj) = json.as_object() {
if let Some (reason) = obj-get ("reason") {
if reason == "compiler-message" {
if let Some (message) = obj. get ("message") {
if let Some (rendered) = message. get ("rendered") {
if let Some(spans) = message. get ("spans")
if let Some(spans) = spans.as_array() {
for span in spans i
if let Some (file_name) = span.get("-
if let Some(file_name) = file_n

but each line is intended four spaces from the previous line.  The combination of indentation and syntax highlighting gives a pleasant rainbow effect.  Thanks, ChatGPT.

Screenshot of some code. It reads // Parse each JSON line for line in stdout. lines () { if let Ok(json) = serde_json:: from_str:: <Value>(line) { if let Some(obj) = json.as_object() { if let Some (reason) = obj-get ("reason") { if reason == "compiler-message" { if let Some (message) = obj. get ("message") { if let Some (rendered) = message. get ("rendered") { if let Some(spans) = message. get ("spans") if let Some(spans) = spans.as_array() { for span in spans i if let Some (file_name) = span.get("- if let Some(file_name) = file_n but each line is intended four spaces from the previous line. The combination of indentation and syntax highlighting gives a pleasant rainbow effect. Thanks, ChatGPT.

๐ŸŒˆ vibe coding ๐ŸŒˆ

26.03.2025 00:12 โ€” ๐Ÿ‘ 41    ๐Ÿ” 2    ๐Ÿ’ฌ 6    ๐Ÿ“Œ 0
JavaScript API | ast-grep ast-grep(sg) is a lightning fast and user friendly tool for code searching, linting, rewriting at large scale.

Finally, if you need a more flexibile solution, using ast-grep's napi binding can be a nice choice ast-grep.github.io/guide/api-us...

25.03.2025 23:51 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0
Playground | ast-grep ast-grep playground is an online tool that lets you explore AST, debug custom lint rules, and inspect code rewriting with instant feedback.

This is the example of using multiple variable ast-grep.github.io/playground.h...

25.03.2025 23:50 โ€” ๐Ÿ‘ 0    ๐Ÿ” 0    ๐Ÿ’ฌ 1    ๐Ÿ“Œ 0

@hd-nvim is following 20 prominent accounts