Renaming Completer to IdentifierCompleter
This commit is contained in:
parent
39ceebbb1e
commit
545792c055
@ -58,7 +58,6 @@ class ClangComplete : boost::noncopyable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClangComplete();
|
ClangComplete();
|
||||||
|
|
||||||
~ClangComplete();
|
~ClangComplete();
|
||||||
|
|
||||||
void SetGlobalCompileFlags( const std::vector< std::string > &flags );
|
void SetGlobalCompileFlags( const std::vector< std::string > &flags );
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Completer.h"
|
#include "IdentifierCompleter.h"
|
||||||
#include "standard.h"
|
#include "standard.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
@ -53,23 +53,25 @@ void ThreadMain( LatestTask &latest_task )
|
|||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
|
|
||||||
Completer::Completer( const std::vector< std::string > &candidates )
|
IdentifierCompleter::IdentifierCompleter(
|
||||||
|
const std::vector< std::string > &candidates )
|
||||||
: threading_enabled_( false )
|
: threading_enabled_( false )
|
||||||
{
|
{
|
||||||
AddCandidatesToDatabase( candidates, "", "", true );
|
AddCandidatesToDatabase( candidates, "", "", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Completer::Completer( const std::vector< std::string > &candidates,
|
IdentifierCompleter::IdentifierCompleter(
|
||||||
const std::string &filetype,
|
const std::vector< std::string > &candidates,
|
||||||
const std::string &filepath )
|
const std::string &filetype,
|
||||||
|
const std::string &filepath )
|
||||||
: threading_enabled_( false )
|
: threading_enabled_( false )
|
||||||
{
|
{
|
||||||
AddCandidatesToDatabase( candidates, filetype, filepath, true );
|
AddCandidatesToDatabase( candidates, filetype, filepath, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Completer::~Completer()
|
IdentifierCompleter::~IdentifierCompleter()
|
||||||
{
|
{
|
||||||
foreach ( const CandidateRepository::value_type &pair,
|
foreach ( const CandidateRepository::value_type &pair,
|
||||||
candidate_repository_ )
|
candidate_repository_ )
|
||||||
@ -81,14 +83,14 @@ Completer::~Completer()
|
|||||||
|
|
||||||
// We need this mostly so that we can not use it in tests. Apparently the
|
// We need this mostly so that we can not use it in tests. Apparently the
|
||||||
// GoogleTest framework goes apeshit on us if we enable threads by default.
|
// GoogleTest framework goes apeshit on us if we enable threads by default.
|
||||||
void Completer::EnableThreading()
|
void IdentifierCompleter::EnableThreading()
|
||||||
{
|
{
|
||||||
threading_enabled_ = true;
|
threading_enabled_ = true;
|
||||||
InitThreads();
|
InitThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Completer::AddCandidatesToDatabase(
|
void IdentifierCompleter::AddCandidatesToDatabase(
|
||||||
const std::vector< std::string > &new_candidates,
|
const std::vector< std::string > &new_candidates,
|
||||||
const std::string &filetype,
|
const std::string &filetype,
|
||||||
const std::string &filepath,
|
const std::string &filepath,
|
||||||
@ -112,14 +114,14 @@ void Completer::AddCandidatesToDatabase(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector< std::string > Completer::CandidatesForQuery(
|
std::vector< std::string > IdentifierCompleter::CandidatesForQuery(
|
||||||
const std::string &query ) const
|
const std::string &query ) const
|
||||||
{
|
{
|
||||||
return CandidatesForQueryAndType( query, "" );
|
return CandidatesForQueryAndType( query, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector< std::string > Completer::CandidatesForQueryAndType(
|
std::vector< std::string > IdentifierCompleter::CandidatesForQueryAndType(
|
||||||
const std::string &query,
|
const std::string &query,
|
||||||
const std::string &filetype ) const
|
const std::string &filetype ) const
|
||||||
{
|
{
|
||||||
@ -135,7 +137,7 @@ std::vector< std::string > Completer::CandidatesForQueryAndType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future Completer::CandidatesForQueryAndTypeAsync(
|
Future IdentifierCompleter::CandidatesForQueryAndTypeAsync(
|
||||||
const std::string &query,
|
const std::string &query,
|
||||||
const std::string &filetype ) const
|
const std::string &filetype ) const
|
||||||
{
|
{
|
||||||
@ -146,7 +148,7 @@ Future Completer::CandidatesForQueryAndTypeAsync(
|
|||||||
// Try not to look at this too hard, it may burn your eyes.
|
// Try not to look at this too hard, it may burn your eyes.
|
||||||
shared_ptr< packaged_task< AsyncResults > > task =
|
shared_ptr< packaged_task< AsyncResults > > task =
|
||||||
make_shared< packaged_task< AsyncResults > >(
|
make_shared< packaged_task< AsyncResults > >(
|
||||||
bind( &Completer::ResultsForQueryAndType,
|
bind( &IdentifierCompleter::ResultsForQueryAndType,
|
||||||
boost::cref( *this ),
|
boost::cref( *this ),
|
||||||
query,
|
query,
|
||||||
filetype ) );
|
filetype ) );
|
||||||
@ -158,7 +160,7 @@ Future Completer::CandidatesForQueryAndTypeAsync(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AsyncResults Completer::ResultsForQueryAndType(
|
AsyncResults IdentifierCompleter::ResultsForQueryAndType(
|
||||||
const std::string &query,
|
const std::string &query,
|
||||||
const std::string &filetype ) const
|
const std::string &filetype ) const
|
||||||
{
|
{
|
||||||
@ -168,9 +170,10 @@ AsyncResults Completer::ResultsForQueryAndType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Completer::ResultsForQueryAndType( const std::string &query,
|
void IdentifierCompleter::ResultsForQueryAndType(
|
||||||
const std::string &filetype,
|
const std::string &query,
|
||||||
std::vector< Result > &results ) const
|
const std::string &filetype,
|
||||||
|
std::vector< Result > &results ) const
|
||||||
{
|
{
|
||||||
FiletypeMap::const_iterator it = filetype_map_.find( filetype );
|
FiletypeMap::const_iterator it = filetype_map_.find( filetype );
|
||||||
if ( it == filetype_map_.end() )
|
if ( it == filetype_map_.end() )
|
||||||
@ -196,7 +199,7 @@ void Completer::ResultsForQueryAndType( const std::string &query,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::list< const Candidate* >& Completer::GetCandidateList(
|
std::list< const Candidate* >& IdentifierCompleter::GetCandidateList(
|
||||||
const std::string &filetype,
|
const std::string &filetype,
|
||||||
const std::string &filepath )
|
const std::string &filepath )
|
||||||
{
|
{
|
||||||
@ -216,7 +219,7 @@ std::list< const Candidate* >& Completer::GetCandidateList(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Completer::InitThreads()
|
void IdentifierCompleter::InitThreads()
|
||||||
{
|
{
|
||||||
int threads_to_create =
|
int threads_to_create =
|
||||||
std::max( MIN_ASYNC_THREADS,
|
std::max( MIN_ASYNC_THREADS,
|
@ -54,15 +54,15 @@ typedef ConcurrentLatestValue<
|
|||||||
boost::packaged_task< AsyncResults > > > LatestTask;
|
boost::packaged_task< AsyncResults > > > LatestTask;
|
||||||
|
|
||||||
|
|
||||||
class Completer : boost::noncopyable
|
class IdentifierCompleter : boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Completer() {}
|
IdentifierCompleter() {}
|
||||||
Completer( const std::vector< std::string > &candidates );
|
IdentifierCompleter( const std::vector< std::string > &candidates );
|
||||||
Completer( const std::vector< std::string > &candidates,
|
IdentifierCompleter( const std::vector< std::string > &candidates,
|
||||||
const std::string &filetype,
|
const std::string &filetype,
|
||||||
const std::string &filepath );
|
const std::string &filepath );
|
||||||
~Completer();
|
~IdentifierCompleter();
|
||||||
|
|
||||||
void EnableThreading();
|
void EnableThreading();
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
// along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Completer.h"
|
#include "IdentifierCompleter.h"
|
||||||
#include "ClangComplete.h"
|
#include "ClangComplete.h"
|
||||||
#include "Future.h"
|
#include "Future.h"
|
||||||
|
|
||||||
@ -35,11 +35,12 @@ BOOST_PYTHON_MODULE(indexer)
|
|||||||
.def( "ResultsReady", &Future::ResultsReady )
|
.def( "ResultsReady", &Future::ResultsReady )
|
||||||
.def( "GetResults", &Future::GetResults );
|
.def( "GetResults", &Future::GetResults );
|
||||||
|
|
||||||
class_< Completer, boost::noncopyable >( "Completer" )
|
class_< IdentifierCompleter, boost::noncopyable >( "IdentifierCompleter" )
|
||||||
.def( "EnableThreading", &Completer::EnableThreading )
|
.def( "EnableThreading", &IdentifierCompleter::EnableThreading )
|
||||||
.def( "AddCandidatesToDatabase", &Completer::AddCandidatesToDatabase )
|
.def( "AddCandidatesToDatabase",
|
||||||
|
&IdentifierCompleter::AddCandidatesToDatabase )
|
||||||
.def( "CandidatesForQueryAndTypeAsync",
|
.def( "CandidatesForQueryAndTypeAsync",
|
||||||
&Completer::CandidatesForQueryAndTypeAsync );
|
&IdentifierCompleter::CandidatesForQueryAndTypeAsync );
|
||||||
|
|
||||||
// CAREFUL HERE! For filename and contents we are referring directly to
|
// CAREFUL HERE! For filename and contents we are referring directly to
|
||||||
// Python-allocated and -managed memory since we are accepting pointers to
|
// Python-allocated and -managed memory since we are accepting pointers to
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include <gmock/gmock.h>
|
#include <gmock/gmock.h>
|
||||||
#include "Completer.h"
|
#include "IdentifierCompleter.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
using ::testing::ElementsAre;
|
using ::testing::ElementsAre;
|
||||||
@ -64,16 +64,16 @@ std::vector< std::string > Candidates( const std::string &a,
|
|||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
|
||||||
|
|
||||||
TEST( CompleterTest, OneCandidate )
|
TEST( IdentifierCompleterTest, OneCandidate )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"foobar" ) ).CandidatesForQuery( "fbr" ),
|
"foobar" ) ).CandidatesForQuery( "fbr" ),
|
||||||
ElementsAre( "foobar" ) );
|
ElementsAre( "foobar" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, ManyCandidateSimple )
|
TEST( IdentifierCompleterTest, ManyCandidateSimple )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"foobar",
|
"foobar",
|
||||||
"foobartest",
|
"foobartest",
|
||||||
"Foobartest" ) ).CandidatesForQuery( "fbr" ),
|
"Foobartest" ) ).CandidatesForQuery( "fbr" ),
|
||||||
@ -82,131 +82,131 @@ TEST( CompleterTest, ManyCandidateSimple )
|
|||||||
"foobartest" ) ) );
|
"foobartest" ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, FirstCharSameAsQueryWins )
|
TEST( IdentifierCompleterTest, FirstCharSameAsQueryWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"foobar",
|
"foobar",
|
||||||
"afoobar" ) ).CandidatesForQuery( "fbr" ),
|
"afoobar" ) ).CandidatesForQuery( "fbr" ),
|
||||||
ElementsAre( "foobar",
|
ElementsAre( "foobar",
|
||||||
"afoobar" ) );
|
"afoobar" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, CompleteMatchForWordBoundaryCharsWins )
|
TEST( IdentifierCompleterTest, CompleteMatchForWordBoundaryCharsWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"FooBarQux",
|
"FooBarQux",
|
||||||
"FBaqux" ) ).CandidatesForQuery( "fbq" ),
|
"FBaqux" ) ).CandidatesForQuery( "fbq" ),
|
||||||
ElementsAre( "FooBarQux",
|
ElementsAre( "FooBarQux",
|
||||||
"FBaqux" ) );
|
"FBaqux" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"CompleterTest",
|
"CompleterTest",
|
||||||
"CompleteMatchForWordBoundaryCharsWins" ) )
|
"CompleteMatchForWordBoundaryCharsWins" ) )
|
||||||
.CandidatesForQuery( "ct" ),
|
.CandidatesForQuery( "ct" ),
|
||||||
ElementsAre( "CompleterTest",
|
ElementsAre( "CompleterTest",
|
||||||
"CompleteMatchForWordBoundaryCharsWins" ) );
|
"CompleteMatchForWordBoundaryCharsWins" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"FooBar",
|
"FooBar",
|
||||||
"FooBarRux" ) ).CandidatesForQuery( "fbr" ),
|
"FooBarRux" ) ).CandidatesForQuery( "fbr" ),
|
||||||
ElementsAre( "FooBarRux",
|
ElementsAre( "FooBarRux",
|
||||||
"FooBar" ) );
|
"FooBar" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, RatioUtilizationTieBreak )
|
TEST( IdentifierCompleterTest, RatioUtilizationTieBreak )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"aGaaFooBarQux",
|
"aGaaFooBarQux",
|
||||||
"aBaafbq" ) ).CandidatesForQuery( "fbq" ),
|
"aBaafbq" ) ).CandidatesForQuery( "fbq" ),
|
||||||
ElementsAre( "aGaaFooBarQux",
|
ElementsAre( "aGaaFooBarQux",
|
||||||
"aBaafbq" ) );
|
"aBaafbq" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"aFooBarQux",
|
"aFooBarQux",
|
||||||
"afbq" ) ).CandidatesForQuery( "fbq" ),
|
"afbq" ) ).CandidatesForQuery( "fbq" ),
|
||||||
ElementsAre( "aFooBarQux",
|
ElementsAre( "aFooBarQux",
|
||||||
"afbq" ) );
|
"afbq" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"acaaCaaFooGxx",
|
"acaaCaaFooGxx",
|
||||||
"aCaafoog" ) ).CandidatesForQuery( "caafoo" ),
|
"aCaafoog" ) ).CandidatesForQuery( "caafoo" ),
|
||||||
ElementsAre( "acaaCaaFooGxx",
|
ElementsAre( "acaaCaaFooGxx",
|
||||||
"aCaafoog" ) );
|
"aCaafoog" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"acaaCaaFooGxx",
|
"acaaCaaFooGxx",
|
||||||
"aCaafoog" ) ).CandidatesForQuery( "caaFoo" ),
|
"aCaafoog" ) ).CandidatesForQuery( "caaFoo" ),
|
||||||
ElementsAre( "acaaCaaFooGxx",
|
ElementsAre( "acaaCaaFooGxx",
|
||||||
"aCaafoog" ) );
|
"aCaafoog" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"FooBarQux",
|
"FooBarQux",
|
||||||
"FooBarQuxZaa" ) ).CandidatesForQuery( "fbq" ),
|
"FooBarQuxZaa" ) ).CandidatesForQuery( "fbq" ),
|
||||||
ElementsAre( "FooBarQux",
|
ElementsAre( "FooBarQux",
|
||||||
"FooBarQuxZaa" ) );
|
"FooBarQuxZaa" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"FooBar",
|
"FooBar",
|
||||||
"FooBarRux" ) ).CandidatesForQuery( "fba" ),
|
"FooBarRux" ) ).CandidatesForQuery( "fba" ),
|
||||||
ElementsAre( "FooBar",
|
ElementsAre( "FooBar",
|
||||||
"FooBarRux" ) );
|
"FooBarRux" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, QueryPrefixOfCandidateWins )
|
TEST( IdentifierCompleterTest, QueryPrefixOfCandidateWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"foobar",
|
"foobar",
|
||||||
"fbaroo" ) ).CandidatesForQuery( "foo" ),
|
"fbaroo" ) ).CandidatesForQuery( "foo" ),
|
||||||
ElementsAre( "foobar",
|
ElementsAre( "foobar",
|
||||||
"fbaroo" ) );
|
"fbaroo" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, LowerMatchCharIndexSumWins )
|
TEST( IdentifierCompleterTest, LowerMatchCharIndexSumWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"ratio_of_word_boundary_chars_in_query_",
|
"ratio_of_word_boundary_chars_in_query_",
|
||||||
"first_char_same_in_query_and_text_") )
|
"first_char_same_in_query_and_text_") )
|
||||||
.CandidatesForQuery( "charinq" ),
|
.CandidatesForQuery( "charinq" ),
|
||||||
ElementsAre( "first_char_same_in_query_and_text_",
|
ElementsAre( "first_char_same_in_query_and_text_",
|
||||||
"ratio_of_word_boundary_chars_in_query_") );
|
"ratio_of_word_boundary_chars_in_query_") );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"barfooq",
|
"barfooq",
|
||||||
"barquxfoo" ) ).CandidatesForQuery( "foo" ),
|
"barquxfoo" ) ).CandidatesForQuery( "foo" ),
|
||||||
ElementsAre( "barfooq",
|
ElementsAre( "barfooq",
|
||||||
"barquxfoo") );
|
"barquxfoo") );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"xxxxxxabc",
|
"xxxxxxabc",
|
||||||
"xxabcxxxx" ) ).CandidatesForQuery( "abc" ),
|
"xxabcxxxx" ) ).CandidatesForQuery( "abc" ),
|
||||||
ElementsAre( "xxabcxxxx",
|
ElementsAre( "xxabcxxxx",
|
||||||
"xxxxxxabc") );
|
"xxxxxxabc") );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"FooBarQux",
|
"FooBarQux",
|
||||||
"FaBarQux" ) ).CandidatesForQuery( "fbq" ),
|
"FaBarQux" ) ).CandidatesForQuery( "fbq" ),
|
||||||
ElementsAre( "FaBarQux",
|
ElementsAre( "FaBarQux",
|
||||||
"FooBarQux" ) );
|
"FooBarQux" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, ShorterCandidateWins )
|
TEST( IdentifierCompleterTest, ShorterCandidateWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"CompleterT",
|
"CompleterT",
|
||||||
"CompleterTest" ) ).CandidatesForQuery( "co" ),
|
"CompleterTest" ) ).CandidatesForQuery( "co" ),
|
||||||
ElementsAre( "CompleterT",
|
ElementsAre( "CompleterT",
|
||||||
"CompleterTest" ) );
|
"CompleterTest" ) );
|
||||||
|
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"CompleterT",
|
"CompleterT",
|
||||||
"CompleterTest" ) ).CandidatesForQuery( "plet" ),
|
"CompleterTest" ) ).CandidatesForQuery( "plet" ),
|
||||||
ElementsAre( "CompleterT",
|
ElementsAre( "CompleterT",
|
||||||
"CompleterTest" ) );
|
"CompleterTest" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST( CompleterTest, SameLowercaseCandidateWins )
|
TEST( IdentifierCompleterTest, SameLowercaseCandidateWins )
|
||||||
{
|
{
|
||||||
EXPECT_THAT( Completer( Candidates(
|
EXPECT_THAT( IdentifierCompleter( Candidates(
|
||||||
"foobar",
|
"foobar",
|
||||||
"Foobar" ) ).CandidatesForQuery( "foo" ),
|
"Foobar" ) ).CandidatesForQuery( "foo" ),
|
||||||
ElementsAre( "foobar",
|
ElementsAre( "foobar",
|
@ -22,12 +22,12 @@ import vim
|
|||||||
import indexer
|
import indexer
|
||||||
|
|
||||||
min_num_chars = int( vim.eval( "g:ycm_min_num_of_chars_for_completion" ) )
|
min_num_chars = int( vim.eval( "g:ycm_min_num_of_chars_for_completion" ) )
|
||||||
|
|
||||||
clang_filetypes = set( [ 'c', 'cpp', 'objc', 'objcpp' ] )
|
clang_filetypes = set( [ 'c', 'cpp', 'objc', 'objcpp' ] )
|
||||||
|
|
||||||
|
|
||||||
class CompletionSystem( object ):
|
class CompletionSystem( object ):
|
||||||
def __init__( self ):
|
def __init__( self ):
|
||||||
self.completer = indexer.Completer()
|
self.completer = indexer.IdentifierCompleter()
|
||||||
self.completer.EnableThreading()
|
self.completer.EnableThreading()
|
||||||
self.pattern = re.compile( r"[_a-zA-Z]\w*" )
|
self.pattern = re.compile( r"[_a-zA-Z]\w*" )
|
||||||
self.future = None
|
self.future = None
|
||||||
|
Loading…
Reference in New Issue
Block a user