Skip to content

Implement SE-0039 (Modernizing Playground Literals) #2215

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 14 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Do not include bracket in code completion results.
  • Loading branch information
tkremenek committed Apr 23, 2016
commit 48af5823122ab4e8d396451112b832fe4edfa880
4 changes: 0 additions & 4 deletions lib/IDE/CodeCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3212,7 +3212,6 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {

auto floatType = context.getFloatDecl()->getDeclaredType();
addFromProto(LK::ColorLiteral, "", [&](Builder &builder) {
builder.addLeftBracket();
builder.addTextChunk("#colorLiteral");
builder.addLeftParen();
builder.addCallParameter(context.getIdentifier("red"),
Expand All @@ -3227,18 +3226,15 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
builder.addCallParameter(context.getIdentifier("alpha"), floatType,
false, true);
builder.addRightParen();
builder.addRightBracket();
});

auto stringType = context.getStringDecl()->getDeclaredType();
addFromProto(LK::ImageLiteral, "", [&](Builder &builder) {
builder.addLeftBracket();
builder.addTextChunk("#imageLiteral");
builder.addLeftParen();
builder.addCallParameter(context.getIdentifier("resourceName"),
stringType, false, true);
builder.addRightParen();
builder.addRightBracket();
});

// Add tuple completion (item, item).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %sourcekitd-test -req=syntax-map %s > %t.response
// RUN: diff -u %s.response %t.response

let x = [#Cloud(tube: true)#]
let x = #Cloud(tube: true)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
key.offset: 0,
key.length: 129,
key.length: 126,
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
key.syntaxmap: [
{
Expand All @@ -24,9 +24,52 @@
key.length: 1
},
{
key.kind: source.lang.swift.syntaxtype.objectliteral,
key.offset: 107,
key.length: 21
key.kind: source.lang.swift.syntaxtype.identifier,
key.offset: 108,
key.length: 5
},
{
key.kind: source.lang.swift.syntaxtype.identifier,
key.offset: 114,
key.length: 4
},
{
key.kind: source.lang.swift.syntaxtype.keyword,
key.offset: 120,
key.length: 4
}
],
key.diagnostics: [
{
key.line: 4,
key.column: 8,
key.filepath: "/Volumes/Data/Users/kremenek/Desktop/sources/swift-tkremenek/test/SourceKit/SyntaxMapData/syntaxmap-object-literals.swift",
key.severity: source.diagnostic.severity.error,
key.description: "consecutive statements on a line must be separated by ';'",
key.diagnostic_stage: source.diagnostic.stage.swift.parse,
key.fixits: [
{
key.offset: 106,
key.length: 0,
key.sourcetext: ";"
}
]
},
{
key.line: 4,
key.column: 9,
key.filepath: "/Volumes/Data/Users/kremenek/Desktop/sources/swift-tkremenek/test/SourceKit/SyntaxMapData/syntaxmap-object-literals.swift",
key.severity: source.diagnostic.severity.error,
key.description: "expected initial value after '='",
key.diagnostic_stage: source.diagnostic.stage.swift.parse
},
{
key.line: 4,
key.column: 9,
key.filepath: "/Volumes/Data/Users/kremenek/Desktop/sources/swift-tkremenek/test/SourceKit/SyntaxMapData/syntaxmap-object-literals.swift",
key.severity: source.diagnostic.severity.error,
key.description: "expected expression",
key.diagnostic_stage: source.diagnostic.stage.swift.parse
}
]
}