add check for whether we found imports; improve detection of word around cursor