dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.12k stars 1.57k forks source link

Auto Fix for Import Not Working in Dart 3.5.3 #56765

Open fahad0100 opened 2 weeks ago

fahad0100 commented 2 weeks ago

o,

I am encountering an issue with the auto-fix feature for imports in Dart SDK 3.5.3 within Visual Studio Code. When I press for quick fixes (auto-fix) to import a file, no suggestions are provided, even though the file exists and should be recognized by the analyzer.

Here are some details about the issue:

Dart SDK Version: 3.5.3 (Stable) VS Code Version: 1.93.1 (Universal) Dart Extension Version: v3.96.0 Operating System: macOS 14.5 (23F79) Steps to Reproduce: Create a new Dart file and attempt to use a class or function from another file without importing it. Press Cmd + . (or Ctrl + . ) for the quick fix suggestion to import the file. No suggestions for the import appear, even though the file exists in the expected location. Expected Behavior: A quick fix suggestion should appear to auto-import the required file when using the class or function from another file.

Actual Behavior: No suggestions appear for auto-importing the file, and I have to manually add the import statements.

Additional Information: I have tried restarting the Dart Analysis Server using Dart: Restart Analysis Server. I have ensured that the settings in settings.json are configured correctly for quick suggestions. The problem persists even after clearing the .dart_tool directory and running dart analyze. Let me know if there’s any additional information you need, or if I can assist further in diagnosing the issue.

Thank you!

dart-github-bot commented 2 weeks ago

Summary: The user is experiencing an issue with the auto-fix feature for imports in Dart 3.5.3 within VS Code. Quick fixes for importing files are not being provided, even though the files exist and should be recognized by the analyzer.