Open bkleineibst opened 4 months ago
@bkleineibst you should run "fvm install" to install the version that is configured.
The version is not "deleted" is just that the symlink gets removed.
Does the issue persist?
@leoafarias fvm install
works, as does fvm use
. However, both of these delete my comments from settings.json
. I know I can use json formatted comments, but they just don't stand out.
The main question is why remove the symlinks for other flutter versions when switching flutter versions with fvm? If they were left there, I would not have to fvm install
to get the folder back.
Ok, I understand now. I will look into it. However, I need a way to clean up at some point.
Maybe use flavors as the flag to check if it should be maintained?
@leoafarias My thinking is rather have symlinks to all installed flutter versions. There is very little cost of keeping all of them in each project. Maybe just delete symlinks in the project if their targets have been removed? I.e., keep symlinks in sync with all installed flutter versions.
@bkleineibst I have to think about it. FYI, some tools like melos and others depend on only one symlinks, which is flutter_sdk
, that means that it is best practice to always rerun fvm install
.
I think this should be handled by a trigger, on .vscode, maybe an FVM extension?
@leoafarias How about when fvm is run, it always checks to make sure that the flutter_sdk/version
file matches the version specified in .fvmrc
. If not, it triggers an install, but without updating settings.json
. (assuming there is no reason to update it)
If a solution like this would work, would you then need the specific version symlink in the .fvm/versions
folder? Couldn't settings.json
always point to flutter_sdk
? Would this not also obfuscate the need to update settings.json
at all, except maybe on a first-time fvm use
?
Before creating a bug report please make check the following
Describe the bug I use different versions of flutter in different branches of my repo. If I switch between branches, .settings.json references a version of flutter that doesn't necessarily exist anymore. I need to run
fvm use
to get the link to the correct version of flutter for the branch, for use from within vscode.To Reproduce Steps to reproduce the behavior:
fvm use
different flutter versions in each branch, and commit .fvmrc and .settings.json in each branch.Expected behavior Should be able to switch branches and automatically use correct flutter version.
Desktop (please complete the following information):
Additional context
fvm use
seems to create a link to the appropriate version of flutter in the .fvm folder, and deletes other versions. If it kept other versions here, things should work, except on trying to use a new version that has not been used before.