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

Update / Upload Settings creates a new gist even if gist id has been added to settings #261

Closed
CodeCharm opened this issue Mar 19, 2017 · 13 comments

Comments

@CodeCharm
Copy link

Visual Studio Code Version : 1.10.2
Code Settings Sync Version : 2.6.1
Operating System : Windows 10 Pro (1607, build 14393)
Occurs On: Upload
Proxy Enabled: No
GIst Id: ad746d7c52666e787887b63902579241

I had very little trouble making my GitHub token; thanks for the good docs on that.

However, I've struggled with setting up new machines to use a Gist that I have created from other machines, especially if I am trying to make the new machines capable of updating the existing gist. If I only want to download the settings from the gist, I don't have any problems.

Here's the steps to repro:

  1. On Machine 1, install fresh VS Code and the code-settings-sync extension.
  2. Follow the directions to configure Machine 1 so that it can upload settings using a GitHub token. Capture the new GitHub token so that it can be used on another machine, later.
  3. Add some extensions or change some settings.
  4. Invoke the Sync: Update / Upload Settings command to update the gist. Capture the Gist ID. Make sure that the gist on gist.github.com has, in the settings.json file, a setting for sync.gist that contains the Gist ID for itself.
  5. On Machine 2, install fresh VS Code and the code-settings-sync extension.
  6. Invoke the Sync: Download Settings command to download the gist. When prompted for the Gist ID, use the captured Gist ID from earlier.
  7. Allow any extensions to be installed and reload the VS Code window, as needed.
  8. Add more extensions or change other settings so that it is different than Machine 1.
  9. Invoke the Sync: Update / Upload Settings command to update the gist. When prompted for the GitHub access token, use the same GitHub token that was captured earlier.

Expected:
The first gist should be updated with the new settings for Machine 2.

What actually happens:
A new gist is created with Machine 2's settings, and the settings.json file is updated to use the new gist ID. Machine 1's gist is untouched.

@shanalikhan
Copy link
Owner

shanalikhan commented Mar 19, 2017

I have tried yor steps its working for me. can you try to reset the settings
One thing,
It will always create new GIST even the existing Gist is present in settings.json when you mark the gist as public from secret from the github gist page or try to make public gist from extension

@CodeCharm
Copy link
Author

I don't know why it matters whether the gist is public or secret, so I didn't include that. Why must it matter?

When I reported this issue, the gists were secret, the default. I hadn't changed the access to public while I reproduced the issue. The only reason I made my gist public was so that you could examine it in case you suspected interference with some other extension or some other setting.

I'll try to check it again with yet another machine and varying the public/secret settings.

@DmitryRomaniuk
Copy link

@CodeCharm Maybe you don't write correctly github token, the first time I mixed github token and github gist id. You can reset token in settings github, if you forgot it.

@CodeCharm
Copy link
Author

Hi Dmitry,
Nope, I'm sure I had it right. I'd already spent a day or two getting it wrong the first time I was setting up the extension, a couple of weeks before I reported this.
->Alan

@elboletaire
Copy link

I can reproduce this issue under Ubuntu 16.04.

@elboletaire
Copy link

Nevermind, it just happened one time 😕

@shanalikhan
Copy link
Owner

Im still unable to reproduce it at my end. Is there any exception logged in developer console when it happens?

@CodeCharm
Copy link
Author

CodeCharm commented Apr 27, 2017

Just following up: I dramatically reduced the number of times I needed to try to set up new machines about a month ago, so I haven't been able to attempt repro cases as much. I have set up new machines, and since I've been especially careful about doing a download on new machines before invoking the Upload/Sync command, it has been performing to spec and I have not seen any new gists getting created.

(Not sure if this comment will re-open the issue. I don't want to re-open it; please re-close it if it does.)

Thanks for your time looking into this!
->A

@shanalikhan
Copy link
Owner

I've been especially careful about doing a download on new machines before invoking the Upload/Sync command

When you download the settings, and then git upload command, does it create new Gist on the new machines? (if yes, post console image)

@CodeCharm
Copy link
Author

Not anymore that I've seen (that was the original bug report I filed, above).

One way that people might get into trouble, though, which might be preventable: If the user does not do the initial download, but provides the GitHub token and then tries an upload, it will create a new Gist even if one already exists and is available via that token. Could that be prevented by scanning the available gists, looking for one named "cloudSettings" with a description of "Visual Studio Code Sync Settings Gist"? If you think it's possible, I might take a stab at making a contribution to the code.

@shanalikhan
Copy link
Owner

Well what we can do it like another way.

When user add token and hit upload. There will be two cases.
If the gist id is already added, it will upload to that gist.
If gist id not added in extension settings, it will scan all the gist and show a list with gist description SORTED BY last updated date only.

Similarly when user download the settings
Two scenarios, if gist ID is added in settings it will download from that settings and it not added, it will scan user gist same with gist description and sorted by last updated gist in a list AND OTHER option to download other user gist by providing the ID.

User wont be able to see fiat by its gist id or file name but with last updated gist date and gist description.

I am very willing to accept a pull request if u could do it.

Let me know

Thanks

@shanalikhan
Copy link
Owner

shanalikhan commented Apr 29, 2017

I have created a new issue for this scenario to work on future release for this feature.
If that is what you are asking, please post comment there to keep this and those feature separate thread.

@weerd
Copy link

weerd commented Aug 16, 2019

Hello!

I found this issue while trying to troubleshoot since I had a similar issue as original issue's creator, where Settings Sync created a new Gist (when one already existed) when running Sync: Update/Upload Settings on second computer. However, I may have an additional clue regarding the problem...

I had no issues with initially adding my GitHub token to the first computer and syncing my settings. It created the Gist as expected.

On second computer, after installing the Settings Sync extension on a clean VSCode install, I added the GitHub token and the new Gist ID via the Settings Sync UI, and then used the Sync: Download Settings command and that worked great.

After making a settings change, the first time I tried to run Sync: Update/Upload Settings on second computer it created a new gist and populated the Gist ID field in the extension settings with this new Gist ID.

I reset the settings and tried again, repopulating the GitHub token and original Gist ID in the Settings Sync UI page and ran Sync: Download Settings again.

This time, when I checked the settings for the extension however, the Gist ID setting was no longer set with the previously entered Gist ID setting I added via the UI page. It seemed to have gotten cleared out after having run the Download Settings command. This would explain why it thinks it needs to create a new gist, since it doesn't find the Gist ID since the field becomes empty.

Settings Sync extension settings after I ran Sync: Download Settings:
settings-sync

Upon re-adding the Gist ID to this field in the settings and running the Sync: Update/Upload Settings, everything worked as expected and the original Gist was updated with the new settings.

Sorry for the long explanation, but hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants
@weerd @elboletaire @CodeCharm @shanalikhan @DmitryRomaniuk and others