biomejs/biome-intellij

Combination of "run format on save" and "run safe fixes on save" does not work (race condition)

bc-m opened this issue · 3 comments

bc-m commented

Firstly, many thanks for the plugin!

I installed v1-nighly of the plugin today, together with Biome 1.5.0 and found the following problem:

If I activate the option "run format on save" as well as "run safe fixes on save", the two commands seem to be executed at the same time, whereby sometimes the output of format and sometimes of "run safe fixes" wins. Most of the time it is the output of "run safe fixes", which means that the file is not formatted at the end.

Maybe the plugin can do a "biome check" if auto-format and auto-fix (safe or/and unsafe) is enabled?

Running a single "biome check" with multiple options enabled also improves performance by reading, parsing, processing, and writing the file once instead of two or three times.

If I activate the option "run format on save" as well as "run safe fixes on save", the two commands seem to be executed at the same time, whereby sometimes the output of format and sometimes of "run safe fixes" wins. Most of the time it is the output of "run safe fixes", which means that the file is not formatted at the end.

I am not sure we can fix it from our end. If the plugin uses LSP, then it's up to the server (the IDE) to coordinate and apply the correct order. Is it possible that it's a bug in the IDE?

bc-m commented

Can a new option „format and safe fixes on save“ be a solution/workaround? Or is it limited by IntelliJ too?

I am not sure we can fix it from our end. If the plugin uses LSP, then it's up to the server (the IDE) to coordinate and apply the correct order. Is it possible that it's a bug in the IDE?

@ematipico
The on-save feature is not currently supported with LSP in intellij, it uses biome cli with stdin instead.
I've fixed the race condition in #26,