pointfreeco / swift-case-paths

🧰 Case paths extends the key path hierarchy to enum cases.
https://www.pointfree.co/collections/enums-and-structs/case-paths
MIT License
907 stars 105 forks source link

Xcode 14 beta 1: issues with Regex and Xcode previews #81

Closed stephencelis closed 2 years ago

stephencelis commented 2 years ago

Note: If you've encountered any of the issues mentioned below, please share the details on the Swift forums as outlined here.

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:

Related discussions:

lukesutton commented 2 years ago

And a work around appears just like that! You legend. Thank you.

kaishin commented 2 years ago

Syntax highlighting breaks for me pretty much wherever a case path is used. Example:

screenshot-2022-06-09
kaishin commented 2 years ago

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.

stephencelis commented 2 years ago

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!

kaishin commented 2 years ago

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.

davdroman commented 2 years ago

Seems like this got fixed in Xcode 14 beta 2:

Screen Shot 2022-06-22 at 19 40 24

stephencelis commented 2 years ago

Going to close this out then! Still some syntax coloring issues but hopefully that will be fixed in the future too.

tgrapperon commented 2 years ago

@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?

Xcode 14b2 issue Xcode 14b2 workaround
stephencelis commented 2 years ago

@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!

tgrapperon commented 2 years ago

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

stephencelis commented 2 years ago

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