Commit Graph

16 Commits

Author SHA1 Message Date
Xi Ge
a91cc97058 [SourceKit] Indentation: aligning parameters when argument names are present. rdar://24862107
Fix is in AST by removing unnecessary override.
Originally reported by: https://twitter.com/JohnRHeaton/status/702526804138074112
2016-02-26 12:09:24 -08:00
Xi Ge
c5408c8beb [SourceKit] Indentation: indent the first element in a collection expression according to the position of the left bracket, if they are not in the same line.
We treat this as a mutated version of sibling-based indentation, where an extra level is needed. rdar://24630624
2016-02-18 13:28:44 -08:00
Xi Ge
4e85583718 add test 2016-02-18 13:28:44 -08:00
Xi Ge
ad33048af9 [test] Add a test for indenting class var. 2016-02-10 10:18:58 -08:00
Xi Ge
a2490e2ae1 [SourceKit][CodeFormat] Awake the indent-sibling test after coping with the recent updates on AST representation of parameters. 2016-02-01 14:55:20 -08:00
Xi Ge
e92fb8109f [SourceKit][CodeFormat] When indenting a getter without the leading keyword, first check if the getter is implicit. rdar://24348021 2016-02-01 11:59:27 -08:00
Xi Ge
c0bd16e9cd [test] Add a test for indenting didset 2016-02-01 10:33:14 -08:00
Argyrios Kyrtzidis
7a982d6b8e [sourcekit] When printing requests/responses make sure to escape the strings.
This makes it more clear what the response string contains, plus you can copy the
printed request directly for passing to sourcekitd_request_create_from_yaml.
2016-01-22 13:29:32 -08:00
Xi Ge
562de320d3 [SourceKit][CodeFormat] Indent case label items of a case statement as siblings. rdar://24279926 2016-01-21 14:01:26 -08:00
Xi Ge
d87e0713a6 [Parser] For accessors, never enclose 'static' keywords as their start locations.
This problem is manifested as a SourceKit indentation problem in rdar://24251847.
2016-01-20 16:51:43 -08:00
Xi Ge
a65ffab3e7 [SourceKit][CodeFormat] When indent to siblings, respect tuple elements' names. rdar://24251847 2016-01-20 10:47:52 -08:00
Chris Lattner
7daaa22d93 Completely reimplement/redesign the AST representation of parameters.
Parameters (to methods, initializers, accessors, subscripts, etc) have always been represented
as Pattern's (of a particular sort), stemming from an early design direction that was abandoned.
Being built on top of patterns leads to patterns being overly complicated (e.g. tuple patterns
have to have varargs and default parameters) and make working on parameter lists complicated
and error prone.  This might have been ok in 2015, but there is no way we can live like this in
2016.

Instead of using Patterns, carve out a new ParameterList and Parameter type to represent all the
parameter specific stuff.  This simplifies many things and allows a lot of simplifications.
Unfortunately, I wasn't able to do this very incrementally, so this is a huge patch.  The good
news is that it erases a ton of code, and the technical debt that went with it.  Ignoring test
suite changes, we have:
   77 files changed, 2359 insertions(+), 3221 deletions(-)

This patch also makes a bunch of wierd things dead, but I'll sweep those out in follow-on
patches.

Fixes <rdar://problem/22846558> No code completions in Foo( when Foo has error type
Fixes <rdar://problem/24026538> Slight regression in generated header, which I filed to go with 3a23d75.

Fixes an overloading bug involving default arguments and curried functions (see the diff to
Constraints/diagnostics.swift, which we now correctly accept).

Fixes cases where problems with parameters would get emitted multiple times, e.g. in the
test/Parse/subscripting.swift testcase.

The source range for ParamDecl now includes its type, which permutes some of the IDE / SourceModel tests
(for the better, I think).

Eliminates the bogus "type annotation missing in pattern" error message when a type isn't
specified for a parameter (see test/decl/func/functions.swift).

This now consistently parenthesizes argument lists in function types, which leads to many diffs in the
SILGen tests among others.

This does break the "sibling indentation" test in SourceKit/CodeFormat/indent-sibling.swift, and
I haven't been able to figure it out.  Given that this is experimental functionality anyway,
I'm just XFAILing the test for now.  i'll look at it separately from this mongo diff.
2015-12-31 19:24:46 -08:00
ken0nek
3ac60b13f5 Add spaces before and after closure arrow in test 2015-12-23 04:38:46 +09:00
Xi Ge
4b847abf92 [SourceKit][CodeFormat] Align the comments before a case statement with the statement. rdar://20985149 2015-11-11 11:40:49 -08:00
Xi Ge
6d19519e14 [SourceKit][CodeFormat] Adjust the indentation for getter methods that have no explicit "getter" keyword.
rdar://21598808
2015-11-06 11:34:18 -08:00
Argyrios Kyrtzidis
8ff6a98a99 [sourcekit] Merge SourceKit into the Swift repo.
The code goes into its own sub-tree under 'tools' but tests go under 'test',
so that running 'check-swift' will also run all the SourceKit tests.

SourceKit is disabled on non-darwin platforms.
2015-11-05 01:09:08 -08:00