mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CodeCompletion] Add assignment to experimental operator completion
When the LHS is an lvalue/assignable tuple and there is no leading sequence of binary expressions. It's a bit hacky right now since we don't have a good way to differentiate general pattern completions from builtin operators. rdar://problem/23209683
This commit is contained in:
@@ -1026,9 +1026,14 @@ void CompletionBuilder::getFilterName(CodeCompletionString *str,
|
||||
if (FirstTextChunk.hasValue()) {
|
||||
for (auto C : str->getChunks().slice(*FirstTextChunk)) {
|
||||
|
||||
if (C.getKind() == ChunkKind::BraceStmtWithCursor)
|
||||
if (C.is(ChunkKind::BraceStmtWithCursor))
|
||||
break;
|
||||
|
||||
if (C.is(ChunkKind::Equal)) {
|
||||
OS << C.getText();
|
||||
break;
|
||||
}
|
||||
|
||||
bool shouldPrint = !C.isAnnotation();
|
||||
switch (C.getKind()) {
|
||||
case ChunkKind::TypeAnnotation:
|
||||
@@ -1064,8 +1069,13 @@ void CompletionBuilder::getDescription(SwiftResult *result, raw_ostream &OS,
|
||||
if (FirstTextChunk.hasValue()) {
|
||||
for (auto C : str->getChunks().slice(*FirstTextChunk)) {
|
||||
using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
|
||||
if (C.getKind() == ChunkKind::BraceStmtWithCursor)
|
||||
if (C.is(ChunkKind::BraceStmtWithCursor))
|
||||
break;
|
||||
|
||||
// FIXME: we need a more uniform way to handle operator completions.
|
||||
if (C.is(ChunkKind::Equal))
|
||||
isOperator = true;
|
||||
|
||||
if (C.getKind() == ChunkKind::TypeAnnotation ||
|
||||
C.getKind() == ChunkKind::CallParameterClosureType ||
|
||||
C.getKind() == ChunkKind::Whitespace)
|
||||
|
||||
Reference in New Issue
Block a user