Skip to content

Commit 8ed5b77

Browse files
committed
Fix the mapping of vertical-space cursor kinds to produce a newline,
rather than a space. llvm-svn: 116097
1 parent be7da21 commit 8ed5b77

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

clang/lib/Sema/SemaCodeComplete.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC,
15591559
Pattern->AddPlaceholderChunk("inc-expression");
15601560
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
15611561
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
1562+
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
15621563
Pattern->AddPlaceholderChunk("statements");
15631564
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
15641565
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);

clang/test/CodeCompletion/ordinary-name.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void foo() {
2020
// CHECK-CC1-NEXT: COMPLETION: false
2121
// CHECK-CC1-NEXT: COMPLETION: float
2222
// CHECK-CC1-NEXT: COMPLETION: foo : [#void#]foo()
23-
// CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){<#statements#>
23+
// CHECK-CC1-NEXT: COMPLETION: Pattern : for(<#init-statement#>;<#condition#>;<#inc-expression#>){
2424
// CHECK-CC1: COMPLETION: Pattern : goto <#label#>
2525
// CHECK-CC1-NEXT: COMPLETION: Pattern : if(<#condition#>){<#statements#>
2626
// CHECK-CC1: COMPLETION: int

clang/tools/c-index-test/c-index-test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,11 @@ void print_completion_string(CXCompletionString completion_string, FILE *file) {
939939
file);
940940
fprintf(file, "}");
941941
continue;
942+
}
943+
944+
if (Kind == CXCompletionChunk_VerticalSpace) {
945+
fprintf(file, "{VerticalSpace }");
946+
continue;
942947
}
943948

944949
text = clang_getCompletionChunkText(completion_string, I);

clang/tools/libclang/CIndexCodeCompletion.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,8 @@ CXString clang_getCompletionChunkText(CXCompletionString completion_string,
146146
case CodeCompletionString::CK_SemiColon:
147147
case CodeCompletionString::CK_Equal:
148148
case CodeCompletionString::CK_HorizontalSpace:
149-
return createCXString((*CCStr)[chunk_number].Text, false);
150-
151149
case CodeCompletionString::CK_VerticalSpace:
152-
// FIXME: Temporary hack until we figure out how to handle vertical space.
153-
return createCXString(" ");
150+
return createCXString((*CCStr)[chunk_number].Text, false);
154151

155152
case CodeCompletionString::CK_Optional:
156153
// Note: treated as an empty text block.

0 commit comments

Comments
 (0)