Closed stephencelis closed 2 years ago
And a work around appears just like that! You legend. Thank you.
Syntax highlighting breaks for me pretty much wherever a case path is used. Example:
Did anyone come up with a minimal reproduction case I can attach when submitting feedback? I can get around making one myself but thought I'd check first.
We just released 0.9.0, which comes with an alternative interface for creating case paths:
/Enum.case
// vs.
CasePath(Enum.case)
We hope this will provide a temporary workaround for folks experiencing issues with Xcode 14!
We hope this will provide a temporary workaround for folks experiencing issues with Xcode 14!
A reasonable trade-off! Thank you for introducing this. This syntax might in fact grow on me as I usually prefer spelling things out.
Seems like this got fixed in Xcode 14 beta 2:
Going to close this out then! Still some syntax coloring issues but hopefully that will be fixed in the future too.
@stephencelis In my experience, syntax highlighting and indentation are the only thing that effectively improved! Both screenshots are from Xcode 14b2. With the trailing comment, we get Previews & highlighting. Without, we're in the same state as beta1. Am I alone in this case?
@tgrapperon The highlighting is definitely still broken in your first image, and I've seen the same. I can corroborate issues with previews, which is unfortunate, and should definitely be reported. We can only hope for a more stable beta 3!
@stephencelis Last year's Xcode beta cycle was way worse in terms of highlighting/completion.
But the real issue there is that SwiftUI Previews are still not fixed. They still fail to build with uncommented CasePaths
. I'm also hopeful it will be solved as Previews catch up later in the cycle, but this issue is still present, with the same regex literal error message. From the comments above, I was under the impression they were fixed.
@tgrapperon We can definitely reopen and pin this issue given the problems, though it's out of our control 😞 We can at least re-encourage more feedback to Apple given the persisting problem.
If you've tried to use Case Paths in the first Xcode 14 beta, you may have noticed a few issues around the Regex literals. Please note that these are not issues with Case Paths the library, and are instead more general bugs with Apple's software.
While Apple appears to be aware of these issues, feel free to file feedback if any of them affect you, and we can hope for a speedy resolution in the next beta.
Issues (and some workarounds) are as follows:
Xcode previews in files that contain case paths will fail to run. This is a known issue. A workaround involves introducing a trailing comment to any line that contains a case path:
Usage of case paths can break Xcode syntax highlighting and indentation. There's no known workaround at this time (outside of using Xcode 13, instead), but if you find one, please share in a comment!
Xcode projects may default to "bare" syntax, which can break usage of case paths, especially when multiple are used on the same line. To fix, explicitly wrap any additional case path that appears on a single line with parentheses:
Or rewrite the same expressions over multiple lines to avoid having more than one case path per line:
Related discussions:
75
77
80