Describe the bug
The Dart extension does not issue all expected flutter pub get commands and does not analyze the source tree the same way depending on whether, after cloning a repository, a specific folder or a subfolder has been opened as workspace root.
To Reproduce
Steps to reproduce the behavior:
git clone --no-checkout https://github.com/flutter/packages.gitcd packages,get sparse-checkout init --cone,get sparse-checkout set packages/camera packages/google_maps_flutter(this restricts checkout, so that things are faster and easier to repro)code .- At this point, no
flutter pub getis proposed by the Dart-Code extension, and the analyzer does not run. - I now open a .dart file (for instance:
packages/camera/camera_android/lib/src/android_camera.dart). 'flutter pub get' is proposed now. Is this exact behaviour expected? - Regardless, let 'flutter pub get' commands be issued and let the analyzer run for a while. It will be quick since there are not many files in the workspace.
Actual behavior
- pubspec.lock files in all example folders did not get generated. Somehow, the Dart-Code extension did not see (?) the pubspec.yaml files at these locations.
- many items will be red in the file hierarchy on the left (although these projects are known to be working) after the analyzer has finished its job.
For instance, packages/camera/camera/example/lib/main.dart has the following error:
import 'package:video_player/video_player.dart' // Red underline: Target of URI doesn't exist: 'package:video_player/video_player.dart'
Expected behavior
- Dart-Code generating
pubspec.lockfiles in allexamplesubfolders. - no analyzer error anywhere
To Reproduce (variant, opening the cloned folder as workspace root this time, not the parent folder)
Create a new empty workspace folder, and start over from here.
git clone --no-checkout https://github.com/flutter/packages.gitcd packages,get sparse-checkout init --cone,get sparse-checkout set packages/camera packages/google_maps_flutter(this restricts checkout, so that things are faster and easier to repro)- NOW do
cd packagesAGAIN, to go inside that folder. This is the important bit. code .- You still have to open a .dart file for Dart-Code to propose to do the
flutter pub getfor you. This is still weird, but do this.
Expected and actual behaviour (this time)
No analysis error.
This time:
packages/camera/camera/example/lib/main.darthas no error, as expected.packages/camera/camera/example/pubspec.lockhas been generated successfully, so havepackages/camera/camera/example/.flutter-pluginsandpackages/camera/camera/example/.flutter-plugins-dependencies.
Please complete the following information:
- Operating System and version: Windows 11 24H2
- VS Code version: 1.99.3
- Dart extension version: 3.108.2
- Dart/Flutter SDK version: 3.29.2 and related Dart version
- Target device (if the issue relates to Flutter debugging): not related to debugging
Reproduced on two different Windows computers and a Mac with similar setup running Sequoia 15.4.1.