Explanation
Pressing ENTER after writing the beginning of an if statement or a while statement (i.e. if Value
, while Value
) results in the remaining keywords (then
, end
; do
, end
) being added directly after the initial statement. This is the intended behaviour.
However, this behaviour occurs incorrectly when a comment (--
) is added directly after the Value
part of the initial statement. Instead of placing the then
/do
prior to the comment, it is placed after the comment, resulting in then
/do
being added as part of the comment.
Example 1 in the video below shows the behaviour occuring with a while Value
, Example 2 shows the behaviour occuring with an if Value
, and Example 3 shows that pressing ENTER while the cursor is after the autogenerated end
keyword causes the then
keyword to be recreated.
Reproduction
- Add the beginning of either an
if
orwhile
(if Value
,while Value
) statement to a script. - Add a comment after the
Value
(--
,-- TEXT
, etc.) - Press ENTER while the cursor is located after the comment (if the cursor is located prior to the comment, then the comment is just moved down a line, with no autocompletion occuring).
- Observe the incorrect placement of
then
/do
.
Device Info
Operating System: Windows 10
CPU: Ryzen 5 3600
GPU: GTX 1650 Super
RAM: 16GB @ 3600MHz