void PHPCodeCompletion::DoShowCompletionBox(const PHPEntityBase::List_t& entries, PHPExpression::Ptr_t expr) { std::vector<TagEntryPtr> tags; wxStringSet_t uniqueEntries; // search for the old item PHPEntityBase::List_t::const_iterator iter = entries.begin(); for(; iter != entries.end(); ++iter) { PHPEntityBase::Ptr_t entry = *iter; if(uniqueEntries.count(entry->GetFullName()) == 0) { uniqueEntries.insert(entry->GetFullName()); } else { // don't add duplicate entries continue; } PHPEntityBase::Ptr_t ns = expr->GetSourceFile()->Namespace(); // the namespace at the source file TagEntryPtr t = DoPHPEntityToTagEntry(entry); t->SetUserData(new PHPCCUserData(entry)); tags.push_back(t); } if(tags.empty()) return; std::sort(tags.begin(), tags.end(), _SAscendingSort()); m_manager->GetActiveEditor()->ShowCompletionBox(tags, expr->GetFilter(), false, this); }
void PHPCodeCompletion::DoShowCompletionBox(const PHPEntityBase::List_t& entries, PHPExpression::Ptr_t expr) { wxCodeCompletionBoxEntry::Vec_t ccEntries; TagEntryPtrVector_t tags; wxStringSet_t uniqueEntries; // search for the old item PHPEntityBase::List_t::const_iterator iter = entries.begin(); for(; iter != entries.end(); ++iter) { PHPEntityBase::Ptr_t entry = *iter; if(uniqueEntries.count(entry->GetFullName()) == 0) { uniqueEntries.insert(entry->GetFullName()); } else { // don't add duplicate entries continue; } PHPEntityBase::Ptr_t ns = expr->GetSourceFile()->Namespace(); // the namespace at the source file TagEntryPtr t = DoPHPEntityToTagEntry(entry); tags.push_back(t); } std::sort(tags.begin(), tags.end(), _SAscendingSort()); for(size_t i = 0; i < tags.size(); ++i) { wxCodeCompletionBoxEntry::Ptr_t ccEntry = wxCodeCompletionBox::TagToEntry(tags.at(i)); ccEntry->SetComment(tags.at(i)->GetComment()); ccEntries.push_back(ccEntry); } wxCodeCompletionBoxManager::Get().ShowCompletionBox( m_manager->GetActiveEditor()->GetCtrl(), ccEntries, wxCodeCompletionBox::kRefreshOnKeyType, wxNOT_FOUND); }