Implement code completion support for Objective-C #keyPath
expressions, using semantic analysis of the partially-typed keypath
argument to provide an appropriate set of results (i.e., just
properties and types).
This implements all of the necessary parts of SE-0062 / SR-1237 /
rdar://problem/25710611, although at some point I'd like to follow it
up with some warnings to help migrate existing string literals to
Implement basic code completion support for #selector with property
getters/setters. The vast majority of this implementation comes from
Alex Hoppen (@ahoppen), with only a handful of my own tweaks. Alex has
more interesting ideas on improving this that I wasn't quite ready to
commit to, so this is more basic than the overall goal.
When we're code completing a postfix or dot expression inside the
subexpression of an #selector expression, prefer compound function
names. This helps us write, e.g.,
#selector(UIView.
and get completions such as "insertSubview(_:aboveSubview:)". Fixes
rdar://problem/24470075.
Correct format:
```
//===--- Name of file - Description ----------------------------*- Lang -*-===//
```
Notes:
* Comment line should be exactly 80 chars.
* Padding: Pad with dashes after "Description" to reach 80 chars.
* "Name of file", "Description" and "Lang" are all optional.
* In case of missing "Lang": drop the "-*-" markers.
* In case of missing space: drop one, two or three dashes before "Name of file".
Now we can handle simple cases like
1 + 1 == 2 <here>
and correctly suggest both + on the 2 and || on the boolean. When the
LHS doesn't type-check we fallback to using only the operand immediately
to the left.
Swift SVN r32489
When users invoke code completion at an argument position, we suggest argument names,
if required however not specified, or a list of argument values. These values are annotated
with their type relation to the expected argument types, so that
Xcode can prioritize those values that apply over those that do not.
This also fixes: rdar://21727063
Swift SVN r31505
When users complete the right-hand side of an assignment expression, we only
show the results whose types are convertible to those of the left-hand side.
Swift SVN r31357
Before this commit, for unresolved members, code completion suggests all visible enum elements
and option set types. To refine the results, this commit uses constraint solver to infer
the type of unresolved members by analyzing parental expressions. If the solver has solutions,
we complete the unresolved member, otherwise abort.
rdar://16659653
Swift SVN r31195
This commit completes an unresolved member with all visible enum elements.
We need future work to reduce the list to those that are guaranteed to be
resolved under the current context.
Swift SVN r31063
When a user invoke code completion after import keywords, the names of
visible top level clang modules were recommended for finishing the import decl.
(Undoing revert r30961 of r30957, which just required lockstep commit to
SourceKit -- cwillmore)
Swift SVN r30962
This reverts r30957 because it broke the following tests on Jenkins:
SourceKit :: CodeComplete/complete_open.swift
SourceKit :: CodeComplete/complete_test.swift
<rdar://problem/22120345> swift-incremental-RA #8289 failed to build
Swift SVN r30961
When a user invoke code completion after import keywords, the names of
visible top level clang modules were recommended for finishing the import decl.
Swift SVN r30957
It's not okay to filter to only ErrorType results, since we may be
trying to chain to an error type result foo.bar.getError(). And the
existing logic had no way to handle results from other modules, so we
were missing key results like 'NSError'.
Eventually we'll want to bring back something like this that handles all
modules, but as a way to bump the priority of ErrorType results rather
than to filter out everything else.
rdar://problem/20985515
Swift SVN r28716
This came out of today's language review meeting.
The intent is to match #available with the attribute
that describes availability.
This is a divergence from Objective-C.
Swift SVN r28484
When the code completion token appears after throw keyword,
a set of visible decls and instances conforming _ErrorType are
recommended as completion.
Swift SVN r26565
This patch also introduces some SILGen infrastructure for
dividing the function into "ordinary" and "postmatter"
sections, with error-handling-like stuff going into the
final section. Currently, this is largely undermined by
SILBuilder, but I'm going to fix that in a follow-up.
Swift SVN r26422
When a developer auto-completes an override function,
we collect the keywords that have already been specified
by the developer, so that the code completion strings do
not duplicate them.
rdar://16738036
Swift SVN r26230
auto-completing @attributes. By delaying the handling of code completion token after the entire decl being parsed, we know
what are the targets of the attribute to finishe, thus, only suggesting those applicable attributes.
Swift SVN r25938
context-sensitive. The first step is to recommend parameter-applicable
attributes only when the code completion token is found inside a
param decl.
Swift SVN r25810
step to achieve this goal, this change allows the first parameter of
@availability to be completed with either one of the following four
platforms: *, iOS, iOSApplicationExtension, and OSX.
rdar://19541135
Swift SVN r25703
In order for Xcode to use these completions, we complete "?.member" when the
user has typed "anOptional.", but we also say that in order to apply this
result, N bytes to the left of the cursor should be erased first.
rdar://16579657 rdar://15233283
Swift SVN r16409
class A {
init(a: Int) {}
}
A(#^HERE^#
In its current state, this is a hack that I am not proud of. There is
potential here to provide such completions for all function calls:
class A {
func foo(a: Int) {}
func foo(a: Double) {}
}
A().foo(#^HERE^#
but this requires code completion doing its own name lookup, since the type
checker will give us an error type due to ambiguity of overloaded functions.
Type checker also sometimes gives up in cases like these:
struct A {
func foo() {}
}
A().foo
which is understandable, since we disallow partial applications of functions on
values, but returning the correct type here is useful for code completion.
rdar://16597372
Swift SVN r16367