Skip to content

Consider dart.analysisExcludedFolders when deciding whether to use Dart or Flutter SDK #2964

Closed

Description

@timsneath

Describe the bug
I'm working with the win32 package (https://github.com/timsneath/win32) and I want to be able to easily flip between 32-bit and 64-bit SDKs to test my code. Unfortunately, the version switcher isn't available because there is one example buried deep in the folder structure that happens to use Flutter :(

image

I have my SDK folder set up, and other Dart-only projects provide configuration for switching:
image

To Reproduce
Steps to reproduce the behavior:

  1. git clone the project above
  2. Run it from a machine with multiple Dart SDKs

Expected behavior
Don't know what the right solution is here. I should be able to trigger the chooser somehow though. The presence of a Flutter folder shouldn't cause the entire Dart project to be unable to use a Dart SDK.

Versions (please complete the following information):

  • VS Code version: 1.51.1 (user setup)
  • Dart extension version: 3.16.0
  • Dart/Flutter SDK version: multiple

Activity

  1. DanTup commented on Nov 24, 2020

    @DanTup
    Member

    Hmm, I'm not sure how we can handle this. Currently we only support a single SDK for the whole workspace (because we can only have one analysis server and may run commands that aren't project-specific).

    Would it be reasonable to exclude the example folder from analysis when you want to do this? Eg. if we made dart. analysisExcludedFolders also exclude the folder from project detection and you addd example to it, we'd no longer treat the workspace as Flutter, and you can add/remove that exclusion as required?

  2. added
    awaiting infoRequires more information from the customer to progress
    on Nov 24, 2020
  3. timsneath commented on Nov 24, 2020

    @timsneath
    ContributorAuthor

    Yeah, that would work fine. The example is highly incidental and I'd be happy to just load that subdirectory in a separate context if I ever needed to edit it. (And that seems like a viable general solution also, more importantly...)

    Thanks, Danny!

  4. changed the title [-]Can't switch Dart SDK in a project with a Flutter subfolder[/-] [+]Consider dart.analysisExcludedFolders when deciding whether to use Dart or Flutter SDK[/+] on Nov 25, 2020
  5. added
    in editorRelates to code editing or language features
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    and removed
    awaiting infoRequires more information from the customer to progress
    on Nov 25, 2020
  6. added this to the v3.17.0 milestone on Nov 25, 2020
  7. DanTup commented on Nov 25, 2020

    @DanTup
    Member

    With the fix, if you add this to your workspace settings (.vscode/settings.json):

    "dart.analysisExcludedFolders": ["example"]

    It will also exclude the folder from project detection when we're deciding which SDK to use (ofcourse, it'll also exclude it from analysis - but you'll need that if using a Dart SDK else you'll get errors on dart:ui). If you do want to switch back to the Flutter SDK (and have it analyzed) you can just comment that line out and run the Reload Window command (we don't currently support moving in/out of Flutter mode without a reload).

    I don't think there should be any other side-effects to this, but if you notice anything weird, please let me know!

  8. timsneath commented on Nov 26, 2020

    @timsneath
    ContributorAuthor
  9. DanTup commented on Nov 30, 2020

    @DanTup
    Member

    There's a beta build at https://github.com/Dart-Code/Dart-Code/releases that includes this if you'd like to try it (release notes not done yet though).

  10. timsneath commented on Nov 30, 2020

    @timsneath
    ContributorAuthor
  11. DanTup commented on Dec 1, 2020

    @DanTup
    Member

    Provisional release notes are now here if you're interested in what else is in there for testing too -> https://dartcode.org/releases/v3-17/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in editorRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions