flow icon indicating copy to clipboard operation
flow copied to clipboard

Inconsistent Warning Behavior in LSP

Open lyleunderwood opened this issue 3 years ago • 3 comments
trafficstars

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

image

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

lyleunderwood avatar Apr 27 '22 02:04 lyleunderwood

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.

mroch avatar May 01 '22 17:05 mroch

@SamChou19815 do you think your recent collation fixes might've fixed the issues detecting unused suppressions, making it safe to use include_warnings?

mroch avatar May 10 '24 14:05 mroch

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.

SamChou19815 avatar May 10 '24 16:05 SamChou19815