Allow quick switching of SDK versions
See original GitHub issueI often find myself swapping between SDKs, eg. testing dev releases that have fixes for bugs I’ve reported, switching to an older version to try and repro bugs, testing Dart Code against older SDKs that users might be using.
I think this could be made much easier with fairly little effort…
Add a new user setting that points to a folder that is a collection of SDKs. When set, the version number shown in the status bar can be clicked on to open a picklist (same as how Code’s indent settings work) and let you pick a sub-folder from that location (the list should only include those that look like SDKs). This would set the sdkPath
setting and prompt to reload (or maybe automatically reload if no dirty buffers).
This should support symlinks too, eg. so if you have checked out versions of the SDK repo you could have a dev
(or whatever) symlink pointing there for easy switching in and out of release/dev.
If we can detect the architecture, we could also possibly add a new option to the “new SDK” notification for “Download now” which automatically downloads and extracts (this might need specific x-plat code) to that folder and switches to it.
@devoncarew Might this be useful to you? Anything else to add?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
My plan (which was formed pre-flutter) was to keep it as a string and just scan all adjacent folders for the dart binary to get the possible SDKs. I have my SDKs all together like this:
Whenever a new SDK comes out I just rename the old folder and drop the new one in Dart. Currently I also then change my settings path to switch between them.
My plan was to make it so when the user clicks on the SDK version in the status bar we scan the adjacent folders and do exists checks for the Dart VM (
.\bin\dart.bat
). If there’s more than one then use a Code pick-list to let the user select one, then just update thesdkPath
user setting and reload the project.It would work very much like the language-selector already in Code (other than requiring a reload).
I don’t know enough about Flutter dev to know whether it’d be useful to do the same there - each time I used it it seemed to want its own version of the Dart SDK, so I don’t know what the workflow would be like to use an old version.
Edit: I see when I wrote this I said the setting would point at the parent folder; that’s an option too -
sdkPaths
(plural) could be set if you want to have a folder full of Dart SDKs and we can just do the same thing I mentioned above based on that. The advantage to this way is that we know where the user wants to keep their SDKs so auto-downloads might be easier in future.Added
dart.sdkPaths
. When set, the version in the status bar becomes clickable and shows a picklist of SDKs found inside that folder. Top option resets the config setting to blank which will search path at startup.Note: Selecting something from this list will set the
dart.sdkPath
option in your user settings (figured it’d be confusing to have two options, one where the user typed it into settings and another hidden setting being set by this).