Skip to content

Commit da758f6

Browse files
doc: add release blog
1 parent 031c0b5 commit da758f6

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

website/blog/new-ver-38.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
author:
3+
- name: Herrington Darkholme
4+
search: false
5+
date: 2025-05-18
6+
head:
7+
- - meta
8+
- property: og:type
9+
content: website
10+
- - meta
11+
- property: og:title
12+
content: ast-grep new release 0.38
13+
- - meta
14+
- property: og:url
15+
content: https://ast-grep.github.io/blog/new-ver-38.html
16+
- - meta
17+
- property: og:description
18+
content:
19+
---
20+
21+
# ast-grep 0.38 is Here
22+
23+
We're excited to announce the release of ast-grep 0.38! This version brings some fantastic new features to improve your code searching and linting experience, alongside a significant internal shift that paves the way for exciting future developments.
24+
25+
For those new to ast-grep, it's a powerful command-line tool that lets you search and rewrite code based on its structure (Abstract Syntax Trees or ASTs), not just text. Think of it as `grep` or `sed`, but for code syntax!
26+
27+
Let's dive into what's new:
28+
29+
## New Features
30+
31+
### Customizable Code Highlighting with `labels`
32+
33+
One of the exciting new additions is the `labels` field for your rule configurations. Previously, ast-grep's highlighting was pre-programmed and could not provide much context. Now, you can customize the highlighting of your matches with labels that are more meaningful and relevant to your codebase. These clearer labels also contribute to a cleaner and more intuitive user interface when viewing diagnostics.
34+
35+
![Example of Customizable Code Highlighting](/image/blog/labels-demo.png)
36+
37+
But the benefits don't stop at individual understanding. The labels field offers a fantastic way to embed more guidance directly into your rules, and it allow you to share coding best practices, style guide reminders, or domain-specific knowledge across your entire team. This feature helps disseminate expertise and maintain consistency effortlessly. For example, [Sam Wight](https://github.com/samwightt), the lables feature's proposer, is using ast-grep to help his team to write better [Angular code](/catalog/typescript/missing-component-decorator.html)!
38+
39+
![Example of VSCode](/image/blog/labels-vscode.jpeg)
40+
41+
Furthermore, this improved diagnostic experience isn't confined to the command line. The ast-grep VSCode extension now fully respects these labels, bringing this enhanced highlighting via the Language Server Protocol (LSP). You can click on the label message in the VSCode diagnostic popup and jump to the relevant code point!
42+
43+
### `--json` Output Gets More Informative
44+
45+
The `--json` output option can now include rule `metadata` when you use the new `--include-metadata` flag. This is helpful for integrating ast-grep into other tools or for more detailed programmatic analysis, e.g. [SonarQube](https://github.com/ast-grep/ast-grep/issues/1987).
46+
47+
## Tree-sitter Independence
48+
49+
This is a significant architectural change! Previously, ast-grep was tightly coupled with tree-sitter, a fantastic parser generator tool. While tree-sitter has been foundational to ast-grep's ability to support many languages, this tight coupling had limitations.
50+
51+
* **Introducing `SgNode`:** We've abstracted the core AST node representation with a new trait called `SgNode`. This makes ast-grep's core logic more flexible and less dependent on a single parsing technology.
52+
* **WASM Power-Up:** The ast-grep WebAssembly (WASM) module, which powers our interactive playground, now directly uses `tree-sitter-web` instead of the wrapper library [`tree-sitter-facade`](https://github.com/ast-grep/tree-sitter-wasm/tree/main/crates/tree-sitter-facade).
53+
* **Paving the Way for the Future:** This independence opens doors for exciting new possibilities:
54+
* **Proof of Concept OXC Integration:** We're exploring [integration](https://github.com/ast-grep/ast-grep/pull/1970) with Oxc, a high-performance JavaScript/TypeScript toolchain written in Rust. Oxc boasts an extremely fast parser, which could bring significant performance benefits to ast-grep for JavaScript and TypeScript projects.
55+
* **Future SWC Integration:** Similarly, we're looking into [leveraging SWC](https://github.com/swc-project/plugins/pull/435), another Rust-based platform for fast JavaScript/TypeScript compilation and transformation.
56+
57+
This move is all about future-proofing ast-grep and allowing us to adopt the best parsing technologies for different languages and use cases, ultimately leading to a faster and more versatile tool for you.
58+
59+
## Breaking Changes
60+
61+
### Dropped Support for Older Linux Versions (glibc < 2.35)
62+
63+
Due to [an upgrade in the GitHub Actions build images](https://github.com/actions/runner-images/issues/11101), ast-grep binaries are now built on Ubuntu 22.04. This means they rely on a newer version of glibc (GNU C Library).
64+
65+
**Impact:** Pre-compiled ast-grep binaries will no longer support distributions with glibc versions older than 2.35. For example, Ubuntu 20.04, which has glibc 2.31, is no longer directly supported by our pre-built binaries. This change also impacts [@ast-grep/napi](https://www.npmjs.com/package/@ast-grep/napi).
66+
67+
**Alternatives:** If you are on an older Linux distribution, you can still use ast-grep by:
68+
* Building it from source.
69+
* Using package managers that might compile it for your specific distribution if available (like AUR for Arch Linux).
70+
* Consider upgrading your system to a more recent version of your Linux distribution.
71+
* Keep using ast-grep 0.37 if you don't want to upgrade your system.
72+
73+
### Rust Library API Breaking Changes
74+
75+
For users of ast-grep as a Rust library, please note the following API adjustments:
76+
77+
* `AstGrep` is now an alias for `Root`.
78+
* Tree-sitter specific methods within the `Language` trait have been moved to a new `LanguageExt` trait.
79+
* `StrDoc` and related types have been relocated to the `ast_grep_core::tree_sitter` module.
80+
81+
These changes are part of the larger effort to decouple ast-grep from tree-sitter and provide a cleaner, more maintainable library interface.
82+
83+
## Get Started with 0.38!
84+
85+
We believe these changes, especially the move towards parser independence and the enhanced diagnostic labeling, will make ast-grep an even more powerful and user-friendly tool for your everyday development tasks.
86+
87+
Head over to our [GitHub repo](https://github.com/ast-grep/ast-grep) to grab the latest version. Check out the [documentation](https://ast-grep.github.io/) for more details on how to use the new features.
88+
89+
We're excited to see how you use ast-grep 0.38! As always, your feedback is invaluable, so please don't hesitate to open issues or discussions on our GitHub repository.
90+
91+
Happy Grepping!
151 KB
Loading
67.7 KB
Loading

0 commit comments

Comments
 (0)