Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
12.0, 12.1, 12.2, 12.3, 12.4, 12.5
-
None
-
None
Description
Suppose you want to introduce some constants into a class and you can copy that list somewhere and paste it into the class to work on:
<?php class Test { FOO = 1 BAR = 2 BAZ = 3 // 🡤 place caret to each of the 3 lines directly above here }
This is invalid code, but it should be very easy to place a caret in front of each line, type const, jump to the end of the lines and finish it off with a semicolon.
However if you don't type fast enough and autocomplete suggestions appear, then whether you accept a suggestion or continue typing, the code gets broken.
Here's what happens if I type 'c', wait for the suggestions and continue with typing 'o':
cBAZo = 1 coBAZ = 2 coBAZ = 3
Here's what happens if I type 'c', and then accept the 'const' suggestion:
const BAZ = 1 const BAZ = 2 const BAZ = 3
A possible workaround is to type space, then move cursor one character to the left and then type 'const'. If instead of typing a whole 'const', a suggestion is accepted, the code gets some extra spaces, although the names remain intact:
const FOO = 1 const BAR = 2 const BAZ = 3