ast-grep-vscode icon indicating copy to clipboard operation
ast-grep-vscode copied to clipboard

Rewrite code on file save

Open HerringtonDarkholme opened this issue 1 year ago • 1 comments

Discussed in https://github.com/ast-grep/ast-grep/discussions/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

HerringtonDarkholme avatar Jan 01 '24 21:01 HerringtonDarkholme

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

SoonIter avatar Feb 14 '24 05:02 SoonIter