Commit Graph

1365 Commits

Author SHA1 Message Date
Xi Ge
8d67a4ad12 [CodeComplete] Propagate type relation descriptor to the first argument, or the only argument, of call exprs.
rdar://22688827

Swift SVN r31928
2015-09-14 19:43:36 +00:00
Ben Langmuir
4acbf712e7 [CodeCompletion] Expose the code completion kind NFC
This exposes the code completion kind so that SourceKit has more
information about the code completion context.

For rdar://problem/22460026

Swift SVN r31925
2015-09-14 16:19:14 +00:00
Xi Ge
d4922f3bd4 Update to more meaningful param name.
Swift SVN r31910
2015-09-12 00:54:05 +00:00
Xi Ge
1cb84686d4 [CodeComplete] Preserve call expr when code completion token appears in the first arg.
Swift SVN r31909
2015-09-12 00:28:28 +00:00
Xi Ge
ec4e469062 [CodeComplete] Introduce code completion expr to better preserve the context of the code completion token in ASTs.
Swift SVN r31908
2015-09-11 22:59:12 +00:00
Xi Ge
6dd6fff440 [CodeComplete] Rename ExpectedTypeRelation:Undetermined to ExpectedTypeRelation::Unrelated.
Swift SVN r31844
2015-09-10 01:50:04 +00:00
Xi Ge
65ce0a36b8 [CodeComplete] Add type relation descriptor to member access syntax. rdar://22629291
By analyzing the context of a member access expression, we can prioritize the member
completion results by the expected type. As the initial step, we support call arguments
as context.

Swift SVN r31837
2015-09-10 00:28:14 +00:00
Michael Gottesman
0606d5843a Remove calls to raw_svector_ostream::flush()
This function is deleted since LLVM r244928.

Swift SVN r31798
2015-09-09 04:37:13 +00:00
Xi Ge
f820972697 [CodeComplete] Avoid resetting code completion kind except for expected cases. rdar://22619751
Swift SVN r31789
2015-09-08 23:43:55 +00:00
Xi Ge
92ea1fa085 [CodeComplete] Update enclosed archetypes to the protocols they conform to.
Swift SVN r31723
2015-09-05 23:57:37 +00:00
Xi Ge
ece9cd1cc4 [CodeComplete] Pre-compute generic type params when transforming archetypes in code completion results.
Swift SVN r31704
2015-09-05 01:34:15 +00:00
Xi Ge
b42a30df27 [CodeComplete] For an archetype that is not Self derived, use the conformed protocol type (if any) instead of the archetype itself.
Swift SVN r31681
2015-09-03 23:58:29 +00:00
Xi Ge
2fe26c966c [CodeComplete] Get singly desugared type and update tests.
Swift SVN r31674
2015-09-03 22:49:02 +00:00
Xi Ge
213c6a5c7b [CodeComplete] Teach archetype transformer to handle type alias.
Swift SVN r31670
2015-09-03 20:46:23 +00:00
Xi Ge
07a848cf64 [CodeComplete] Address Argyrios' review comments.
Swift SVN r31653
2015-09-03 02:36:11 +00:00
Ben Langmuir
0a43e5460f [CodeComplete] Don't try to lookup members of null type
rdar://problem/22012123

Swift SVN r31639
2015-09-02 21:16:48 +00:00
Xi Ge
08eda102ed [CodeComplete] Finish transforming archetypes to actual types in code completion results and update tests.
Swift SVN r31635
2015-09-02 20:18:16 +00:00
Xi Ge
f75ac75d3b [CodeComplete] Try to substitute archetypes with actual types in code completion results.
When completing type members, teach the code completion engine to
transform the archetypes appearing in code completion results to the
actual types. NFC

Swift SVN r31628
2015-09-02 06:22:20 +00:00
Xi Ge
afb46aa8e0 [CodeComplete] When completing call args, not consider those overloads that are unlikely to be selected.
rdar://22528276

Swift SVN r31613
2015-09-01 22:54:19 +00:00
Xi Ge
ef3b45871b [CodeComplete] Complete arguments of call expressions.
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
2015-08-26 22:01:25 +00:00
Doug Gregor
cab320296d Stop recording protocol lists in nominal types.
The conformance lookup table is responsible for answering queries
about the protocols to which a particular nominal type conforms, so
stop storing (redundant and incorrect) protocol lists on the ASTs for
nominal types. Protocol types still store the list of protocols that
they inherit, however.

As a drive-by, stop lying about the number of bits that ProtocolDecl
uses on top of NominalTypeDecl, and move the overflow bits down into
ProtocolDecl itself so we don't bloat Decl unnecessarily.

Swift SVN r31381
2015-08-21 17:51:23 +00:00
Xi Ge
3865a6a037 [CodeComplete] Add type relation enum to the code completion results.
We use an enum to describe the relationship between a code completion result
and the expected type at the code completion site. We can use this relationship
to prioritize candidates on the SourceKit side.

Swift SVN r31371
2015-08-20 22:57:53 +00:00
Xi Ge
c33e3efe59 [CodeComplete] Complete the right hand side of assignment expressions.
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
2015-08-20 01:35:30 +00:00
Xi Ge
831470c88c [CodeComplete] Properly handle extensions during name lookup. rdar://22289974
Swift SVN r31280
2015-08-17 23:08:29 +00:00
Xi Ge
40a9d61103 [CodeComplete] when completing unresolved members, we also perform name lookups for enum elements, var decls and nominal types in addition to functions.
fixes: rdar://22282057, rdar://22282116, rdar://22282224, and rdar://22282278

Swift SVN r31274
2015-08-17 21:01:54 +00:00
Xi Ge
5f8c122a79 [CodeComplete] Perform function name lookup to complete unresolved members.
For completing unresolved members, if constraint solver does not have solutions, we
look up the function names appearing in the same line of the code completion tokens,
and use their parameters that are of enum/optionset type to deliver the code
completion results.

Swift SVN r31256
2015-08-15 20:34:38 +00:00
Xi Ge
5a16d37dbf [CodeComplete] Address Ben's comments on r31063, r31083 and r31195.
Swift SVN r31254
2015-08-14 23:48:56 +00:00
Xi Ge
a450a08723 [CodeCompletion] Collect the identifiers appearing before unresolved members.
We can use these identifiers to perform manual look up.

Swift SVN r31250
2015-08-14 21:16:41 +00:00
Xi Ge
e55cdc1fb6 [CodeComplete] Avoid unnecessary walk path.
Swift SVN r31208
2015-08-13 05:36:37 +00:00
Xi Ge
0bab23961a [CodeComplete] Refine the code completion results for unresolved members by using constraint solver.
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
2015-08-13 00:19:58 +00:00
Xi Ge
71953ddc7a [CodeComplete] Add a new decl kind for module and update the code completion results of import decl to belong to this kind.
This allows Xcode to add special icons for completing module names.

Swift SVN r31109
2015-08-10 18:20:57 +00:00
Ben Langmuir
65cb6bc1bd [CodeCompletion] Don't show editor placeholders as completions
rdar://problem/21797815

Swift SVN r31089
2015-08-07 23:03:37 +00:00
Xi Ge
c260dc810c [CodeCompletion] Add visible option set type to the code completion results of unresolved members.
Swift SVN r31083
2015-08-07 20:28:09 +00:00
Xi Ge
0df10311a0 [CodeCompletion] Add the initial support for unresolved members.
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
2015-08-06 23:15:14 +00:00
Xi Ge
21e8a93761 [CodeCompletion] Add specific semantic context kind to 'super', 'self' and 'nil'.
This change gives these keywords a boost of priority when SourceKit sorts code completion
results.
rdar://21796980

Swift SVN r31037
2015-08-06 01:03:16 +00:00
Jordan Rose
0dbf9b2780 Add 'try?' (and 'try!') as statement-level completions.
Also, if 'else' is a statement-keyword, so is 'catch'.

More rdar://problem/21692467

Swift SVN r31033
2015-08-05 22:17:39 +00:00
Ben Langmuir
c011b9f54c Add method to get first chunk in code completion string with punctuation
The client may or may not want to include the leading punctuation in a
result e.g. in "?.foo()".

Swift SVN r31013
2015-08-04 22:13:25 +00:00
Xi Ge
87018e516f [CodeCompletion] No crashing when function name is empty. rdar://21149908
Swift SVN r31011
2015-08-04 22:09:58 +00:00
Xi Ge
d7e07b1d4d [CodeCompletion] When code completing import decls, we only show the module names that are not yet imported in previous import decls.
Swift SVN r30964
2015-08-03 22:54:58 +00:00
Chris Willmore
7f12c9ffd5 [CodeCompletion] Add the initial support for code completing import declaration.
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
2015-08-03 21:08:32 +00:00
Chris Willmore
e4d1ac9c24 Revert "[CodeCompletion] Add the initial support for code completing import declaration."
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
2015-08-03 21:04:46 +00:00
Xi Ge
5e0014bcc4 [CodeCompletion] Add the initial support for code completing import declaration.
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
2015-08-03 20:02:17 +00:00
Xi Ge
7b6b26a46d [CodeCompletion] Only filter out non-required inits for class type.
Swift SVN r30893
2015-08-01 00:05:03 +00:00
Xi Ge
29fcee3f0b [CodeCompletion] Show only required init() as members of dynamic metatype.
rdar://22074073

Swift SVN r30888
2015-07-31 22:49:55 +00:00
Xi Ge
c5ebe153d1 [CleanUp] Use DC as the abbreviation of DeclContext.
Swift SVN r30804
2015-07-30 17:16:28 +00:00
Xi Ge
5a1946eb53 [CodeCompletion] Add init() to the code completion results after metatype + dot.
rdar://21474100

Swift SVN r30781
2015-07-30 00:10:43 +00:00
Xi Ge
903bf976b2 Chop overly long lines.
Swift SVN r30780
2015-07-30 00:10:39 +00:00
Xi Ge
0743f07150 [CodeCompletion] Address Argyrios' and Ben's comments.
Swift SVN r30772
2015-07-29 18:01:40 +00:00
Xi Ge
32667fdbf9 [CodeCompletion] Add "super" keyword to code completion results when "super" is meaningful in the current decl context.
rdar://20401979

Swift SVN r30749
2015-07-29 01:37:23 +00:00
Xi Ge
3e9357a9bb [CodeCompletion] When completing init calls, stick to the type alias name given by the user instead of (smartly) showing the underlying type name. rdar://18586415
Swift SVN r30723
2015-07-28 20:45:12 +00:00