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.

Could you please go into more details setting up the locally build toolchain?

I have a project build setup to run the swift-frontend scheme with the swift file I want compiled, passed into the build arguments. I only get outputs from the console but like @dancamarotto I want to see the results of the fixItRemove and fixItInsert.

Am I supposed to add the SWIFT_EXEC value to the build project or add it to the project that contains the swift file I want compiled (there are two separate projects)? Maybe a screenshot of your settings or setup would be helpful?