Showing preview window data for completions

Also, const functions have " const" correctly appended in the completion window.
This commit is contained in:
Strahinja Val Markovic 2012-08-05 19:49:54 -07:00
parent bf9eba70ac
commit 5f95a2bfde
3 changed files with 10 additions and 6 deletions

View File

@ -96,6 +96,7 @@ bool IsMainCompletionTextInfo( CXCompletionChunkKind kind )
kind == CXCompletionChunk_Colon ||
kind == CXCompletionChunk_SemiColon ||
kind == CXCompletionChunk_Equal ||
kind == CXCompletionChunk_Informative ||
kind == CXCompletionChunk_HorizontalSpace;
}
@ -204,9 +205,6 @@ CompletionData CompletionResultToCompletionData(
if ( kind == CXCompletionChunk_TypedText )
data.original_string_ = ChunkToString( completion_string, j );
if ( kind == CXCompletionChunk_Informative )
data.detailed_info_ = ChunkToString( completion_string, j );
}
data.kind_ = CursorKindToVimKind( completion_result.CursorKind );
@ -243,11 +241,16 @@ std::vector< CompletionData > ToCompletionDataVector(
else
{
std::string possible_newline =
completions[ index ].detailed_info_.empty() ?
"" :
"\n";
// If we have already seen this completion, then this is an overload of a
// function we have seen. We add the signature of the overload to the
// detailed information.
completions[ index ].detailed_info_
.append( "\n" )
.append( possible_newline )
.append( data.return_type_ )
.append( " " )
.append( data.everything_except_return_type_ );

View File

@ -40,7 +40,7 @@ BOOST_PYTHON_MODULE(ycm_core)
.def( "TextToInsertInBuffer", &CompletionData::TextToInsertInBuffer )
.def( "MainCompletionText", &CompletionData::MainCompletionText )
.def( "ExtraMenuInfo", &CompletionData::ExtraMenuInfo )
.def( "DetailedInfoForPreviewWindow ",
.def( "DetailedInfoForPreviewWindow",
&CompletionData::DetailedInfoForPreviewWindow )
.def_readonly( "kind_", &CompletionData::kind_ );

View File

@ -146,14 +146,15 @@ def CompletionDataToDict( completion_data ):
'abbr' : completion_data.MainCompletionText(),
'menu' : completion_data.ExtraMenuInfo(),
'kind' : completion_data.kind_,
'info' : completion_data.DetailedInfoForPreviewWindow(),
'dup' : 1,
# TODO: add detailed_info_ as 'info'
}
def DiagnosticToDict( diagnostic ):
# see :h getqflist for a description of the dictionary fields
return {
# TODO: wrap the bufnr generation into a function
'bufnr' : int( vim.eval( "bufnr('{0}', 1)".format(
diagnostic.filename_ ) ) ),
'lnum' : diagnostic.line_number_,