Use Workspace::getActiveTextEditor
Use PackageManager::onDidActivateAll