DEV Community

Herrington Darkholme
Herrington Darkholme

Posted on

ast-grep got 6000 stars!

We are thrilled to announce that ast-grep, the powerful code search tool, has reached a stellar milestone of 6000 stars on GitHub! This is a testament to the community's trust in our tool and the continuous improvements we've made. Let's dive into the latest features and enhancements that make ast-grep the go-to tool for developers worldwide.

ast-grep 6k stars

Feature Enhancements

  • Rewriters Addition: We've added support for rewriters #855, enabling complex code transformations and refactoring with ease. The new feature unlocks a novel functional programming like code rewrite scheme: find and patch. Check out our previous blog post for more details.

rewriter

  • Error/Warning Suppression Support: The new feature #446 allows users to suppress specific errors or warnings via the code comment ast-grep-ignore. ast-grep also respects suppression comments in Language Server Protocol (LSP), making it easier to manage warnings and errors in your codebase.

  • Enhanced Rule Constraints: The ast-grep rule constraints previously only accepted pattern, kind and regex.
    Now it accepts a full rule #855, providing more flexibility than ever before.

VSCode extension

The ast-grep VSCode extension is an official VSCode integration for this CLI tool. It unleashes the power of structural search and replace (SSR) directly into your editor.

Notable Features

  • Search: Find code patterns with syntax tree.
  • Replace: Refactor code with pattern.
  • Diagnose: Identify issues via ast-grep rule.

Performance Boost

  • Parallel Thread Output Fix: A significant fix #be230ca ensures parallel thread outputs are now guaranteed, boosting overall performance.

Architectural Evolution

  • Tree-Sitter Version Bump: We've upgraded to the latest tree-sitter version, enhancing parsing accuracy and speed. In future releases, we plan to leverage tree-sitter's new Web Assembly grammar to support even more languages.
  • Scan and Diff Merge: The refactor combines CombinedScan::scan and CombinedScan::diff for a more streamlined process.
  • Input Stream Optimization: Now, ast-grep avoids unnecessary input stream usage when updating all rules #943, making it possible to use sg scan --update-all.

Usability Improvements

  • Error Messaging for Rule File Parsing: The VSCode extension now provides clearer error messages #968 when rule file parsing fails, making troubleshooting a breeze.

  • Better Pattern Parsing: Improved expando character replacement #883 to make pattern .

  • More Permissive Patterns: Patterns have become more permissive #1087 that allows matching $METAVAR with different syntax kind.

Enhanced Error Reporting

We've introduced a suite of features to improve error reporting, making it easier to debug and refine your code:

  • Report undefined meta-variables, errors in fixes, unused rewriters, and undefined utility rules.
  • Add field ID errors for relational rules and optimize test updates to avoid erroneous reports.
  • Shift from reporting file counts to error counts for a more meaningful insight into code quality.

Image description

Language Support Expansion

  • Haskell Support: Haskell enthusiasts rejoice! ast-grep now supports Haskell via tree-sitter-haskell #1128, broadening our language coverage.

NAPI Advancements

  • NAPI Linux x64 musl Support: Our latest feat in NAPI #c4d7902 adds support for Linux x64 musl, ensuring wider compatibility and performance.

Thanks

As ast-grep continues to grow, we remain committed to providing a tool that not only meets but exceeds the expectations of our diverse user base.

sponsors

We thank each and every one of you, espeically ast-grep's sponsors, for your support, contributions, and feedback that have shaped ast-grep into what it is today. Here's to many more milestones ahead!

Top comments (0)