Only showing the first overloaded func signature
This commit is contained in:
parent
e9cf3c14b2
commit
0d9d697b50
@ -39,6 +39,7 @@ using boost::bind;
|
||||
using boost::thread;
|
||||
using boost::lock_guard;
|
||||
using boost::mutex;
|
||||
using boost::unordered_map;
|
||||
|
||||
namespace YouCompleteMe
|
||||
{
|
||||
@ -206,6 +207,8 @@ std::vector< CompletionData > ToCompletionDataVector(
|
||||
std::vector< CompletionData > completions;
|
||||
completions.reserve( results->NumResults );
|
||||
|
||||
unordered_map< std::string, uint > seen_data;
|
||||
|
||||
for ( uint i = 0; i < results->NumResults; ++i )
|
||||
{
|
||||
CXCompletionResult completion_result = results->Results[ i ];
|
||||
@ -213,8 +216,22 @@ std::vector< CompletionData > ToCompletionDataVector(
|
||||
if ( !CompletionStringAvailable( completion_result.CompletionString ) )
|
||||
continue;
|
||||
|
||||
completions.push_back(
|
||||
CompletionResultToCompletionData( completion_result ) );
|
||||
CompletionData data = CompletionResultToCompletionData( completion_result );
|
||||
uint index = GetValueElseInsert( seen_data,
|
||||
data.original_string_,
|
||||
completions.size() );
|
||||
|
||||
if ( index == completions.size() )
|
||||
{
|
||||
completions.push_back( data );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
completions[ index ].detailed_info_
|
||||
.append( "\n" )
|
||||
.append( data.extra_menu_info_ );
|
||||
}
|
||||
}
|
||||
|
||||
return completions;
|
||||
|
@ -39,8 +39,8 @@ void WriteUtf8File( const fs::path &filepath, const std::string &contents );
|
||||
template <class Container, class Key>
|
||||
typename Container::mapped_type &
|
||||
GetValueElseInsert( Container &container,
|
||||
Key const& key,
|
||||
typename Container::mapped_type const& value )
|
||||
const Key &key,
|
||||
const typename Container::mapped_type &value )
|
||||
{
|
||||
return container.insert( typename Container::value_type( key, value ) )
|
||||
.first->second;
|
||||
@ -48,11 +48,22 @@ GetValueElseInsert( Container &container,
|
||||
|
||||
|
||||
template <class Container, class Key>
|
||||
bool ContainsKey( Container &container, Key const& key)
|
||||
bool ContainsKey( Container &container, const Key &key )
|
||||
{
|
||||
return container.find( key ) != container.end();
|
||||
}
|
||||
|
||||
|
||||
template <class Container, class Key>
|
||||
const typename Container::mapped_type &
|
||||
FindWithDefault( Container &container,
|
||||
const Key &key,
|
||||
const typename Container::mapped_type &value )
|
||||
{
|
||||
auto it = container.find( key );
|
||||
return it != container.end() ? *it : value;
|
||||
}
|
||||
|
||||
} // namespace YouCompleteMe
|
||||
|
||||
#endif /* end of include guard: UTILS_H_KEPMRPBH */
|
||||
|
Loading…
Reference in New Issue
Block a user