Closed FMCorz closed 6 months ago
ok, this is the worst kind of error - race condition. I could not reproduce it at first but then I turned off "autosave" and was able to reproduce it.
Unfortunately vscode api does not tell me how the new file was created - using "Save as" or just creating a new file. I was already checking that the file is empty before inserting boilerplate but clearly this is when the race condition occurred, it was first reported as empty but then two processes wrote to the file simulteneously.
The only solution I could think of is to wait 300ms after the file is created but before checking if it is empty. Hope you have a fast computer :) This will be added in the new release (tonight), let me know if it fixed it for you
This is implemented in version 1.0.32 (released today)
It works perfectly now, thank you!
I typically "Save as" some file to create another, that way I keep a lot of the boilerplate and sometimes even method. It's my way of duplicating code.
I have observed that when I "Save as" with MDLCode, the following occurs:
I suspect this is due to the intent for MDLCode to add the boilerplate itself, which conflicts with my file duplication.