practicalswift
abfecfde17
[gardening] if ([space]…[space]) → if (…), for(…) → for (…), while(…) → while (…), [[space]x, y[space]] → [x, y]
2016-04-04 16:22:11 +02:00
Dmitri Gribenko
336b7198f7
Merge pull request #2016 from danra/code_completion_includes
...
Fix includes order in CodeCompletion.cpp and add missing includes in …
2016-04-04 01:44:32 -07:00
danra
dae3731ab0
Cosmetic namespace comments/spacing fixes (NFC)
...
* Cosmetic namespace comments/spacing fixes (NFC)
* unnamed->anonymous namespace in comments (NFC)
2016-04-02 17:15:44 -07:00
Dan Raviv
af831051a1
Add using statements to improve readability and DRY
2016-04-02 01:01:24 +03:00
Dan Raviv
87a4058fb8
Fix includes order in CodeCompletion.cpp and add missing includes in CodeCompletionResultBuilder.h
2016-04-02 00:26:08 +03:00
Xi Ge
c452f9640f
[CodeCompletion] Add a field NotRecommendedReason to code completion result to indicate why an item is not recommended, NFC. rdar://25415947
...
As implied in rdar://24818863, striking through a module name may be an overkill to suggest the module is redundant to import. We try to
fine-grain not-recommended-reason so that proper UI cue can be adopted in the future.
2016-03-30 16:23:33 -07:00
Ben Langmuir
968b0491b8
[CodeCompletion] Make Void-returning functions "NotRecommended" in typed context
...
When we know we're expecting an expression that returns a value, make
the completion "NotRecommended" to deprioritize it.
rdar://problem/22810741
2016-03-29 14:20:25 -07:00
Xi Ge
23d1b51e6f
[CodeCompletion] Teach override completion to collect the associatedtypes that need to be specified from conforming protocols.
2016-03-29 11:17:00 -07:00
Michael Ilseman
b01caa01c6
Merge remote-tracking branch 'origin/master' into import-as-member
2016-03-25 15:47:47 -07:00
Xi Ge
e7faebeb40
Address @benlangmuir's code review comments.
2016-03-25 14:25:41 -07:00
Xi Ge
c94172869b
Re-apply "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
2016-03-25 14:14:19 -07:00
Dmitri Gribenko
904b7f53c0
Revert "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
...
This reverts commit 218010afb9 . It causes
timeouts in IDE/complete_repl_from_cocoa.swift.
2016-03-25 14:14:19 -07:00
Xi Ge
baff806cf6
[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863
...
Reported: http://stackoverflow.com/questions/36180575/struck-out-module-xcode-7-3
2016-03-25 14:14:19 -07:00
Xi Ge
016bca6f03
Re-apply "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
2016-03-25 11:45:51 -07:00
Dmitri Gribenko
856f3b1cb7
Revert "[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863"
...
This reverts commit 218010afb9 . It causes
timeouts in IDE/complete_repl_from_cocoa.swift.
2016-03-25 11:01:29 -07:00
Xi Ge
218010afb9
[CodeCompletion] Check the module visibility properly to handle the multi-file case. rdar://24818863
...
Reported: http://stackoverflow.com/questions/36180575/struck-out-module-xcode-7-3
2016-03-24 17:44:46 -07:00
Ben Langmuir
b842160f85
[CodeCompletion] Don't complete operator = after Void result
...
print(1) = blah
doesn't make much sense.
2016-03-21 11:39:42 -07:00
Ben Langmuir
8c0d5408b7
[CodeCompletion] Fix call-arg completion when we remove all the overloads we found
...
We have code for pruning unlikely overloads, but when it pruned all
overloads it was treating that as if there was nothing to complete.
Instead, fallback to postfix-expr-begin.
We should also figure out why we're not getting any viable types here,
but we need to handle failure gracefully.
rdar://problem/24356118
2016-03-15 13:19:11 -07:00
Ben Langmuir
92a038cbe2
[CodeCompletion] Strengthen null check to assert NFC
...
This function is only called with a non-null type, which is the only
reasonable way to call it anyway.
2016-03-12 09:01:38 -08:00
Ben Langmuir
812d1566a7
[CodeCompletion] Don't look through non-type contexts in override
...
We don't actually want to skip non-type contexts here, since we should
only be showing override completions in the type context itself. This
was pretty obscure to hit in practice, but I noticed it while fixing the
crasher.
2016-03-12 08:39:11 -08:00
Ben Langmuir
da9c68d373
[CodeCompletion] Don't complete inits after func/var/override keywords
...
When completing nominal members (overrides, etc.), don't show inits if
the user already added a keyword that can't go before an init.
2016-03-11 23:00:11 -08:00
Xi Ge
fd91b119a7
Merge pull request #1600 from apple/unhide-important-underscored-protocols
...
stdlib: unhide important underscored protocols in the generated interface
2016-03-11 17:44:28 -08:00
Ben Langmuir
49b70ebe56
Fix formatting missed in previous commit NFC
...
Argh, forgot to git-add.
2016-03-11 17:16:08 -08:00
Ben Langmuir
47723848bd
[CodeCompletion] Fix crash in override completion in a bogus context
...
Use the right context for getting the formal access. To get the
completions right, we should fix the FIXME about not backtracking the
parser so far.
2016-03-11 17:15:19 -08:00
Xi Ge
f602f5c6e9
[CodeCompletion] Exclude underscored stdlib protocols from code completion items.
2016-03-11 14:08:31 -08:00
Max Moiseev
885b564bf5
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-03-09 17:16:37 -08:00
Ben Langmuir
0bc2cc4290
[CodeCompletion] Negate incorrect comment NFC
2016-03-09 16:20:24 -08:00
Ben Langmuir
4a30637e08
[CodeCompletion] Don't complete unavailable methods in override
...
We generally don't want to override unavailable methods. We already
filter out unavailable decls when completing values, but that's in a
separate visible decl consumer.
rdar://problem/25058233
2016-03-09 16:20:23 -08:00
Max Moiseev
1fae0d1325
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-03-08 12:48:48 -08:00
Ben Langmuir
ce3c2de4a6
[CodeCompletion] Convert optionals when checking for literal protocol conformance
...
Except for nil literals, we don't want to look at the optional itself,
since the typechecker would implicitly look to the underlying type.
rdar://problem/24707210
2016-03-08 09:39:04 -08:00
Ben Langmuir
09754f21cd
[CodeCompletion] Don't add type-relation for SequenceType protocol in loop
...
We don't want to prioritize the type name for protocols, since they
can't be used (generally) to construct an instance of the type. Ideally
we would prioritize types that conform to the protocol.
For rdar://problem/24873625
2016-03-07 22:22:18 -08:00
Chris Lattner
fe9fe47b7e
Implement support for generic typealiases.
2016-03-07 22:20:16 -08:00
Max Moiseev
7fe6916bf6
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-03-07 12:10:47 -08:00
Xi Ge
8bde763ba2
IDETypeChecking: make parameter consistently pass reference. NFC
2016-03-03 18:02:13 -08:00
Max Moiseev
cf4bafe9e3
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-03-03 13:22:03 -08:00
Ben Langmuir
8f9299cc97
[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
2016-03-02 18:21:37 -08:00
Max Moiseev
3a3984877a
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-02-15 15:43:34 -08:00
Xi Ge
9ff84e145d
[CodeCompletion] For submodules, also use ASTContext to collect their visibility.
2016-02-10 13:03:17 -08:00
Xi Ge
d6fd879b01
[CodeCompletion] Query modules' accessibility from ASTContext instead of ClangImporter. NFC
2016-02-10 11:44:56 -08:00
Jordan Rose
66189ffac9
Convert many more classes to use llvm::TrailingObjects.
...
I only intend to do SIL instructions after this; I'm leaving the runtime alone.
2016-02-09 08:57:19 -08:00
Max Moiseev
61c837209b
Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines
2016-02-04 16:13:39 -08:00
Ted Kremenek
7f77733b0c
Merge pull request #1137 from ahoppen/master
...
Fixes SR-642: Code completion does not instantiate generic arguments of a type wrapped in an optional.
2016-02-04 14:27:01 -08:00
Chris Lattner
8dedfb31e3
Add support for #file/#line, etc according to SE-0028. __FILE__ and friends
...
are still accepted without deprecation warning as of this patch.
2016-02-04 14:22:22 -08:00
Xi Ge
77b7180f1a
Rename CodeCompletionTypeChecking.h to IDETypeChecking.h since it's used by more clients now. NFC
2016-02-04 11:09:21 -08:00
Ben Langmuir
a927dc8a5a
[CodeCompletion] Hide literals that don't match the type context in SourceKit
...
If there is a type context, hide literal suggesetions that don't match
it, unless they are keywords and we have filtered to their names.
Incidentally fix an output buffering issue when combining filtering with
the -raw flag in complete-test.
Part of rdar://problem/23865118
2016-02-03 10:51:07 -08:00
Ben Langmuir
9ae6846ac7
[CodeCompletion] Remove more vestiges of 0.0 literal suggestion
...
Obviously dead code.
2016-02-03 08:29:20 -08:00
Ben Langmuir
e75402e49e
[CodeCompletion] Add image literal similar to color
...
Part of rdar://problem/23865118
2016-02-03 07:55:07 -08:00
Ben Langmuir
c33f2faad2
[CodeCompletion] Tweak literal suggestion text
...
For rdar://problem/23865118
2016-02-03 07:33:50 -08:00
Ben Langmuir
838131dd2f
[CodeCompletion] Remove 0.0 suggestion
...
In practice things that are float literal convertible are also integer
literal convertible so this isn't pulling its weight.
Part of rdar://problem/23865118
2016-02-03 07:20:05 -08:00
Doug Gregor
f5cb1151c1
[Code completion] Code complete compound function names within #selector.
...
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.
2016-02-02 16:06:32 -08:00