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

[Done] Improve compatibility with different versions of VSCode #859

Merged
merged 15 commits into from
Jun 7, 2019
Merged

[Done] Improve compatibility with different versions of VSCode #859

merged 15 commits into from
Jun 7, 2019

Conversation

auxves
Copy link
Contributor

@auxves auxves commented Apr 23, 2019

Short description of what this resolves:

This PR simplifies finding the code configuration folders and uses the API to install/uninstall extensions.

Changes proposed in this pull request:

  • Find Code folder using the globalStoragePath and by traversing 3 directories up
  • Find Extensions folder by getting a random extension and traversing up 1 directory
  • Use VSCode API to install/uninstall extensions

Fixes: #668

How Has This Been Tested?

I have tested this PR with the OSS version, VSCodium portable, and the official version (on Manjaro), and with the official version on Windows.

Checklist:

Progress:

  • Install extensions using API
  • Uninstall extensions using API
  • Get folders properly

auxves added 2 commits April 22, 2019 17:23
enums.ts
----
Allow for setting os type with less code

environmentPath.ts
----
Find code folder and extensions folder more efficiently
Get OS type more efficiently

settings.ts
----
Ignore all state files

sync.ts
----
Adapt for changes in pluginService

pluginService.ts
----
Use vscode command to install extensions
Clean up code and simplify names
@shanalikhan
Copy link
Owner

Thanks for the work so far.

I need people using OSS Code to test it

lets complete this PR, after code review we will ask the users there to test by providing the custom build in that thread for OSS version before merging.

Also please comment this code as of now instead of removing
https://github.com/shanalikhan/code-settings-sync/pull/859/files#diff-09ef59e49c66636eacf529be73517d36L67

I will suggest you to comment each of the old code in each functions in that function code comment block for the environmentPath file only. We will remove it later.
Alot of users sent PR fixing the paths for code versions, so it might help us in future and we will remove the comments later when not required.

@shanalikhan shanalikhan added this to the v3.3.0 milestone Apr 23, 2019
@nadiamoe
Copy link

VSCodium user here, can you provide some instructions so I can test this? I'm pretty new to the VSC ecosystem, so if you could provide a prebuilt version of the extension and how to install it would be great. Thanks!

@auxves
Copy link
Contributor Author

auxves commented Apr 29, 2019

@roobre Here is a prebuilt version of this PR: https://cdn.discordapp.com/attachments/549007146868539408/572557047439032330/code-settings-sync-3.2.9.vsix

can you provide some instructions so I can test this?

Instructions can be found here on how to install the VSIX file: https://code.visualstudio.com/docs/editor/extension-gallery#_install-from-a-vsix

@nadiamoe
Copy link

Done, but it's still not working for me on VSCodium. The upload is just fine, but after entering the token and gist id on the other side, and clicking Yes in the extension install prompt, nothing happens. Where can I can find a detailed log of why is it failing? Maybe that would be helpful.

@auxves
Copy link
Contributor Author

auxves commented Apr 30, 2019

@roobre are you getting anything in the console? You can find it under Help -> Toggle Developer Tools.

@nadiamoe
Copy link

nadiamoe commented May 1, 2019

So, strangely, I tried to reproduce everything with the console open and now it is working (extensions are correctly installed). Thanks!

However, whenever I try to update the changes on the receiving side, a new gist is created instead of updating the one that was used to sync in the same place. This does not happen on the VSC instance that first updated the settings.

@auxves
Copy link
Contributor Author

auxves commented May 3, 2019

@roobre Here is an updated version with some issues with extension installation hopefully fixed. If you could test it, that would be great!
https://cdn.discordapp.com/attachments/549007146868539408/574452219064352768/code-settings-sync-3.2.9.vsix
Edit: updated with many many fixes

@auxves auxves mentioned this pull request May 5, 2019
@nadiamoe
Copy link

nadiamoe commented May 6, 2019

Should I test the current link or wait for a more recent version with the new commits applied? Thanks!

@samirfor
Copy link

@roobre Here is an updated version with some issues with extension installation hopefully fixed. If you could test it, that would be great!
https://cdn.discordapp.com/attachments/549007146868539408/574452219064352768/code-settings-sync-3.2.9.vsix
Edit: updated with many many fixes

I think it's okay now. Thanks.

@auxves
Copy link
Contributor Author

auxves commented May 19, 2019

@roobre sorry for the late reply. Can you try this version? Installing extensions should work, but uninstallation has yet to be implemented. Thanks! https://cdn.discordapp.com/attachments/549007146868539408/576214978931982336/code-settings-sync-3.2.9.vsix

@nadiamoe
Copy link

nadiamoe commented May 26, 2019

@arnohovhannisyan I have done a simple test and seems to be working good so far in VSCodium.
Made an initial upload on host A, downloaded to host B, made changes on host B, and gitst seems to be updated accordingly.
Tomorrow I'll test to see if downloading changes on host A again works properly, but for now it seems quite nice.

Thanks!

Update: Seems to be working good on the other end too!

@auxves auxves changed the title [WIP] Add more support for OSS versions of code [Almost Done] Add more support for OSS versions of code May 27, 2019
@auxves auxves changed the title [Almost Done] Add more support for OSS versions of code [Almost Done] Improve compatibility with different versions of VSCode Jun 4, 2019
@auxves auxves changed the title [Almost Done] Improve compatibility with different versions of VSCode [Done] Improve compatibility with different versions of VSCode Jun 6, 2019
@auxves
Copy link
Contributor Author

auxves commented Jun 6, 2019

@shanalikhan Microsoft has released the May 2019 update, so this PR is complete and ready to be merged.

Copy link
Owner

@shanalikhan shanalikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the required things. Code review is done.
I will test it and merge it in the coming days.

src/environmentPath.ts Show resolved Hide resolved
src/environmentPath.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
src/sync.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
src/service/pluginService.ts Outdated Show resolved Hide resolved
@auxves
Copy link
Contributor Author

auxves commented Jun 6, 2019

@shanalikhan Are you happy with my changes? Do you have any other requests for changes?

@shanalikhan shanalikhan merged commit f12f8ed into shanalikhan:v3.3.0 Jun 7, 2019
@shanalikhan
Copy link
Owner

Thanks. Merged.
You can test on v3.3.0.
I will test it also alongwith other PR and release upcoming version soon.

@shanalikhan
Copy link
Owner

Okay this is some initial observation.

  1. Got this error while it tried to remove.
    image
    image

  2. This is in the Output Pane. If you observe the logs, it didnt wrote the added extensions in the output pane even after installing and didnt show anything on removed extensions.

Realtime Extension Download Summary
--------------------
TOTAL EXTENSIONS : 8



[x] - EXTENSION: rainbow-brackets INSTALLED.
      1 OF 8 INSTALLED


[x] - EXTENSION: path-intellisense INSTALLED.
      2 OF 8 INSTALLED


[x] - EXTENSION: npm-intellisense INSTALLED.
      3 OF 8 INSTALLED


[x] - EXTENSION: vscode-eslint INSTALLED.
      4 OF 8 INSTALLED


[x] - EXTENSION: vscodeintellicode INSTALLED.
      5 OF 8 INSTALLED


[x] - EXTENSION: shades-of-purple INSTALLED.
      6 OF 8 INSTALLED


[x] - EXTENSION: tslint INSTALLED.
      7 OF 8 INSTALLED


[x] - EXTENSION: jshint INSTALLED.
      8 OF 8 INSTALLED

CODE SETTINGS SYNC DOWNLOAD SUMMARY
Version: 3.2.9
--------------------
GitHub Token: xxxxx
GitHub Gist: e86911443d3f81be6a66699603aee6dc
GitHub Gist Type: Secret

Restarting Visual Studio Code may be required to apply color and file icon theme.
--------------------
Files Downloaded:
  extensions.json > extensions.json
  keybindings.json > keybindings.json
  launch.json > launch.json
  locale.json > locale.json
  settings.json > settings.json
  snippets|blade.json > snippets|blade.json
  snippets|c.json > snippets|c.json
  snippets|clojure.json > snippets|clojure.json
  snippets|csharp.json > snippets|csharp.json
  snippets|go.json > snippets|go.json
  snippets|html.json > snippets|html.json
  snippets|javascript.json > snippets|javascript.json
  snippets|javascriptreact.json > snippets|javascriptreact.json
  snippets|php.json > snippets|php.json
  snippets|sass.json > snippets|sass.json
  snippets|test.code-snippets > snippets|test.code-snippets
  vsicons.settings.json > vsicons.settings.json

Extensions Ignored:
  No extensions ignored.

Extensions Removed:

Please open new PR fixing this, linking with this PR and original issue.
:)

@shanalikhan
Copy link
Owner

when do you think you can fix it?

@auxves
Copy link
Contributor Author

auxves commented Jun 9, 2019

@shanalikhan I'll look into it as soon as I can. I'm just a bit busy at the moment.

@auxves
Copy link
Contributor Author

auxves commented Jun 10, 2019

@shanalikhan I can't reproduce this issue on my machine. I have set up a portable version of VSCode and am debugging the extension with it, and everything works. Both removed and added extensions show up correctly.

@shanalikhan
Copy link
Owner

I can't reproduce this issue on my machine

Can you try to throw manually exception regarding "Unable to remove some extensions". and see what happens in that case. Meanwhile i will test again.

@auxves
Copy link
Contributor Author

auxves commented Jun 10, 2019

@shanalikhan Ok, I think I know what's causing some of these problems.

If an error occurs during the deletion process, deletedExtensions is set to an error that is caught by the try-catch. That error doesn't have a forEach method, so an exception is thrown which prevents the added extensions from being printed.

Can you test this version? It should throw the error so we can find out what's causing the deletion to fail.

https://cdn.discordapp.com/attachments/549007146868539408/587603441908580362/code-settings-sync-3.2.9.vsix

@shanalikhan
Copy link
Owner

If an error occurs during the deletion process, deletedExtensions is set to an error that is caught by the try-catch. That error doesn't have a forEach method, so an exception is thrown which prevents the added extensions from being printed.

Exactly.

i will try on home computer where it was not working properly and let you know.

@shanalikhan
Copy link
Owner

shanalikhan commented Jun 10, 2019

Before testing that one, another thing observed.
Please test this line of code on multiple times.

Missing Extension List is incorrect.

Please test on your end. Create new PR with the things you think we can fix and improve caused by this PR. I will let you know more observationsmeanwhile.

See the image
image

image
image

image

Second Test

Here is the output from the package you have provided.
I have installed one more extension, on download - it should delete that extension but it doesnt.

COMMAND LINE EXTENSION DOWNLOAD SUMMARY
--------------------
Sync : No Extensions needs to be installed.
CODE SETTINGS SYNC DOWNLOAD SUMMARY
Version: 3.2.9
--------------------
GitHub Token: xxx
GitHub Gist: e86911443d3f81be6a66699603aee6dc
GitHub Gist Type: Secret

Restarting Visual Studio Code may be required to apply color and file icon theme.
--------------------
Files Downloaded:
  extensions.json > extensions.json
  keybindings.json > keybindings.json
  launch.json > launch.json
  locale.json > locale.json
  settings.json > settings.json
  snippets|blade.json > snippets|blade.json
  snippets|c.json > snippets|c.json
  snippets|clojure.json > snippets|clojure.json
  snippets|csharp.json > snippets|csharp.json
  snippets|go.json > snippets|go.json
  snippets|html.json > snippets|html.json
  snippets|javascript.json > snippets|javascript.json
  snippets|javascriptreact.json > snippets|javascriptreact.json
  snippets|php.json > snippets|php.json
  snippets|sass.json > snippets|sass.json
  snippets|test.code-snippets > snippets|test.code-snippets

Extensions Ignored:
  No extensions ignored.

Extensions Removed:
  No extensions removed.

Extensions Added:
  No extensions installed.
--------------------
Done.

@auxves
Copy link
Contributor Author

auxves commented Jun 11, 2019

@shanalikhan My new PR (#907) should fix both of these issues. I have tested them and they work just as expected.

@auxves auxves deleted the fix-oss branch June 19, 2019 11:05
@tunnckoCore
Copy link

So, now 3.3.1 is officially released and published, it should work. : )

@shanalikhan
Copy link
Owner

@tunnckoCore Yes Settings Sync supports all OSS versions now.
Let us know if you find any problem.

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

Successfully merging this pull request may close these issues.

5 participants