aaronpowell / vscode-profile-switcher

A VS Code extension for switching settings easily
https://marketplace.visualstudio.com/items?itemName=aaronpowell.vscode-profile-switcher&wt.mc_id=profileswitcher-github-aapowell
MIT License
177 stars 19 forks source link

Not all extensions are installed #7

Closed Pandawan closed 5 years ago

Pandawan commented 5 years ago

For some reason, some extensions are not installed when loading a different profile. (Uninstalling seems to work fine).

Here's an example where I start with 9 extensions and load a profile that should be adding 8 new ones (for a total of 17). Strangely, when I load this new profile and reload the window, only 14 have been loaded. (You can see that the profile switcher extensions knows about the 8 new ones because they are reported in the console).

NOTE: This also happens when loading from marketplace rather than backup.

aaronpowell commented 5 years ago

Do you know which extensions weren't installed?

Are you able to check the extensions install folder (https://code.visualstudio.com/docs/editor/extension-gallery#_where-are-extensions-installed) to see if they are on disk? If it's marketplace then maybe Profile Switcher doesn't wait long enough to reload.

Pandawan commented 5 years ago

Do you know which extensions weren't installed?

In this case, it seems that StandardJS (chenxsan.vscode-standardjs), Beautify (HookyQR.beautify), and TSLint (ms-vscode.vscode-typescript-tslint-plugin) are not installing.

Are you able to check the extensions install folder to see if they are on disk?

They are still there. They simply don't show up in VSCode.

If it's marketplace then maybe Profile Switcher doesn't wait long enough to reload.

That could be it, but seeing that this also affects copying from a backup, it doesn't make much sense.

aaronpowell commented 5 years ago

So the folder(s) contained all the files for the extensions?

I'll test on those few myself (although I think I have HookyQR.beautify in my environment).

iamlasse commented 5 years ago

For example, I just tried switching profiles and the extension VETUR doesn't get re-installed.

Pandawan commented 5 years ago

So the folder(s) contained all the files for the extensions?

Sorry I thought this was rhetorical. Yes all the files are there.

aaronpowell commented 5 years ago

I've just tried myself on a clean install and I'm unable to replicate the issue.

Are you able to provide your settings.json file?

aaronpowell commented 5 years ago

@iamlasse I've had a look at vetur. It looks like that is a very large extension (approximately 150mb on Windows) and I had some issues in the removal logic that meant it reported completion before it was actually removed. As a result of this you would reload the window, kill the half-complete remove, and leave the backup in a corrupt state.

When you then activate a profile with that extension it would restore the corrupt backup, which wouldn't work.

https://github.com/aaronpowell/vscode-profile-switcher/commit/7b04bb2e71e69ce91c41759645c3bf96c74966ad is a commit that will fix this issue, I'll have it as part of the 0.3.1 release I'm about to push out.

@PandawanFr on further thought, this might also be the case for your issue. My plugin reports the removal when it's not complete, you reload, create corrupt backups and they fail to restore.

Once you've updated to 0.3.1 you'll need to remove the extension backups (probably best to remove them all) from the global cache path. On Windows this is at %APPDATA%\Code\User\globalStorage\aaronpowell.vscode-profile-switcher (or Code - Insiders if you use Insiders). On Mac and Linux I'm not 100% sure, but I think it's ~/home/.vscode/data/User/globalStorage/aaronpowell.vscode-profile-switcher.

aaronpowell commented 5 years ago

Closing as 0.3.1 likely fixes the problem that was happening here.

aaronpowell commented 5 years ago

I found another problem related to this which has been fixed in 0.3.3.

When multiple extensions were being installed from the marketplace (e.g. they aren't in the cache) my extension would do it in parallel. Because the process of installing via marketplace requires you to run vscode from the cli I was starting a whole bunch of VS Code instances in the background.

What I didn't realise about this was that each one that spun up would try and write to the same logfile, but all except the first one would fail because the file was locked for write.

0.3.3 will now install the extensions sequentially, which is going to be slower, but it means that each vscode process can write to the logfile and is less likely to fail. This is how Settings Sync works too.