-
-
Notifications
You must be signed in to change notification settings - Fork 335
Description
I guess it's up to you to decide whether this is a bug or not.
ast-grep 0.32.2 did output a trailing newline with the --json=stream parameter and 0.36.2 doesn't anymore. So the last JSON line of output is without trailing newline.
I ran a git bisect, but it's inconclusive because some commits don't build (maybe i'm holding it wrong though). That's the output of the bisect:
There are only 'skip'ped commits left to test.
The first bad commit could be any of:
60bae03d877f62c7911ee9301f4a582c71708b20
59165c32553eeac51549339a9265bd014220e5f1
df4b536cdabbcfd619628832c80212baa6c0fa8e
8df197a18328447813873ae7477c4f14d34ed6c9
b9bedf4bb14297ef46a626f88c151b6ffbff6624
1f0f2d41b3f4e0c6d739a16d4d643a62605e3805
We cannot bisect more!
I ran the bisect partly to find out whether this was an intentional change. Clearly there was a refactor of the JSON printer, and so I'm guessing that the change was not intentional.
As far as I know it's general considered good practice to finish the output with trailing newlines, but i guess a program is not "broken" if it doesn't do so. So it's probably up to you to decide whether you want to re-introduce them back or not.
The reason I hit that is that this triggered a bug in neovim's telescope plugin, which doesn't handle properly commands which don't output a trailing newline: nvim-telescope/telescope.nvim#2517 - no matter what ast-grep does, i think telescope should fix the issue on their side though.
I'd say it would be valid for you to answer there's no bug in ast-grep, or you might as well decide to introduce the trailing newline back, so I'm opening the issue and leaving it up to you.
PS: ast-grep is a fantastic tool!