ast-grep / ast-grep-vscode

ast-grep VSCode is a structural search and replace extension for many languages.

Home Page:https://marketplace.visualstudio.com/items?itemName=ast-grep.ast-grep-vscode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rewrite code on file save

HerringtonDarkholme opened this issue · comments

Discussed in ast-grep/ast-grep#829

Originally posted by AlexeyDuybo January 1, 2024
Hi, is it possible to rewrite the code, according with the "fix" option in the rules, when saving the file? I use vscode extension but it doesnt rewrite the files on save

commented

Here is some eslint-related information as an entry point for our investigation

image
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit"
  },

In addition, we should try to avoid ast-grep as the default formatter, the most commonly used method of ast-grep should be used as a supplement to the formatter rather than being a formatter. Maybe our goal is to let eslint, prettier etc can work together when saving

image