#nowarn in the editor does not ignore warning if --warnaserrors flag is set, but compiler does
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 131
Description
(edited, it is not related to `--warnon`, but to `--warnaserrors`)
If you have `--warnaserror:xxxx`, and on file-level you disable that same warning, you still see the errors in that file, while the compiler succeeds. This is confusing.
## Repro steps (1)
1. Add "25" to the _Warnings as errors_:

2. Add `#nowarn "25"` to a source file.
2. Write code that triggers this warning:

## Repro steps (2)
1. Add `warnon:1182` in project settings:

2. Add `FS1182` to the "warnings as errors":

3. Inside a source file, add `#nowarn:1182` at the top
4. Have a line with an unused variable

**Expected behavior**
Inside a file, the editor should consider the `#nowarn` directives.
**Actual behavior**
Apparently, the editor highlighting tooling is aware of the `--warnaserror` compiler option, but not of the `#nowarn` directive in the file, and shows the error, while `fsc` doesn't show an error.
* It shouldn't show the red squiggles
* It should (probably) still show the "unused" warning in the mouseover
* It should keep the ident greyed out
**Known workarounds**
Don't use these options, or fix your errors. But as seen in #9795, that's not always possible.
**Related information**
* It doesn't matter whether you use the UI setting, or add `--warnaserror:XXXX` to the addition fsc options
----
Not really related anymore, but FYI, since 1182 is a "special" warning that does not get triggered on any warning level, unless you add the `--warnon:XXXX` to the options.
In this reaction, back in 2015 (!) (https://github.com/dotnet/fsharp/issues/422#issuecomment-99961730), @dsyme mentions that opt-in for FS1182 was deliberate. It was done before moving to github, so I cannot find the decision/discussion or changes.
> Yes, I do recall this, it's good to have it recorded (and yes, this was one of the reasons /warn:1182 was made opt-in)
Contributor guide
Assessment
This issue has not been assessed yet.