Xcode autocompletes image assets at inappropriate times

Originator:jfriend
Number:rdar://34925482 Date Originated:10-Oct-2017 10:14 PM
Status:Open Resolved:
Product:Developer Tools Product Version:9.0
Classification:UI/Usability Reproducible:Always
 
Summary:
When an Xcode project contains image assets whose names begin with "in", Xcode likes to begin offering image literals as completion suggestions when typing the "in" keyword that is required in swift after the parameter names of a closure. The most annoying part about this is that you usually type <enter> after `in` to begin the body of the closure, which adds the image literal from the autocomplete suggestions instead, which is a syntax error.

Steps to Reproduce:
1. In the attached project, open `ViewController.swift`
2. Erase the `in` keyword from the closure passed to `somethingWithCompletion`
3. Begin typing `in` again
4. Xcode will offer "intro_group" from xcassets as an autocomplete result

Expected Results:
At step 3, Xcode should offer no autocomplete suggestions, or only offer a suggestion to complete the keyword in a way that is syntactically valid

Actual Results:
Xcode tries to insert an image literal, causing a syntax error

Version:
9.0

Notes:
My current workaround is to build muscle memory to type a space after the `in` keyword, which dismisses the suggestions, before hitting enter to begin the closure body. Thankfully, Xcode also has an option to trim trailing whitespace on save so that the extra space I entered gets removed.

Comments

Response from Apple

Closed as dupe of rdar://26002505


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!