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

[FEATURE] - Sync projects definitions via native Settings Sync feature #431

Closed
enoversum opened this issue Nov 3, 2020 · 33 comments
Closed
Labels
depends on Depends on issues from VS Code enhancement sync Synchronization support

Comments

@enoversum
Copy link

enoversum commented Nov 3, 2020

Hi @alefragnani ,
just a quick question, I may simply be mislead at some point. Does (local, not GIT) projects sync through the regular VS Code sync normally work?

So far, natively, your project manager saves the 'projects.json' in the user folder in the VS Code folder, and as far as I experienced, the regular settings sync (not the plugin/extension) done through the Microsoft account won't sync projects from one machine to another. I understand I can set "projectManager.projectsLocation" to accept a different place, and I did just that with a folder I sync through another service. Just wanting to know, is there something wrong on my end that VS Code doesn't want to sync projects by the normal MS sync?

@alefragnani
Copy link
Owner

Hi @enoversum ,

I didn't play with Settings Sync yet, but as far as I remember from the release notes (while in Insiders release) and the official documentation (after landing on Stable), it seems session data are not synchronized. If that's the case then no, the projects.json won't be synchronized.

I also don't remember any API which extension authors could use, in order to add their own data to the syncing process. So, unless such API exists/appears, Settings Sync couldn't be used to sync your projects. At least, not today.

I wonder if it would worth to change how the extension itself works. I mean, instead of using an external file (project.json) to store user's projects, store them on User Settings directly. Personally, I'm not comfortable about touching (updating) user settings, but maybe that would be the case

Hope this helps

@enoversum
Copy link
Author

enoversum commented Nov 4, 2020

Hi @alefragnani ,
thanks for getting back so quickly. I know little about how VS Code stores data and what kind of data there is. Most other extensions seem to write their settings into the big settings.json, or into files directly in the project folders (like SFTP settings).
I am completely happy with the custom projects.json location setting you're offering. Since I sync my files for my projects anyway, I now have them synced as well. Of course, it would be easier for people to have it synced natively. But anyway, thanks for your extension, it works really beautifully. Especially the wildcard file watching is time-saving. I had been on Atom until recently, where you had to specify files directly to watch. Plus it was quite slower and had no native sync.

Thanks again :)!

@alefragnani
Copy link
Owner

Hi @enoversum ,

First of all, thank you for your kind words. I'm glad to know you like the extension 😁

The extension's settings, just like other extensions, are stored in User Settings, but the projects are considered extension's data, so are stored elsewhere. Since the beginning my intention was to be able to sync it somehow (started with Dropbox, them moved to GitHub repo), so instead of using the extension's data sandbox (which VS Code provides for every extension), I decided to use this User folder, which is mostly a VS Code sandbox location and exits on every VS Code install.

I don't need (personally speaking) any sync feature anymore, but I'm interested on embracing the native Sync on the extension, if possible.

This is the first issue asking about the native Sync feature, but I guess a lot of users could take advantage of this. I'll take a better look on its documentation and open issues, to find out how this could be accomplished.

Hope this helps

@enoversum
Copy link
Author

Hey @alefragnani ,

from what I gather, it's rather cumbersome to store projects in settings.json, that's for sure, so I hope - if you're as eager as I perceive :) - you'll find a working way to use the native sync functionality of VS Code. I kind of get what you're saying about the sandbox. One thing to keep in mind is that, while having the project list at hand, a user only benefits from synced projects if he somehow also syncs the actual project files and folders - so he has to have some kind of file syncing in place anyway, which could also incorporate the projects.json at a custom location.
For starters, I'd probably edit the documentation and explain shortly that there is no official sync integration, but advise one could set "projectManager.projectsLocation" to where projects themselves are synced.

And don't see my question here as an 'issue' (even though it's listed here as such) - there is no rush, I was just kind of curious if I missed out on official sync capabilities for projects, but your extension works astonishingly well anyway :) !

@alefragnani
Copy link
Owner

Hi @enoversum ,

I only found this issue, which maybe could work

Instead of saving the projects in projects.json, the extension should use extension's state. Doing so, this API would do the trick. The downside is, I guess it could be wiped out if you uninstall the extension, or when some VS Code upgrade occurs (I remember at least one release where this occurred).

Other than that, I see no way to accomplish your request.

And you are right, not only the projects.json should be synced but you should need have your projects location synchronised too, which in this case, is not handled by VS Code sync feature.

I'll let you know if I have any news

@alefragnani alefragnani added depends on Depends on issues from VS Code enhancement and removed question labels Nov 5, 2020
@enoversum
Copy link
Author

Hey @alefragnani ,

don't you take this too seriously - I am happily syncing projects with a custom projects.json location now, right were the actual project files are, that way everything for me is working fine. If you're eager to find out if and how you can accomplish projects sync right inside VS Code, you're welcome, but don't see this as a task to be done with high priority for me :) !

Anyway, thanks for your commitment :)!

@alefragnani
Copy link
Owner

Hi @enoversum ,

Not eager, just curious to know if it was doable, so I could give you proper feedback 😁.

Thank you

@enoversum
Copy link
Author

@alefragnani Being eager and enthusiastic isn't that bad, you know 😄 ? Please do let me know in any case 😃 !

@alefragnani alefragnani changed the title [QUESTION] - Sync projects natively? [FEATURE] - Sync projects definitions via native Settings Sync feature Nov 7, 2020
@thomasfrobieter
Copy link

thomasfrobieter commented Nov 12, 2020

My 2cent: I've synced settings & projects with https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync without any problem (you just have to add the projects.json to the sync manually).

Currently i also try to use the vscode core sync .. just to have less plugins installed. But yeah.. same problem here.. no projects sync.

@alefragnani
Copy link
Owner

@thomasfrobieter ,

Thanks for your 2cents 👍

I decided to take a look at Settings Sync extension's documentation/issues, and it appears it does sync the VS Code internal files. That would explain why it does sync projects.json and other related files. You can even see, on its README, the possibility to ignore some files, and use this extension as an exemple.

@pzelnip
Copy link

pzelnip commented Jan 29, 2021

Sorry, I'm not entirely clear from the discussion, is there currently a way to have the native Settings Sync feature in VS Code sync the project list managed by the Project Manager extension?

I recently switched jobs (and therefore machines) and while all my settings in VS Code came over due to settings sync, I was a little surprised to see no projects listed under projects manager (not a huge deal, most of the projects were from my old job so would no longer be relevant anyway).

@alefragnani
Copy link
Owner

Hi @pzelnip ,

No, there is no way, and as you already noticed, syncing the project list wouldn’t sync the projects itself 😁 .

It’s not possible because there is no API available in the Settings Sync feature to allow an extension to define additional files to be synced.

When you save a project, it is stored inside a file called projects.json. The Settings Sync feature does not monitor any file created by the extension, only settings and state. If they don’t provide a proper API, the only way to accomplish this would be to move the projects out of the projects.json file, to one of the locations mentioned above.

I found this issue microsoft/vscode#113774, which asks a similar idea, but has no few upvotes, and I guess it will be closed/canceled soon.

Hope this helps

@alefragnani
Copy link
Owner

I've created microsoft/vscode#120142 to request the possibility to synchronize “additional resources”, because I didn't find an issue for that.

It was closed as a duplicate of microsoft/vscode#113774, so I'll keep an eye on that.

@alefragnani
Copy link
Owner

alefragnani commented Mar 31, 2021

Just thought about it today, again, and two ideas came to mind:

@TylerLeonhardt
Copy link

the older settings sync extension used a GitHub gist for storing the settings... you could potentially do that as well. Plus you can use the new Auth provider API so you don't have to deal with any of the auth details.

@alefragnani
Copy link
Owner

That's true. I totally forgot.

Updated the comment above with some details about that.

Thanks

@TylerLeonhardt
Copy link

The bad: Depends on user having GitHub account and GitHub authentication turned on in VS Code

To be fair, if they are already using in-box Settings Sync with their GitHub account, this isn't much of a problem. It'd only be a problem for folks who:

  1. Use the Microsoft auth for Settings Sync
  2. Don't use Settings Sync at all

In #2's case they either don't want sync (so they probably don't want this feature), or are doing something custom to sync their settings... to which they can probably apply that same process to pick up the projects.json file.

@alefragnani
Copy link
Owner

alefragnani commented Apr 2, 2021

Totally agree. But remember these scenarios are just workarounds, until proper Settings Sync API is released 😉

Following the Gist approach is probably the safest bet. The original Settings Sync extension works this way, and it is a huge success.

Let’s go to learn a new API 🏃

@alefragnani
Copy link
Owner

@TylerLeonhardt ,

Finally could play a little with the Authentication API and octokit, and wow! Really simple to use. I think the approaches below could be fairly easy to use, on a users perspective

The simplest way

Step 1. The user toggles a setting to say "Use GitHub Gists to store your projects", and that's it.

The extension will take care of creating a new secret gist with a yet to be defined name (something like VSCode - Project Manager Extension - Projects), and store a projects.json file there

The complex way

Step 1. The user toggles a setting to say "Use GitHub Gists to store your projects"
Step 2. The user defines the name of the Gist to be used

The extension will take care of creating a new secret gist with the name provided by the user (if not available yet) and store a projects.json file there.

This scenario is useful if the user would like to share the projects between Stable and Insiders release, just like the projectsLocation setting that already exists today

Because I can use Authentication API, there is no need to use Token, Gist ID or something more complex (like Settings Sync apparently still uses).

What do you think?

@TylerLeonhardt
Copy link

Personally I think they are stepping stones. You could start with the simple solution until someone comes along and says "I wanna change the name" and then offer a setting to change the name.

@alefragnani
Copy link
Owner

That's great! I didn't have to use this kind of integration yet, so it's good to know the steps I thought are ok.

Right after posting that, I thought about a third option. Instead of creating a new setting to define the Gist name, why not reuse the projectsLocation setting, and allow a gist scheme, like gist:theGistNameYouWant.

Let's hold this to upcoming releases, as you said 😄

Thank you

@majkinetor
Copy link

majkinetor commented Jan 18, 2022

The bad: will be wasted when Settings Sync support is released (Allow syncing custom user files like emmet snippets microsoft/vscode#113774)

It doesn't look like this will get implemented any time soon. I don't see a downside of keeping settings among User settings, the setting itself is also quite small. However, for the best benefit extension should support environment variables in path specification so that it could work cross platform.

The absence of this feature is most troubling for me. I work on several different machines all the time and keeping projects in sync is pain.

@alefragnani
Copy link
Owner

I have a similar feeling, that’s why I created #525, and plan to add this for upcoming releases.

About environment variables, you can use ˜ or $home as alternatives to your home folder. But, if you have more complex scenarios, maybe you have the same request as #550 .

Hope this helps

@majkinetor
Copy link

OK, gist is an option too, whatever really, just let them sync. Its IMO better to move settings to user ones as with gist, you need more lengthy ceremony on each machine, but its more important that it works somehow.

˜ or $home as alternatives to your home folder

One env var is not much better then 0, particularly if somebody else dictates where projects are stored on particular system. For example on Windows it might be c:/Projects and on Linux /projects and env var $PROJECTS_ROOT could be set appropriately for sync just to work.

@alefragnani
Copy link
Owner

For example on Windows it might be c:/Projects and on Linux /projects and env var $PROJECTS_ROOT could be set appropriately for sync just to work.

You don’t need an env var for that. Simply add all folders in settings and it will recognize the projects on each machine, independently.

OK, gist is an option too, whatever really, just let them sync

It is VS Code which provides (and will be responsible for) syncing, not this extension. Creating manual sync via Gist is just a workaround for a missing API. Otherwise, I suggest you to take a look at the Settings Sync extension (https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync ), which this native Settings Sync provided by VS Code is trying to replace. This extension has been created years ago and already syncs projects.json file automatically. I never used, but read a lot about it.

It seems you are disappointed with the Settings Sync feature provided natively by VS Code (if you compare to the Settings Sync extension created years ago), so I suggest you to upvote/comment on that issue, so they are able to see not only extension developers, but also users complaining by the missing API.

@majkinetor
Copy link

majkinetor commented Jan 18, 2022

You don’t need an env var for that. Simply add all folders in settings and it will recognize the projects on each machine, independently.

OK, that is alternative solution which does require repeating entire config on each environment instead of creating single env var.

I suggest you to take a look at the Settings Sync extension

I was using it before, but integrated sync is much better IMO and more controllable. It worked OK with projects.

It seems you are disappointed with the Settings Sync feature provided natively by VS Code

Ofc I did upvote on original ticket and added a comment to pin it up for those that sort by updated date :) However, the ticket exists for more then a year and has only 10 upvotes (30 are required for it to be considered. I doubt that will happen soon.

@majkinetor
Copy link

majkinetor commented Jan 18, 2022

What is the reason against moving project.json to User settings ? Maybe it could be an option and default could be compatible with current settings ? :)

@alefragnani
Copy link
Owner

Historically speaking, there are some details here: #431 (comment)

About the sync feature, it has its pros and cons, as you can see here: #431 (comment)

@lahcenassmira
Copy link

great****

@Fred-Vatin
Copy link

I suggest my issue microsoft/vscode#113774 mentioned several times here be referenced in the first post inciting people to upvote it. It currently has 20 upvotes and miraculously escaped from their bot killing issue which have not enough attention.

What I did to sync those kind of settings was using the old sync settings extension. Now I consider to move files not synchronized by the built-in settings sync to a folder in my onedrive if all my extensions allow to.

@alefragnani
Copy link
Owner

Since microsoft/vscode#113774 was closed as not planned, it seems there will be no support for native Settings Sync feature.

That being said, I'll focus on #525 for upcoming releases.

@depascalis
Copy link

Yup, this week they have been closing like all the feature requests I've been following, cleaning up for the new year or something 😞

@alefragnani
Copy link
Owner

This is their house keeping iteration, which happens once a year (more info here https://github.com/microsoft/vscode/wiki/Issue-Grooming).

I see this as a good practice for a project of its size, even when they close issues that I'm interested.

@alefragnani alefragnani closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
depends on Depends on issues from VS Code enhancement sync Synchronization support
Projects
None yet
Development

No branches or pull requests

9 participants