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


(Douglas Gregor) #1

Hi Ted,

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

  https://github.com/apple/swift/commit/9736d54a771e87cc37be5c040404f6e387f766ec
  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


(Ted Kremenek) #2

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:

  https://github.com/apple/swift/commit/9736d54a771e87cc37be5c040404f6e387f766ec
  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


(Douglas Gregor) #3

Here it is:

  https://github.com/apple/swift/pull/1185

  - 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.


(Ted Kremenek) #4

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:

  https://github.com/apple/swift/pull/1185

  - Doug