-
Notifications
You must be signed in to change notification settings - Fork 340
Description
Describe the bug
In a file with errors or warnings, if I use f8 to navigate to an error which is on a field in a class, I get a hover with the error message.
For some errors, fixing the error has no effect whatsoever on the hover (it continues to display the stale error). I'm not sure if this is WAI or not, it doesn't seem ideal, but I could see it going either way.
For errors specifically associated with a field in a class, the error text in the hover does update as I type, but stops updating in a transient error state with a stale transient error message.
To Reproduce
Create a file named example.dart, containing:
class Foo {
final bar;
Foo(this.bar);
}
and an analysis_options.yaml containing:
analyzer:
language:
strict-inference: true
There will be a diagnostic indicating that the type of bar cannot be inferred. Pressing f8 will pop this up in a hover, and take you to the location.
Now place the cursor immediately before the letter b, and type dynamic to fix the error. Note that the hover text continuously updates with transient errors (this doesn't seem to happen with local variables), but when the typing is completed, the last transient error is left in the hover (even though all errors in the diagnostics window are now gone). The text of the hover will say "The type of dynamicbar can't be inferred without either a type or initializer.
Try specifying the type of the variable.dart(inference_failure_on_uninitialized_variable)" (note that it has captured the state immediately before the space was added to separate dynamic and bar).
Expected behavior
Ideally, I think I would expect the hover to reflect the fact that the error has been fixed. The alternative behavior of retaining the original error doesn't seem ideal to me, but is at least consistent. The current behavior of capturing transitory errors is very confusing.
Please complete the following information:
-
Operating System and version: Darwin leafp-macbookpro2.roam.internal 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64
-
VS Code version:
Version: 1.66.2 (Universal)
Commit: dfd34e8260c270da74b5c2d86d61aee4b6d56977
Date: 2022-04-11T07:49:20.994Z (4 days ago)
Electron: 17.2.0
Chromium: 98.0.4758.109
Node.js: 16.13.0
V8: 9.8.177.11-electron.0
OS: Darwin arm64 21.4.0 -
Dart extension version: v3.38.2
-
Dart/Flutter SDK version: Dart SDK version: 2.18.0-edge.5910da4f021fd6c52359d43dc76f93bc11f492d3
-
Target device (if the issue relates to Flutter debugging): N/A
