Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
timsneath opened this issue Nov 24, 2020 · 7 comments
Labels
in editor Relates to code editing or language features is enhancement
Milestone

Comments

@timsneath
Copy link
Contributor

timsneath commented Nov 24, 2020

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
@DanTup
Copy link
Member

DanTup commented Nov 24, 2020

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?

@DanTup DanTup added the awaiting info Requires more information from the customer to progress label Nov 24, 2020
@timsneath
Copy link
Contributor Author

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!

@DanTup DanTup 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 Nov 25, 2020
@DanTup DanTup added in editor Relates to code editing or language features is enhancement and removed awaiting info Requires more information from the customer to progress is bug labels Nov 25, 2020
@DanTup DanTup added this to the v3.17.0 milestone Nov 25, 2020
@DanTup DanTup closed this as completed in 79b518f Nov 25, 2020
@DanTup
Copy link
Member

DanTup commented Nov 25, 2020

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!

@timsneath
Copy link
Contributor Author

timsneath commented Nov 26, 2020 via email

DanTup added a commit that referenced this issue Nov 30, 2020
Original tests for #2964 would cause prompts due to multiple projects and there was no Flutter SDK set up on CI anyway.
@DanTup
Copy link
Member

DanTup commented Nov 30, 2020

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).

@timsneath
Copy link
Contributor Author

timsneath commented Nov 30, 2020 via email

@DanTup
Copy link
Member

DanTup commented Dec 1, 2020

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
Labels
in editor Relates to code editing or language features is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants