Now only showing available completion strings
This commit is contained in:
parent
bcb65ec43f
commit
f76ee24316
@ -73,6 +73,16 @@ std::string ChunkToString( CXCompletionString completion_string, int chunk_num )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns true when the provided completion string is available to the user;
|
||||||
|
// unavailable completion strings refer to entities that are private/protected,
|
||||||
|
// deprecated etc.
|
||||||
|
bool CompletionStringAvailable( CXCompletionString completion_string )
|
||||||
|
{
|
||||||
|
return clang_getCompletionAvailability( completion_string ) ==
|
||||||
|
CXAvailability_Available;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector< std::string > ToStringVector( CXCodeCompleteResults *results )
|
std::vector< std::string > ToStringVector( CXCodeCompleteResults *results )
|
||||||
{
|
{
|
||||||
std::vector< std::string > completions;
|
std::vector< std::string > completions;
|
||||||
@ -83,6 +93,9 @@ std::vector< std::string > ToStringVector( CXCodeCompleteResults *results )
|
|||||||
CXCompletionString completion_string =
|
CXCompletionString completion_string =
|
||||||
results->Results[ i ].CompletionString;
|
results->Results[ i ].CompletionString;
|
||||||
|
|
||||||
|
if ( !CompletionStringAvailable( completion_string ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
uint num_chunks = clang_getNumCompletionChunks( completion_string );
|
uint num_chunks = clang_getNumCompletionChunks( completion_string );
|
||||||
for ( uint j = 0; j < num_chunks; ++j )
|
for ( uint j = 0; j < num_chunks; ++j )
|
||||||
{
|
{
|
||||||
@ -265,7 +278,7 @@ Future< AsyncResults > ClangCompleter::CandidatesForQueryAndLocationInFileAsync(
|
|||||||
shared_ptr< packaged_task< AsyncResults > > task =
|
shared_ptr< packaged_task< AsyncResults > > task =
|
||||||
make_shared< packaged_task< AsyncResults > >(
|
make_shared< packaged_task< AsyncResults > >(
|
||||||
bind( ReturnValueAsShared< std::vector< std::string > >,
|
bind( ReturnValueAsShared< std::vector< std::string > >,
|
||||||
sort_candidates_for_query_functor ) );
|
candidates_for_location_in_file_functor ) );
|
||||||
|
|
||||||
clang_task_.Set( task );
|
clang_task_.Set( task );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user