Fix autocompletion when function name is missing (fixes #530)

I know it would be nice to have a test but I don't know how to write them :|