Automatic statement generation causes Error

Hello,

Because I cannot submit it as a bug I will put it here.

So it seems that if I do If …and then Shift + Enter to autoComplete , on random cases more like 80% of the cases I get the Then and End If added and all ok but when I try to launch the code or check the code I get the following error :

I retype all manually and it works smooth.

Is this an IDE Bug or OS Bug ?

OSX : 10.13.6
IDE : 2018 R 4

Thanks.