Skip to content

[CodeCompletion] Suffix ": " instead of "=" when completing attribute… #4325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/swift/IDE/CodeCompletion.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class CodeCompletionStringChunk {
/// editor buffer if the preceding CallParameterName was inserted.
CallParameterColon,

/// A equal sign between parameter name and value. Used in decl attribute.
DeclAttrParamEqual,
/// A colon between parameter name and value. Used in decl attribute.
DeclAttrParamColon,

/// Required parameter type.
CallParameterType,
Expand Down Expand Up @@ -197,7 +197,7 @@ class CodeCompletionStringChunk {
Kind == ChunkKind::CallParameterName ||
Kind == ChunkKind::CallParameterInternalName ||
Kind == ChunkKind::CallParameterColon ||
Kind == ChunkKind::DeclAttrParamEqual ||
Kind == ChunkKind::DeclAttrParamColon ||
Kind == ChunkKind::DeclAttrParamKeyword ||
Kind == ChunkKind::CallParameterType ||
Kind == ChunkKind::CallParameterClosureType ||
Expand Down
6 changes: 3 additions & 3 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ void CodeCompletionString::print(raw_ostream &OS) const {
case ChunkKind::CallParameterName:
case ChunkKind::CallParameterInternalName:
case ChunkKind::CallParameterColon:
case ChunkKind::DeclAttrParamEqual:
case ChunkKind::DeclAttrParamColon:
case ChunkKind::CallParameterType:
case ChunkKind::CallParameterClosureType:
case ChunkKind::GenericParameterName:
Expand Down Expand Up @@ -1148,7 +1148,7 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
case ChunkKind::RethrowsKeyword:
case ChunkKind::DeclIntroducer:
case ChunkKind::CallParameterColon:
case ChunkKind::DeclAttrParamEqual:
case ChunkKind::DeclAttrParamColon:
case ChunkKind::CallParameterType:
case ChunkKind::CallParameterClosureType:
case ChunkKind::OptionalBegin:
Expand Down Expand Up @@ -1185,7 +1185,7 @@ void CodeCompletionString::getName(raw_ostream &OS) const {
switch (C.getKind()) {
case ChunkKind::TypeAnnotation:
case ChunkKind::CallParameterClosureType:
case ChunkKind::DeclAttrParamEqual:
case ChunkKind::DeclAttrParamColon:
continue;
case ChunkKind::ThrowsKeyword:
case ChunkKind::RethrowsKeyword:
Expand Down
2 changes: 1 addition & 1 deletion lib/IDE/CodeCompletionResultBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class CodeCompletionResultBuilder {
DeclAttrParamKeyword, Name);
if (NeedSpecify)
addChunkWithText(CodeCompletionString::Chunk::ChunkKind::
DeclAttrParamEqual, "=");
DeclAttrParamColon, ": ");
if (!Annotation.empty())
addTypeAnnotation(Annotation);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/IDE/REPLCodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static std::string toInsertableString(CodeCompletionResult *Result) {
case CodeCompletionString::Chunk::ChunkKind::CallParameterInternalName:
case CodeCompletionString::Chunk::ChunkKind::CallParameterColon:
case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamKeyword:
case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamEqual:
case CodeCompletionString::Chunk::ChunkKind::DeclAttrParamColon:
case CodeCompletionString::Chunk::ChunkKind::CallParameterType:
case CodeCompletionString::Chunk::ChunkKind::CallParameterClosureType:
case CodeCompletionString::Chunk::ChunkKind::OptionalBegin:
Expand Down
8 changes: 4 additions & 4 deletions test/IDE/complete_decl_attribute.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

// AVAILABILITY2: Begin completions, 5 items
// AVAILABILITY2-NEXT: Keyword/None: unavailable; name=unavailable{{$}}
// AVAILABILITY2-NEXT: Keyword/None: message=[#Specify message#]; name=message{{$}}
// AVAILABILITY2-NEXT: Keyword/None: renamed=[#Specify replacing name#]; name=renamed{{$}}
// AVAILABILITY2-NEXT: Keyword/None: introduced=[#Specify version number#]; name=introduced{{$}}
// AVAILABILITY2-NEXT: Keyword/None: deprecated=[#Specify version number#]; name=deprecated{{$}}
// AVAILABILITY2-NEXT: Keyword/None: message: [#Specify message#]; name=message{{$}}
// AVAILABILITY2-NEXT: Keyword/None: renamed: [#Specify replacing name#]; name=renamed{{$}}
// AVAILABILITY2-NEXT: Keyword/None: introduced: [#Specify version number#]; name=introduced{{$}}
// AVAILABILITY2-NEXT: Keyword/None: deprecated: [#Specify version number#]; name=deprecated{{$}}
// AVAILABILITY2-NEXT: End completions


Expand Down
2 changes: 1 addition & 1 deletion tools/SourceKit/lib/SwiftLang/CodeCompletionOrganizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ void CompletionBuilder::getFilterName(CodeCompletionString *str,
case ChunkKind::CallParameterInternalName:
case ChunkKind::CallParameterClosureType:
case ChunkKind::CallParameterType:
case ChunkKind::DeclAttrParamEqual:
case ChunkKind::DeclAttrParamColon:
case ChunkKind::Comma:
case ChunkKind::Whitespace:
case ChunkKind::Ellipsis:
Expand Down