[SourceKit/CodeFormat] Re-work and improve the indentation implementation

This restructures the indentation logic around producing a single IndentContext
for the line being indented. An IndentContext has:

a ContextLoc, which points to a source location to indent relative to
a Kind, indicating whether we should indent relative to that location exactly or to the start of the content on its containing line, and
an IndentLevel with the relative number of levels to indent by.

It also improves the handling of:

chained and nested parens, braces, square brackets and angle brackets, and how those interact with the exact alignment of parameters, call arguments, and tuple, array and dictionary elements.
Indenting to the correct level after an incomplete expression, statement or decl.

Resolves:
rdar://problem/59135010
rdar://problem/25519439
rdar://problem/50137394
rdar://problem/48410444
rdar://problem/48643521
rdar://problem/42171947
rdar://problem/40130724
rdar://problem/41405163
rdar://problem/39367027
rdar://problem/36332430
rdar://problem/34464828
rdar://problem/33113738
rdar://problem/32314354
rdar://problem/30106520
rdar://problem/29773848
rdar://problem/27301544
rdar://problem/27776466
rdar://problem/27230819
rdar://problem/25490868
rdar://problem/23482354
rdar://problem/20193017
rdar://problem/47117735
rdar://problem/55950781
rdar://problem/55939440
rdar://problem/53247352
rdar://problem/54326612
rdar://problem/53131527
rdar://problem/48399673
rdar://problem/51361639
rdar://problem/58285950
rdar://problem/58286076
rdar://problem/53828204
rdar://problem/58286182
rdar://problem/58504167
rdar://problem/58286327
rdar://problem/53828026
rdar://problem/57623821
rdar://problem/56965360
rdar://problem/54470937
rdar://problem/55580761
rdar://problem/46928002
rdar://problem/35807378
rdar://problem/39397252
rdar://problem/26692035
rdar://problem/33760223
rdar://problem/48934744
rdar://problem/43315903
rdar://problem/24630624

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - ce60ac6b8268a953933e27886b6eeef5d2fdb342

Wow, that’s a lot of radars!

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - ce60ac6b8268a953933e27886b6eeef5d2fdb342

Build failed
Swift Test OS X Platform
Git Sha - ce60ac6b8268a953933e27886b6eeef5d2fdb342

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - e15d8ea59836a166d74d497a783408da86965d7b

Build failed
Swift Test OS X Platform
Git Sha - e15d8ea59836a166d74d497a783408da86965d7b

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - 923ae09ee80f917937d60cbbe257571c11030bda

Build failed
Swift Test OS X Platform
Git Sha - 923ae09ee80f917937d60cbbe257571c11030bda

@swift-ci Please test

Build failed
Swift Test Linux Platform
Git Sha - 9fce6ac6953586f4e93e8a24d5c48cbb18c9e9b9

Build failed
Swift Test OS X Platform
Git Sha - 9fce6ac6953586f4e93e8a24d5c48cbb18c9e9b9

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - 9fce6ac6953586f4e93e8a24d5c48cbb18c9e9b9

Build failed
Swift Test OS X Platform
Git Sha - 9fce6ac6953586f4e93e8a24d5c48cbb18c9e9b9

Failures seem unrelated.
@swift-ci please smoke test

@swift-ci please smoke test OS X Platform

@swift-ci please smoke test

It looks like the swiftpm test failure is related and due to the parser changes. The test parses the code below and checks the reported diagnostic for expected ')' in expression list
import PackageDescription

let package = Package(
    name: "Trivial",
    targets: [
        .target(
            name: "foo",
            dependencies: []),
)

Prior to my parser changes it produced:
/tmp/t.swift:9:1: error: expected expression in container literal
)
^
/tmp/t.swift:9:2: error: expected ')' in expression list
)
 ^
/tmp/t.swift:2:22: note: to match this opening '('
let package = Package(
                     ^

And after:
/tmp/t.swift:9:1: error: expected expression in container literal
)
^

I think this is because when parsing the tuple arg of Package, parseExprList() calls parseExpr() which calls parseExprImpl() which gets an error status back when it tries to parse the collection. Prior to my changesparseExprImpl() was dropping that error status here, which meant we didn't take the true branch here in parseExprList() and still reported the missing right token diagnostics as well. With the error status propagating properly, the true branch is taken and they're suppressed.
Based on that it seems like the new behavior is desirable. @rintaro, do you agree? Should I just update the swiftpm test?

I agree. Let's update the spm test.

@swift-ci please test

Build failed
Swift Test Linux Platform
Git Sha - a1b5027a16672c2994a2e00cef5cac86c6fe74f2

Build failed
Swift Test OS X Platform
Git Sha - a1b5027a16672c2994a2e00cef5cac86c6fe74f2

This was a huge PR, so thanks a lot for going through it all @benlangmuir.
@rintaro are you ok with the current state of the parser changes?
I'll do another run of the stress tester over the full compat suite (with just the format request enabled) to make sure the last two changes didn't break anything, and do a normal source compat run too just in case the parser changes somehow affect something before I merge.

@swift-ci Please Test Source Compatibility


Dependent VM data removed from $AllVMData

In file TestFramework.psm1, in function Check-IP we're removing data of dependency VMs from $AllVMData.
        if ($VM.RoleName -match "dependency") {
            Set-Variable -Name DependencyVmName -Value $VM.RoleName -Scope Global
            continue
        }

Does this mean a test case should probe and find data of second, third or nth VM by probing separately?

This is for the case you want a "dummy" VM which you don't want/need to test. There are cases (e.g. NET_TESTS) where we need a dependency just to receive files or pings. If you look into the framework you'll see that "VM2Name" can be parsed as a parameter in the test. With the VM name and the hostname you can find the IP and with that you can manage your VM.

If you don't want this and you want the VM info in AllVMData, just use a setuptype that has a secondary VM named other than "dependency"

If you want a dependency VM use the available functions in CommonFunctions to start that VM, get an IP, send files/commands, etc.

If you have any questions, please let me know. If not, you can close the issue.


Pinch to zoom on Mobile

Hi guys,
Fantastic library, but I was I've having trouble utilising pinch to zoom on mobile chrome.
Has anyone managed to get this working?
Cheers!

Please update info for this issue


how to import both event and raw EDA signals

Hello,
Thank for making this great tool.
I use ledlab mathlab for eda analysis,  and i am able to upload the raw eda signals and event files to perform event related analysis (feature extraction).
However, i have been trying to see how that could be possible with the python verssion but still dont get.
can you be kind to point me in the right direction on how to import both event and raw signal data using this python tool.
Looking forward to your reply
Best Regards
ben

Hello, thanks for your question
there is no support for event-based analysis import from Ledalab, event-related processing would need to be done manually in python.
For example, one way to do it would be to calculate total phasic "activity" within a time window using a summation. For example, if you know event 1 happened between seconds 2 and 3 and your sampling rate is 1000 Hz, you could use
numpy.sum(phasicData[2000:3000])
This would give you a single number for event 1, which you can then compare against other events. You could use the same principle to calculate other features for that event (e.g. number of peaks, height of maximum peak, etc)


Oauth Could not find inappbrowser

As reported [here] 1 the  inappbrowser plugin was renamed so I'm getting an error Could not found InAppBrowser plugin when I'm trying use Oauth even if the inAppBrowser plugin is installed.

I had to change the validation in the plugin source:
'''javascript
if (cordovaMetadata.hasOwnProperty("cordova-plugin-inappbrowser") === true  ||  cordovaMetadata.hasOwnProperty("org.apache.cordova.inappbrowser") === true)
{
....
}
'''
I left like this to keep compatibility with older projects.

+1

+1
Is there any around this 'Could not find InAppBrowser' issue?
What files did you have to change to get this too work?

@ChrisBratherton go to ngCordova.js

I encourage everyone to use the primary version of my oauth plugin:
https://github.com/nraboy/ng-cordova-oauth
These issues have been corrected in it.  I am slower to update the Ionic version of the library.

if i ll use ngcordova with ng-cordova-oauth, isn't there any conflict both factory name are "$cordovaOauth".

Yea there will be.  Any recommendations on naming conventions?  I officially support ng-cordova-oauth.  The version in ng-cordova is just a port when I have the time.

This fix was merged into the latest master.  @pbernasconi can close this ticket.

Why is it that bower install ngCordova installs an ng-cordova.js that doesn't include this fix?
bower ngCordova#~0.1.17-alpha       not-cached git://github.com/driftyco/ng-cordova.git#~0.1.17-alpha

I have no control as to how the Ionic team updates the ngCordova version.  Bower will grab the latest version and if the version was not created after the merge, it will not be included.
A sure way around this until Ionic updates the versions is to just download the master manually.
Regards,

I managed to install the master with
bower install ngCordova#c3634c64090fa11c3e6bab3fcdc29712d3ecb965 --save

(You can also do bower install ngCordova#master but I'd rather know which specific version I'm using.)
Shame that fixes don't get released more often.

I got the same issue but it is to do with new cordova-cli release(5.4.0). When the plugin is added cordova did not update the metadata information on cordova_plugin.js file. I then installed cordova-cli 5.3.3, it all worked all again.

I got the same error and when checking www/lib/ngCordova/dist/ng-cordova.js, this function is called, but still it returns false.
isInAppBrowserInstalled: function(cordovaMetadata) {
            var inAppBrowserNames = ["cordova-plugin-inappbrowser", "org.apache.cordova.inappbrowser"];
            alert(JSON.stringify(cordovaMetadata));
            return inAppBrowserNames.some(function(name) {
                return cordovaMetadata.hasOwnProperty(name);
            });
        }

But in this case, the cordovaMetadata being passed is an empty object.
This variable refers to this:
var cordovaMetadata = cordova.require("cordova/plugin_list").metadata;

I am also affected by this issue. When I monkey patch the function isInAppBrowserInstalled to always return true, everything works. So I think my setup is correct, but there is a problem somewhere in cordova.
$ cordova --version
5.4.0

$ cordova plugin list
com.ionic.keyboard 1.0.4 "Keyboard"
cordova-plugin-ble-central 1.0.2 "BLE"
cordova-plugin-console 1.0.1 "Console"
cordova-plugin-device 1.0.1 "Device"
cordova-plugin-inappbrowser 1.0.1 "InAppBrowser"
cordova-plugin-splashscreen 2.1.0 "Splashscreen"
cordova-plugin-whitelist 1.2.0 "Whitelist"

A fix is being worked on.  The latest release of Apache Cordova broke things.

I have the same problem, Any Idea?

Are you using ng-cordova-oauth or ng-cordova?  ng-cordova always falls behind, so I recommend you use my repository instead.
Regards,

Can I use ng-cordova-oauth for  auth and ng-cordova for other propuse ?  I mean, Can I import both on the index.html, and there will not be in conflict?

My guess is it will likely lead to conflict.
I stopped supporting the ng-cordova version because the Ionic team told me they were going to remove it from the library soon.  No idea the status on that.  I only support the ng-cordova-oauth version.
Regards,

I need a solution using only ng-cordova, is there a way to solve it?


(3.0.50) methods don't get displayed when switching from instance to class in project browser

Note that support category is selected on the instance side:

Now click on Class button and note that there are no methods visible clicking below the categories in the category pan does not cause the list of methods to appear (I use this regularly to view all methods):

Clicking on a category and then clicking below finally shows the methods I would have expected to see initially:

The given reproduction case, the methods are visible after clicking on class, in 3.0.74