Skip to content

Commit cc5fb89

Browse files
committed
[CodeCompletion] Annotated result type
Introduced 'TypeAnnotationBegin' chunk kind for grouping the result type name chunks. rdar://problem/62617558 (cherry picked from commit 7086ffb)
1 parent 29f8108 commit cc5fb89

File tree

14 files changed

+502
-212
lines changed

14 files changed

+502
-212
lines changed

include/swift/IDE/CodeCompletion.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ class CodeCompletionStringChunk {
182182
/// This chunk should not be inserted into the editor buffer.
183183
TypeAnnotation,
184184

185+
/// Structured group version of 'TypeAnnotation'.
186+
/// This grouped chunks should not be inserted into the editor buffer.
187+
TypeAnnotationBegin,
188+
185189
/// A brace statement -- left brace and right brace. The preferred
186190
/// position to put the cursor after the completion result is inserted
187191
/// into the editor buffer is between the braces.
@@ -195,7 +199,8 @@ class CodeCompletionStringChunk {
195199
return Kind == ChunkKind::CallParameterBegin ||
196200
Kind == ChunkKind::GenericParameterBegin ||
197201
Kind == ChunkKind::OptionalBegin ||
198-
Kind == ChunkKind::CallParameterTypeBegin;
202+
Kind == ChunkKind::CallParameterTypeBegin ||
203+
Kind == ChunkKind::TypeAnnotationBegin;
199204
}
200205

201206
static bool chunkHasText(ChunkKind Kind) {

include/swift/IDE/CodeCompletionResultPrinter.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ void printCodeCompletionResultDescription(const CodeCompletionResult &Result,
2727
void printCodeCompletionResultDescriptionAnnotated(
2828
const CodeCompletionResult &Result, llvm::raw_ostream &OS,
2929
bool leadingPunctuation);
30+
31+
void printCodeCompletionResultTypeName(
32+
const CodeCompletionResult &Result, llvm::raw_ostream &OS);
33+
34+
void printCodeCompletionResultTypeNameAnnotated(
35+
const CodeCompletionResult &Result, llvm::raw_ostream &OS);
36+
3037
} // namespace ide
3138
} // namespace swift
3239

0 commit comments

Comments
 (0)