Make Xcode automatically handle invalid characters in source file

Originator:daniel.saidi
Number:rdar://31817942 Date Originated:
Status:In Progress Resolved:No
Product:Xcode Product Version:8.3.2 (8E2002)
Classification:Bug Reproducible:Yes
 
Summary:
One of the most common annoyances I have with Xcode, without the critical lack of refactoring tools worthy of the name (think ReSharper), is that it does not restrict you from typing invalid characters into the code.

This should be an amazingly easy thing to fix, but has been in Xcode for a very long time.

Steps to Reproduce:
1. Open any Swift file in Xcode
2. Anywhere, type e.g. Alt+Space

Expected Results:
I would expect Xcode to ignore the alt key when typing, if it cannot handle the result.

Actual Results:
The Alt+Enter char is entered into the text editor. Swift now complains about "Invalid character in source file". The code won't compile.

Version:
Xcode 8.3.2 (8E2002) and earlier

Comments

I agree

Xcode should be able to handle this automatically. I experience this exact annoyance on a daily basis.


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!