Studio Autocompletes digits to variables

Add the following contents to a script, moving the cursor to after 0:

image

Intellisense thinks this should be completed to s = xy0. Pressing enter to advance to the next line instead replaces 0 with xy0, which is never a reasonable substitution:

image

Studio does not make the suggestion if the variable is much longer than the number (e.g., 1 will not autocomplete to xyz10 but 10 will autocomplete to xyz10).

Studio should never autocomplete numbers to variable names.

5 Likes

This is probably more a personal issue than anything, but it really bothers me when hitting enter ever selects the autocomplete option. More often than not I’m wanting to hit enter so I can go down a line, and use the tab key if I’m looking to use the autocomplete.

But yeah if strings don’t autocomplete numbers shouldn’t either. I can’t imagine where numbers autocompleting would even be useful

5 Likes

This happens with a for i, v in pairs loop as well. If any variable has v or I in it, autocomplete overcomplicates moving to a new line sometimes.

edit: I used I and v as examples in this, so you might have had instances with a, b or x, y, etc.

I would argue that using numbers in your variable names is very bad practice, so if you were following convention you would not have this issue.

I am also, however, not a fan of enter being the autocomplete select key. Right arrow or tab would be better.

1 Like

Sounds like more reason not to name your loop variables “i,v” to me.

While using numbers in names is often a warning sign, sometimes it is totally justified. The context that made me trip over this used the names t0 and t1 to refer to initial/final values in a generic integral which is totally standard notation and would be obscured by using words.

Regardless of the context, the current behavior is unreasonable.

1 Like