function doTest(part)
part.Name = "hi"
print(part.n)
end
local newPart = Instance.new("Part")
doTest(newPart)
Complete typing on part.n. While typing, Studio will select the autocomplete option of what I’m typing
Expected Behavior
Studio should select the next-best autocomplete option there is available
Actual Behavior
Studio selects the autocomplete option that is 1:1 to what I’m typing. It’s not useful if you have to use arrow keys/mouse selection to get your result instead.
Issue Area: Studio Issue Type: Display Impact: High Frequency: Constantly
The trouble here is that, since we have no type for “part,” we need to infer one. Based on the contents of the script when we generate the Autocomplete suggestions, the type inference believes that part is a table type with properties ‘Name’ and whatever you’ve typed on line 4. We’ll take a look to see if we can improve this case.
As a workaround, you should be able to avoid this by specifying a type for part. For example try changing function doTest(part) -> function doTest(part : BasePart)
Yes, I declared the property in the line above it though. Using types isn’t really a solution for us; as we have existing codebases not written to support them. Having autocomplete always suggesting the exact phrase I am typing out isn’t helpful to me, I would rather it deprioritizes that first option and tries to suggest any other complete results.
You still didn’t declare the type. function doTest(part : BasePart) is the correct way to declare it.
This isn’t a bug. Roblox Studio intentionally doesn’t assume the type without a type declaration. In the newer update, Roblox will auto-complete with type declarations.
Sublime Text doesn’t have Luau analysis. I think the point they’re trying to make is that Studio should not count the string you are autocompleting as one of the autocomplete options if there are no other instances of it in your code.