samdeane/Xcode-Suggestions — Issue #1: Auto-Completion Should Be Aware Of Context After The Insertion Point
Author: samdeane
Created: 2012-03-02 12:20:52+00:00
State: open

When inserting auto-completion items, the editor should be aware of the context **after** the string that it's inserting, as well as before it.

Let's say I have a line like this:

[NSString stringWithContentsOfURL:url encoding:encoding error:&error];

I double-click on the stringWithContentsOfURL bit again and start typing, up comes the auto-completion list, and I choose the stringWithContentsOfURL:usedEncoding:error: variant instead, and hit return. This is what I end up with:

[NSString stringWithContentsOfURL:<#(NSURL *)#> usedEncoding:<#(NSStringEncoding *)#> error:<#(NSError **)#>:url encoding:encoding error:&error];

That is just dumb.

The editor should be capable of working out that I was changing a method call, and that it should rip out the other arguments to the right of the insertion point, and leave me with this:

[NSString stringWithContentsOfURL:<#(NSURL *)#> usedEncoding:<#(NSStringEncoding *)#> error:<#(NSError **)#>];

For extra brownie points, it should spot that some of the new arguments match some of the old ones, and copy the values across, leaving me with this:

[NSString stringWithContentsOfURL:url usedEncoding:<#(NSStringEncoding *)#> error:&error];