Skip to content

Extension does not activate for deeply-nested workspaces with analysis_options.yaml in the top 3 levels #5490

@andynewman10

Description

@andynewman10

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:

  1. git clone --no-checkout https://github.com/flutter/packages.git
  2. cd 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)
  3. code .
  4. At this point, no flutter pub get is proposed by the Dart-Code extension, and the analyzer does not run.
  5. 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?
  6. 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.lock files in all example subfolders.
  • 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.

  1. git clone --no-checkout https://github.com/flutter/packages.git
  2. cd 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)
  3. NOW do cd packages AGAIN, to go inside that folder. This is the important bit.
  4. code .
  5. You still have to open a .dart file for Dart-Code to propose to do the flutter pub get for 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.dart has no error, as expected.
  • packages/camera/camera/example/pubspec.lock has been generated successfully, so have packages/camera/camera/example/.flutter-plugins and packages/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions