Commit Graph

1298 Commits

Author SHA1 Message Date
Michael Ilseman
8759905351 Merge remote-tracking branch 'origin' into import-as-member 2016-03-24 11:37:36 -07:00
Xi Ge
fda0751cae [SourceKit] In interface-gen request, allow clients to send SourceKit an interested USR from which we can infer the group name. 2016-03-23 17:26:44 -07:00
Michael Ilseman
47e73ad4f1 Merge branch 'master' of github.com:apple/swift into import-as-member 2016-03-23 17:01:47 -07:00
Michael Ilseman
7867533f2c Merge commit 'b894798e461077b30a3aa4afe89639f312f44858' into import-as-member 2016-03-23 15:40:04 -07:00
Michael Ilseman
1f8e887c7e Merge commit '38ceced77984188b25af9673ea61b28dc4c90b60' into import-as-member 2016-03-23 14:30:48 -07:00
Michael Ilseman
d7581d1b36 Merge commit 'a31edf53d0580efe47f4e9ef89dccc4429c056e8' into import-as-member 2016-03-23 13:05:57 -07:00
Xi Ge
f338bdfbb7 [SourceKit] Incorporate synthesized extensions into DocInfo request. rdar://24912860
This commit reuses our code for generating synthesized extensions from module printing to enhance
documentation generation.
2016-03-22 14:49:22 -07:00
Xi Ge
33c53a12eb ASTPrinter: Pass the bracket options to pre and post printing callbacks.
Need this for rdar://24912860
2016-03-22 14:49:22 -07:00
practicalswift
ac87f428ea [gardening] Fix formatting of recently introduced headers. 2016-03-22 21:36:09 +01:00
Xi Ge
66fb8062fe ModulePrinting: For decls without doc-comment, we print the doc-comment associated with their conformances, if any.
Inspired by rdar://24409720
2016-03-21 14:35:32 -07:00
Ben Langmuir
65719e8ce0 Merge pull request #1686 from regnerjr/swift-format_SR-146
[SourceKit] Move Code Formatting Logic to libIDE
2016-03-21 13:52:09 -07:00
Ben Langmuir
b0bc53d5bb Reapply "[ReconstructType] Fix decl lookup when there are multiple constructors"
This was mistakenly reverted in an attempt to fix bot failures.  It
turned out to be a different commit that was responsible, so reapply.
Original commit message was:

We were failing to find init() decls whenever there was more than one
candidate.

The mangled function type we get will be (args...) -> T, but the real
thing is (T.Type) -> (args...) -> T. Strip the metatype so we can match
successfully.
2016-03-21 11:39:44 -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
Michael Ilseman
e86d3bde6c Revert "[ReconstructType] Fix decl lookup when there are multiple constructors"
This reverts commit 65c86b713d.

I attempted to resolve the merge conflict, but Jordan will need to do
a second check.
2016-03-20 20:00:37 -07:00
practicalswift
a0d494c143 [gardening] Fix recently introduced typos: "fucntion" → "function", "functio" → "function", "mergable" → "mergeable", "mistmatched" → "mismatched" 2016-03-20 10:34:32 +01:00
Xi Ge
701277e751 Allow SourceEntityWalker to visit operator decls, so that they can get indented properly. rdar://25246628 2016-03-19 14:47:58 -07:00
John Regner
5b9fc3d832 [SourceKit] Add reformat function to libIDE
Move all the rest of the code formatters and helper classes out of the interface.
2016-03-18 21:37:00 -07:00
John Regner
e63678579b [SourceKit] Moved Formatting files into place in libIDE 2016-03-18 21:19:57 -07:00
Ben Langmuir
65c86b713d [ReconstructType] Fix decl lookup when there are multiple constructors
We were failing to find init() decls whenever there was more than one
candidate.

The mangled function type we get will be (args...) -> T, but the real
thing is (T.Type) -> (args...) -> T. Strip the metatype so we can match
successfully.
2016-03-18 14:15:24 -07:00
Xi Ge
a99a3556e7 ModulePrinting: Encapsulate bracket options into a sub-structure of PrintOptions. NFC 2016-03-17 21:34:51 -07:00
Xi Ge
d8a7118966 ModulePrinting: Rename merge group kinds. 2016-03-17 17:54:50 -07:00
Xi Ge
b894798e46 ModulePrinting: For those extensions have no doc-comments, no constraints and no inheritance, we merge their contents to the body of the type declaration. 2016-03-17 16:26:34 -07:00
Xi Ge
3dbd14be00 ModulePrinting: Refactoring SynthesizedExtensionAnalyzer to better expose the merge groups of extensions. NFC 2016-03-17 16:26:34 -07:00
Xi Ge
c3de0db612 ModulePrinting: Merge the content of extensions of the same constraints/inherits, disregarding of whether they are synthesized or actual. 2016-03-16 17:29:37 -07:00
Ben Langmuir
a760b70827 Fixup recent formatting boo boos I've committed
I always think I'll remember to clang-format before pushing, but I don't
always follow through.
2016-03-16 15:58:11 -07:00
Ben Langmuir
47d2c24078 [IDE] Factor code that looks up USRs into getDeclFromUSR 2016-03-16 15:43:02 -07:00
Xi Ge
f0e96f1e70 [SyntaxColoring] Allow empty lines when highlighting doc comment keywords. rdar://25144566 2016-03-15 13:28:34 -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
8030d44826 [SyntaxMap] Fold unary minus into numeric literals
Unlike other prefix operators, unary minus is folded into the
NumberLiteralExpr in the parser. This commit recreates this effect in
the lexer-based syntax map so that token ranges will include the leading
minus.

rdar://problem/20205885
2016-03-15 10:40:52 -07:00
Ben Langmuir
1b08d83b6f [SourceKit] Annotate class method dynamic Self return types
Pass through the original Type in addition to the TypeDecl so that we
can distinguish DynamicSelfType with underlying ClassType from just any
old ClassType.

rdar://problem/25158493
2016-03-14 19:43:54 -07:00
Xi Ge
b74bd730a6 [SyntaxColoring] Not coloring 'keywords' appearing in API argument names as actual keywords; they are legal names. rdar://25129880 2016-03-14 17:39:40 -07:00
Xi Ge
8b7eff2e7f [SyntaxColoring] Sanitize extra closing parenthesis by the end of URLs. 2016-03-14 11:18:48 -07:00
Xi Ge
f64ff89bd4 [SyntaxColoring] Remember to search for URLs inside doc comment lines/blocks. 2016-03-14 11:18:48 -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
Ben Langmuir
d51c0f1aa7 [IDE] StringRefize the ReconstructType APIs NFC
Luckily const char* clients can work unmodified.
2016-03-11 14:24:32 -08:00
Xi Ge
f602f5c6e9 [CodeCompletion] Exclude underscored stdlib protocols from code completion items. 2016-03-11 14:08:31 -08:00
Xi Ge
ae1dd18f1c Revert "ModuelPrinter: Add delineator to mark Decls from a different source file start."
The delineator is not handled properly by IDE.

This reverts commit fb05179ed7.
2016-03-10 18:26:02 -08:00
Xi Ge
c22e9bcf53 ModulePrinting: Merge synthesized extensions' bodies if they have the common constraints. 2016-03-10 17:50:24 -08:00
Ben Langmuir
0df450ddb1 [ReconstructType] Start sketching in lookup to get local declarations
Add cases to handle basic local variable declarations by looking up the
identifier found in the LocalDeclName. There is some duplication with
Identifier nodes that could be cleaned up still.

The actual lookup is currently dumb - it just attempts to do a
function-wide lookup at the end location of the function body. We'll
need a better way to find the local declarations, but for now it lets us
make some incremental progress.
2016-03-10 15:48:34 -08:00
Ben Langmuir
3d9dc0c5f8 [ReconstructType] Factor the giant switch out of VisitNode NFC
Make the control flow clearer by factoring out the switch.  There was a
single key line burried under there where the node is popped.

Incidentally rename the lonely snake_case parameter to this functiong,
since we're modifying every line anyway.
2016-03-10 09:25:14 -08:00
Ben Langmuir
381caaa6d0 [ReconstructType] Remove dead log parameters NFC 2016-03-10 09:23:09 -08:00
Ben Langmuir
5725d22c89 [IDE] Add an entry point to get decls out of 'ReconstructType'
For now, just tack the testing onto the existing walker that checks the
types.  It doesn't seem to work at all for local declarations yet, but
at least we get some top-level stuff.
2016-03-09 21:14:29 -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