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

[feature request]: update active diff instantly when rewrite has changed

Open alexzhang1030 opened this issue 1 year ago • 3 comments

Currently, ast-grep-vscode will close all opened diff tabs when the rewrite has changed. We can follow the behavior of vscode-search to get a better UX.

https://github.com/ast-grep/ast-grep-vscode/assets/49969959/549abf3b-eb1d-41ab-b4f5-48b492520938

alexzhang1030 avatar Apr 19 '24 06:04 alexzhang1030

It can be done but the behavior is not similar to VSCode. VSCode replacement is computed inside JavaScript while ast-grep replacement is done via spawning new commands.

Supporting this will trigger a lot of processes when changing replacement.

HerringtonDarkholme avatar Apr 19 '24 17:04 HerringtonDarkholme

How about updating the active diff content whenever the item is rerendered? (Rerendering refers to re-searching or changes in input/replacement.)

alexzhang1030 avatar Apr 22 '24 01:04 alexzhang1030

This will prevent the initiation of new processes by calculating active item diffs. Updating the diff content will be lazy, yet intuitive.

alexzhang1030 avatar Apr 22 '24 01:04 alexzhang1030