-
Notifications
You must be signed in to change notification settings - Fork 248
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
Added VSCode settings and extensions backup/reinstall, pip3 backup. #205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, thank you for the PR. This would be a great feature to have.
I haven't tested it but it should work.
For your own software development knowledge, it's horribly bad practice to put anything untested on master
. Knowing that bugs slip through even when code is tested (you've even found some yourself) should hammer home the importance of testing everything before it goes on master, even if it's just a "simple" 6 line change.
Regardless, on to the code review.
Your solution should work, functionally. It's kind of like what I did with Sublime, but that was a quick and dirty fix. I'm not happy with my solution, and I don't really want to back up other IDEs in the same manner. I don't see a reason to back up the caches or <INSERT NON-CONFIGURATION FILE HERE>
. The end goal is to have a minimum set of files to recreate the user's configuration at the end of a reinstall.
It's not as simple as just backing up the parent VSCode folder and calling it a day. (Sorry for not being more specific in #45.) We really only want to back up a list of the extensions that were installed, their settings, and the VSCode settings. From that, we can likely reconstruct the VSCode installation exactly as the user had it.
One way to approach this could be: Generate a list of the installed extensions instead of backing up the whole folder, and see if there is a tool to reinstall them. (Or see if you can interface with VSCode itself to reinstall them?) This should go in the packages backup section. Separately, we want to back up the VSCode settings and keymappings. Those can be found here: /Users/alichtman/Library/Application Support/Code/User/{settings.json | keymap.json}
. From what I can tell, everything else in the Code
directory is essentially trash.
Does this make sense?
shallow_backup/config.py
Outdated
@@ -47,7 +47,8 @@ def get_default_config(): | |||
], | |||
"dotfolders" : [ | |||
".ssh", | |||
".vim" | |||
".vim", | |||
".vscode" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This folder doesn't actually hold any configuration files and doesn't really belong in this section, imo.
On my machine, it stores the downloaded extensions, and I'm not sure we should be backing up the actual source code for the extensions when we should be able to reinstall them.
See comment on PR for more details.
Note: I'm not thrilled with the Sublime backup solution I have at the moment. It backs up a ton of dead weight, and I don't want to establish that as the status quo. The initial goal of this project was to compress the backup size as much as possible. We should only back up the settings and extensions for VSCode / Sublime / Atom / etc.
Yeah you're totally right that I've tested it before submitting but my local Python environment isn't working and I given the small changes I wanted to put out the PR still. Yeah my bad. I've actually just replicated the backup process how you did it wit Sublime Text not knowing that this was just a quick and dirty fix that you didn't want to use anymore. But I understand that you only want to backup as little as possible. I know there's a VSCode Extension out there that does practically the same, we can look how they did the extension backup and built it in similarly. |
I've had these issues before. I understand your pain. :( That VSCode Backup extension will definitely be helpful when putting this feature together. I glanced at it and noticed it was written in TypeScript. I'm hesitant to add it as a pseudo-dependency (installing it from within I'd look at how it creates the backup (both in terms of which files are important and how the backup is structured) and how they reinstallation process works. After you get a sense for that, we can talk about how it best fits into |
@AlexanderProd any update on this PR? |
Sorry, didn’t have time for it yet.
|
@alichtman Do I have to create a completely new backup when I added new paths in Also I've noticed that Atom packages are still being backuped completely not just a reference to them, is this wanted behavior or subject to change? |
No, just the config file needs to be updated.
This is not the wanted behavior. We just want package settings and general settings. I'll open an issue to make sure this isn't missed. (#210) |
I guess the only thing missing is settings of individual packages, since we're already creating a list of all atom packages right? EDIT: got it working. |
This PR contains VSCode config backup, Extensions aren't being backuped.
If we want to backup extensions settings we probably have to backup the whole extensions folder since every extensions handles settings differently. |
I'll do a code review on this later tonight and see if we can get it in soon! |
Yeah a separate folder seems like a good idea and yeah I‘d make a separate PR for restoring the backup.
|
Sounds good. Let's open an issue to make sure it doesn't get lost in the mix. |
Configs are now saved into a dedicated folder. |
It worked without having to create it explicitly? Awesome. Same changes need to be made to the macOS configs. |
Yeah tested on MacOS and it worked, can't test in on Linux but I assume it would work as well. |
Just tested. Note: This does not backup the extensions, and it should. Let's sort that out before I merge this in. Nice work, @AlexanderProd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to back up extensions as well.
I didn’t include extensions yet because they’re a bit tricky. If we only save a list of extensions we won’t get eventual extension settings. We probably had to backup the whole extension folder since there’s no uniform way extensions handle configs.
|
I've added simple list style backup for VSCode extensions.
I've also quickly included the pip3 fix. #211 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we automate vscode reinstallation? That's the last thing I want to explore.
EDIT: Yes, we can. Run through the list of extensions saved and run code --install-extension <extension_id>
. Should be pretty easy to implement.
Everything else looks good here (although we do lose VSCode Extension settings, but we can open a separate issue for that if you don't want to figure that out in this PR.)
VScode Extensions reinstallation is working now. |
Awesome. Looks good to me. Will merge next time I'm on a laptop. |
This should fix #45 on macOS and Linux. I haven't tested it but it should work. 😄