Skip to content

Commit

Permalink
Removing special-case handling of two underscores
Browse files Browse the repository at this point in the history
For C-family languages, we used to remove two consecutive underscores in
identifiers out of a misguided attempt to reduce verbosity of reserved
identifiers. This only produced user confusion.

Fixes ycm-core/YouCompleteMe#2059
  • Loading branch information
Valloric committed Mar 20, 2016
1 parent adebce8 commit b10c48a
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions cpp/ycm/ClangCompleter/CompletionData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ std::string OptionalChunkToString( CXCompletionString completion_string,
}


// NOTE: this function accepts the text param by value on purpose; it internally
// needs a copy before processing the text so the copy might as well be made on
// the parameter BUT if this code is compiled in C++11 mode a move constructor
// can be called on the passed-in value. This is not possible if we accept the
// param by const ref.
std::string RemoveTwoConsecutiveUnderscores( std::string text ) {
boost::erase_all( text, "__" );
return text;
}


// foo( -> foo
// foo() -> foo
std::string RemoveTrailingParens( std::string text ) {
Expand Down Expand Up @@ -196,16 +185,6 @@ CompletionData::CompletionData( const CXCompletionResult &completion_result ) {
original_string_ = RemoveTrailingParens( boost::move( original_string_ ) );
kind_ = CursorKindToCompletionKind( completion_result.CursorKind );

// We remove any two consecutive underscores from the function definition
// since identifiers with them are ugly, 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_ =
RemoveTwoConsecutiveUnderscores(
boost::move( everything_except_return_type_ ) );

detailed_info_.append( return_type_ )
.append( " " )
.append( everything_except_return_type_ )
Expand Down

0 comments on commit b10c48a

Please sign in to comment.