flow
flow copied to clipboard
Inconsistent Warning Behavior in LSP
Flow version:
Expected behavior
All warnings generated by flow are consistently either sent to the IDE via LSP or not.
Actual behavior
Warnings from lints get to the IDE via LSP but "built-in" warnings such as "Unused suppression comment" and "Suppression is missing a code" do not (EUnusedSuppression and ECodelessSuppression).

Screenshot from VS Code. Note that line 5 will generate a warning in the CLI output when running npx flow but no warning has made it to the IDE.
- Github repo: https://github.com/lyleunderwood/flow-inconsistent-warnings
this is a bug with include_warnings=true. I attempted to fix this in 0.160.0 and 1.160.1 but it kept breaking stuff so I reverted the attempts in 0.160.2.
the bug is related to how we store and clear errors during a recheck. we detect suppression comments in one phase, and errors in another. sometimes during a recheck we can skip the second phase if we know the inputs didn't change, but this causes us to see suppressions but no errors, leading to "unused" suppressions.
internally, we decided to turn off include_warnings=true to mitigate this. we run a nightly cron job that uses tool update-suppressions --only remove (tool is in packages/flow-dev-tools) to remove unused suppressions, instead of warning and making users deal with it.
@SamChou19815 do you think your recent collation fixes might've fixed the issues detecting unused suppressions, making it safe to use include_warnings?
No, it remains risky due to the potential presence of misplaced errors + lazy mode, but we can at least start to show all other warnings.