Skip to content

Commit db8c500

Browse files
authored
Merge pull request swiftlang#31637 from rintaro/ide-completion-annotatedtypename-rdar62617558
[CodeCompletion] Annotated result type name
2 parents 2400ca9 + 7e170de commit db8c500

File tree

14 files changed

+521
-232
lines changed

14 files changed

+521
-232
lines changed

include/swift/IDE/CodeCompletion.h

Lines changed: 7 additions & 2 deletions
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) {
@@ -884,7 +889,7 @@ class CodeCompletionContext {
884889
: Cache(Cache) {}
885890

886891
void setAnnotateResult(bool flag) { CurrentResults.annotateResult = flag; }
887-
bool getAnnnoateResult() { return CurrentResults.annotateResult; }
892+
bool getAnnotateResult() { return CurrentResults.annotateResult; }
888893

889894
/// Allocate a string owned by the code completion context.
890895
StringRef copyString(StringRef Str);

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)