[Swift 2.2] Request to merge code completion for #selector

Hi Ted,

The #selector expression has both a discoverability and a usability problem due to fairly poor code completion. These two changes:

  [Code completion] For a Selector argument, provide #selector(<#objc m… · apple/swift@9736d54 · GitHub
  [Code completion] Code complete compound function names within #selec… · apple/swift@f5cb115 · GitHub

introduce much better code completion for #selector. The first commit makes

  #selector(<#@objc method#>)

an expression-specific (i.e., very high priority) completion when code-completing an argument for a parameter of type “ObjectiveC.Selector”, e.g.,

  obj.performSelector(<complete here and get #selector(<#@objc method#>)>

while the second provides compound-name completions for method references within a #selector subexpression, e.g.,

  #selector(NSObject.<complete here>

will give completions like

  performSelector(_:withObject:)

and

  init

and so on.

  - Doug

Hi Doug,

These changes don’t cherry-pick cleanly to swift-2.2-branch.

Please create a pull request for swift-2.2-branch that cherry-picks in these changes and resolves the merge conflicts.

Otherwise, Approved for Swift 2.2.

Ted

···

On Feb 2, 2016, at 4:39 PM, Douglas Gregor <dgregor@apple.com> wrote:

Hi Ted,

The selector expression has both a discoverability and a usability problem due to fairly poor code completion. These two changes:

  [Code completion] For a Selector argument, provide #selector(<#objc m… · apple/swift@9736d54 · GitHub
  https://github.com/apple/swift/commit/f5cb1151c1ba4d8e40705ff31cb17c74c97daa4a

introduce much better code completion for selector. The first commit makes

  selector(<#@objc method#>)

an expression-specific (i.e., very high priority) completion when code-completing an argument for a parameter of type “ObjectiveC.Selector”, e.g.,

  obj.performSelector(<complete here and get selector(<#@objc method#>)>

while the second provides compound-name completions for method references within a selector subexpression, e.g.,

  selector(NSObject.<complete here>

will give completions like

  performSelector(_:withObject:)

and

  init

and so on.

  - Doug

Here it is:

  [Swift 2.2] Code completion improvements for #selector by DougGregor · Pull Request #1185 · apple/swift · GitHub

  - Doug

···

On Feb 2, 2016, at 5:30 PM, Ted Kremenek <kremenek@apple.com> wrote:

Hi Doug,

These changes don’t cherry-pick cleanly to swift-2.2-branch.

Please create a pull request for swift-2.2-branch that cherry-picks in these changes and resolves the merge conflicts.

Otherwise, Approved for Swift 2.2.

Thanks. CI blessed this. Pulled into swift-2.2-branch.

···

On Feb 3, 2016, at 9:20 AM, Douglas Gregor <dgregor@apple.com> wrote:

On Feb 2, 2016, at 5:30 PM, Ted Kremenek <kremenek@apple.com> wrote:

Hi Doug,

These changes don’t cherry-pick cleanly to swift-2.2-branch.

Please create a pull request for swift-2.2-branch that cherry-picks in these changes and resolves the merge conflicts.

Otherwise, Approved for Swift 2.2.

Here it is:

  [Swift 2.2] Code completion improvements for #selector by DougGregor · Pull Request #1185 · apple/swift · GitHub

  - Doug