Sometimes a diagnostic warning appears only in the `Issue Navigator`, not in the `Editor` itself.
Description
Please, refer to this minimal reproducible project.
Steps to Reproduce
In the minimal reproducible project the issue is reproduced already 🙂
Thank you for the super simple reproducer + clear comments @RoBo-Inc!
The issue here is that your .filter and as ... is actually creating a new syntax tree, so the node being passed to the diagnostic constructor has a different root to the original tree and we then can't map it back to the original location. That then causes your diagnostic to be output without a location (and thus not seen in the editor) vs with a location (now seen).
You can see this in the build logs:
<unknown>:0: warning: Type should be defined explicitly. (from macro 'DiagnosticBug')
vs
.../DiagnosticBug/Sources/DiagnosticBugClient/main.swift:5:9: warning: Type should be defined explicitly. (from macro 'DiagnosticBug')
The workaround is to make sure to use the nodes from the original tree when diagnosing. This is a fairly common issue though and one we started looking at in https://github.com/swiftlang/swift-syntax/pull/2118. We really need to finish that off and get it in 😅