diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-01-12 06:38:28 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-01-12 06:38:28 +0000 |
commit | 834389b87451b24618513b907b4dfb5b00d211f3 (patch) | |
tree | bdd4e1848b58ff69857cbee5b0fe548bbc712d78 /lib/Sema/SemaCodeComplete.cpp | |
parent | 72e933e998b97de05623cd6706d10a5f5d28a135 (diff) |
Use horizontal-space markers in code-completion results rather than
embedding single space characters. <rdar://problem/7485503>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93231 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | lib/Sema/SemaCodeComplete.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 582b36901c..d54e4c0e03 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -1677,7 +1677,7 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) { if (Idx > 0) { std::string Keyword; if (Idx > StartParameter) - Keyword = " "; + Result->AddChunk(CodeCompletionString::CK_HorizontalSpace); if (IdentifierInfo *II = Sel.getIdentifierInfoForSlot(Idx)) Keyword += II->getName().str(); Keyword += ":"; @@ -2462,14 +2462,14 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl, // @dynamic Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("dynamic"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); Pattern->AddPlaceholderChunk("property"); Results.MaybeAddResult(Result(Pattern, 0)); // @synthesize Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("synthesize"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); Pattern->AddPlaceholderChunk("property"); Results.MaybeAddResult(Result(Pattern, 0)); } @@ -2493,9 +2493,9 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl, // @class name ; Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("class"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); Pattern->AddPlaceholderChunk("identifier"); - Pattern->AddTextChunk(";"); // add ';' chunk + Pattern->AddChunk(CodeCompletionString::CK_SemiColon); Results.MaybeAddResult(Result(Pattern, 0)); // @interface name @@ -2503,30 +2503,35 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl, // such. Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("interface"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("class"); Results.MaybeAddResult(Result(Pattern, 0)); // @protocol name Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("protocol"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("protocol"); Results.MaybeAddResult(Result(Pattern, 0)); // @implementation name Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("implementation"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("class"); Results.MaybeAddResult(Result(Pattern, 0)); // @compatibility_alias name Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("compatibility_alias"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("alias"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("class"); Results.MaybeAddResult(Result(Pattern, 0)); } @@ -2593,15 +2598,17 @@ void Sema::CodeCompleteObjCAtStatement(Scope *S) { // @throw Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("throw"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddPlaceholderChunk("expression"); - Pattern->AddTextChunk(";"); - Results.MaybeAddResult(Result(Pattern, 0)); // FIXME: add ';' chunk + Pattern->AddChunk(CodeCompletionString::CK_SemiColon); + Results.MaybeAddResult(Result(Pattern, 0)); // @synchronized ( expression ) { statements } Pattern = new CodeCompletionString; Pattern->AddTypedTextChunk("synchronized"); - Pattern->AddTextChunk(" "); + Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace); + Pattern->AddChunk(CodeCompletionString::CK_LeftParen); Pattern->AddPlaceholderChunk("expression"); Pattern->AddChunk(CodeCompletionString::CK_RightParen); |