I will answer my own question because I have found the problem (I think).
The autocomplete for custom object depends on the metadata definition, like @sfdcfox said.
After updating the sobjects it did not work again. The tricky part is: my org has a namespace, so I should explicitly specify the namespace prefix to the custom object name in the apex code.
It is not necessary to do this in order for the code to work, but it seems to be necessary for the vs code to make the autocompletion work :(
So with a namespace prefix it works, without it not: