ScalaAotCompletionContributor: check identifier validity
(cherry picked from commit a57a19c)