CompletionData::CompletionData( const CXCompletionResult &completion_result ) { CXCompletionString completion_string = completion_result.CompletionString; if ( !completion_string ) return; uint num_chunks = clang_getNumCompletionChunks( completion_string ); bool saw_left_paren = false; bool saw_function_params = false; bool saw_placeholder = false; for ( uint j = 0; j < num_chunks; ++j ) { ExtractDataFromChunk( completion_string, j, saw_left_paren, saw_function_params, saw_placeholder ); } original_string_ = RemoveTrailingParens( boost::move( original_string_ ) ); kind_ = CursorKindToCompletionKind( completion_result.CursorKind ); detailed_info_.append( return_type_ ) .append( " " ) .append( everything_except_return_type_ ) .append( "\n" ); doc_string_ = YouCompleteMe::CXStringToString( clang_getCompletionBriefComment( completion_string ) ); }
CompletionData::CompletionData( CXCompletionString completion_string, CXCursorKind kind, CXCodeCompleteResults *results, size_t index ) { size_t num_chunks = clang_getNumCompletionChunks( completion_string ); bool saw_left_paren = false; bool saw_function_params = false; bool saw_placeholder = false; for ( size_t j = 0; j < num_chunks; ++j ) { ExtractDataFromChunk( completion_string, j, saw_left_paren, saw_function_params, saw_placeholder ); } original_string_ = RemoveTrailingParens( std::move( original_string_ ) ); kind_ = CursorKindToCompletionKind( kind ); detailed_info_.append( return_type_ ) .append( " " ) .append( everything_except_return_type_ ) .append( "\n" ); doc_string_ = CXStringToString( clang_getCompletionBriefComment( completion_string ) ); BuildCompletionFixIt( results, index ); }
CompletionData::CompletionData( const CXCompletionResult &completion_result, bool is_argument_hint ) { CXCompletionString completion_string = completion_result.CompletionString; if ( !completion_string ) return; uint num_chunks = clang_getNumCompletionChunks( completion_string ); bool saw_left_paren = false; bool saw_function_params = false; bool saw_placeholder = false; for ( uint j = 0; j < num_chunks; ++j ) { ExtractDataFromChunk( completion_string, j, saw_left_paren, saw_function_params, saw_placeholder ); } original_string_ = RemoveTrailingParens( boost::move( original_string_ ) ); kind_ = CursorKindToCompletionKind( completion_result.CursorKind ); // We trim any underscores from the function definition since identifiers // with them are ugly, in most cases compiler-reserved names. Functions // from the standard library use parameter names like "__pos" and we want to // show them as just "pos". This will never interfere with client code since // ANY C++ identifier with two consecutive underscores in it is // compiler-reserved. everything_except_return_type_ = TrimUnderscores( everything_except_return_type_ ); detailed_info_.append( return_type_ ) .append( " " ) .append( everything_except_return_type_ ) .append( "\n" ); doc_string_ = YouCompleteMe::CXStringToString( clang_getCompletionBriefComment( completion_string ) ); // This address issue #1287 if ( kind_ == YouCompleteMe::FUNCTION || kind_ == YouCompleteMe::UNKNOWN ) everything_except_return_type_ = original_string_; if ( is_argument_hint ) { kind_ = NONE; return_type_ = ""; original_string_ = ""; everything_except_return_type_ = TrimUnderscores( current_arg_ ); if ( everything_except_return_type_.empty() ) everything_except_return_type_ = "void"; } }
CompletionData::CompletionData( const CXCompletionResult &completion_result, bool is_argument_hint ) { CXCompletionString completion_string = completion_result.CompletionString; if ( !completion_string ) return; size_t num_chunks = clang_getNumCompletionChunks( completion_string ); bool saw_left_paren = false; bool saw_function_params = false; bool saw_placeholder = false; for ( size_t j = 0; j < num_chunks; ++j ) { ExtractDataFromChunk( completion_string, j, saw_left_paren, saw_function_params, saw_placeholder ); } original_string_ = RemoveTrailingParens( std::move( original_string_ ) ); kind_ = CursorKindToCompletionKind( completion_result.CursorKind ); detailed_info_.append( return_type_ ) .append( " " ) .append( everything_except_return_type_ ) .append( "\n" ); doc_string_ = YouCompleteMe::CXStringToString( clang_getCompletionBriefComment( completion_string ) ); // This address issue #1287 if ( kind_ == YouCompleteMe::FUNCTION || kind_ == YouCompleteMe::UNKNOWN ) everything_except_return_type_ = original_string_; if ( is_argument_hint ) { kind_ = NONE; return_type_ = ""; original_string_ = ""; everything_except_return_type_ = current_arg_; if ( everything_except_return_type_.empty() ) everything_except_return_type_ = "void"; } }