See diagnoses in Xcode

I'm currently working in the front-end compiler, and when I run my Swift code passing as argument -typecheck, I can see the generated diagnoses in the console, but I can't see them like I would normally do in Xcode. The problem with that is that it becomes difficult to test fixIt suggestions.

This is what I wanted to see:
Screenshot 2023-10-21 at 13.39.21

Rather than just the console output. Is there a way to achieve this?

When emitting diagnostics, you can call fixItRemove and fixItInsert functions on the returned value of diagnose. I reviewed a PR recently that had some examples of this: Introduce `@extern(c)` to declare C function without Clang module by kateinoigakukun · Pull Request #69207 · apple/swift · GitHub, I hope that's relevant to what you're trying to achieve.

Is there a way to see the results of the fixItRemove and fixItInsert in Xcode? The only way I could do that was via unit tests.

Please follow the guidance in the FAQ for the SWIFT_EXEC setting and environment variable to try a locally built toolchain in Xcode.