I don’t think it’s been expressed anywhere exactly how this is accomplished behind the scenes. It does seem to be looking for patterns and context clues though. I’m not sure that I’d call it machine learning per se, but I’m no expert in that.
I demonstrate this lightly in the video linked below (the link jumps directly to the demo), but for example it will append ()
after a function call if it thinks it’s needed, but the clue for that comes from having seen you do it previously in the file. Similarly it notices a pattern of there being text inside of call parenthesis or not and puts the cursor inside.
Perhaps the most learning-adjacent thing here is the aspect of noticing what sorts of values you’re assigning to things and added them to the AC list and prioritizing their positions for you. Though that could still be explained by pattern recognition, I would think.
From my experimentation it only takes a single clue in any of the cases I tried for it to decide it’s something that should happen, and in “real world” code examples it has always gotten it correct as well.