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

Sync Pragmas not working as expected #1003

Closed
comicchang opened this issue Aug 14, 2019 · 5 comments
Closed

Sync Pragmas not working as expected #1003

comicchang opened this issue Aug 14, 2019 · 5 comments

Comments

@comicchang
Copy link

comicchang commented Aug 14, 2019

🐛 Describe the bug
Sync Pragmas not working as expected, some of the // @sync lines are mistakenly un-commented when uploading, and this may also affect the downloading process.

🌴 Visual Studio Code Version : [ 1.37.0 ]
🌴 Code Settings Sync Version : [ 3.4.1 ]
🌴 Standard or Insiders : [ Standard ]
🌴 Portable or Installed : [ Installed ]
🌴 OSS or Official Build : [ Official ]
🌴 Operating System : [ archlinux ]
🌴 Occurs On: [Upload / Download ]
🌴 Proxy Enabled: [ Yes ]
🌴 Gist Id: [ 9b1c41c641e03f6e3f266f43fc3acea6 ]

📰 To Reproduce
Steps to reproduce the behavior:

  1. Go to settings, and add to local settings.json
    // @sync host=cc-mbp os=mac
    // "vim.autoSwitchInputMethod.enable": true,
    // @sync host=cc-mbp os=mac
    // "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
    // @sync host=cc-mbp os=mac
    // "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
    // @sync host=cc-mbp os=mac
    // "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
    // @sync os=linux
    "vim.autoSwitchInputMethod.enable": true,
    // @sync os=linux
    "vim.autoSwitchInputMethod.defaultIM": "1",
    // @sync os=linux
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/fcitx-remote",
    // @sync os=linux
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/fcitx-remote -t {im}",
  1. Upload
  2. Check on gist.github.com
  3. Download on another machine

💪 Expected behavior
expected uploaded gist

    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.enable": true,
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
    // @sync os=linux
    "vim.autoSwitchInputMethod.enable": true,
    // @sync os=linux
    "vim.autoSwitchInputMethod.defaultIM": "1",
    // @sync os=linux
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/fcitx-remote",
    // @sync os=linux
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/fcitx-remote -t {im}",

actually gist uploaded

    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.enable": true,
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
    @sync os=linux
    "vim.autoSwitchInputMethod.enable": true,
    @sync os=linux
    "vim.autoSwitchInputMethod.defaultIM": "1",
    @sync os=linux
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/fcitx-remote",
    @sync os=linux
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/fcitx-remote -t {im}",

and when another machine downloading the config (host=cc-mbp os=mac), it will get

    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.enable": true,
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.defaultIM": "com.apple.keylayout.ABC",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/local/bin/im-select",
    // @sync host=cc-mbp os=mac
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/local/bin/im-select {im}",
    @sync os=linux
    "vim.autoSwitchInputMethod.enable": true,
    @sync os=linux
    "vim.autoSwitchInputMethod.defaultIM": "1",
    @sync os=linux
    "vim.autoSwitchInputMethod.obtainIMCmd": "/usr/bin/fcitx-remote",
    @sync os=linux
    "vim.autoSwitchInputMethod.switchIMCmd": "/usr/bin/fcitx-remote -t {im}",

📺 Console Error Log
nothing related

📺 Additional context

@shanalikhan
Copy link
Owner

@protium-dev can assist us on it :)

@protiumx
Copy link
Contributor

The problem seems to come from after this line "/usr/local/bin/im-select {im}". Since the extension looks up for open brackets or curly braces for multiline configs.
This is the exact line in the source pragmaUtil.ts#L267

It should use the same regex as in pragmaUtil.ts#L268

I'll drop a PR as soon as I can

@shanalikhan
Copy link
Owner

shanalikhan commented Aug 19, 2019

It should use the same regex as in pragmaUtil.ts#L268. I'll drop a PR as soon as I can

@protium-dev Nice catch.

Can we release your PR in the new version coming in this week?

@protiumx protiumx mentioned this issue Aug 19, 2019
shanalikhan pushed a commit that referenced this issue Aug 20, 2019
Also fix errors with settings containing backslashes.
@shanalikhan shanalikhan added this to the v3.4.2 milestone Aug 20, 2019
@shanalikhan
Copy link
Owner

@comicchang
Its fixed and released in new version.

let me know if you are having some problem.

shanalikhan added a commit that referenced this issue Aug 22, 2019
* Fix korean

* Fix: Ambiguous Expression and Korean naturally

* Missing keys

* Change `Sync :` to `Sync:`

* dev.to post updated

* #989

* Update package.nls.ko.json

fixing some wrong translate.

* Update ko-lang

Although translated, it some case may not be accurate.

* Fix GitHub spelling

* chore(package): update @types/chai to version 4.2.0

* Update french translation file

* Correcting the german translation

Checking the translation based on the package.nls.json file
Correcting the grammar for the german translation

* Correcting typos

Correcting spelling mistakes and typos

* Correcting spelling mistakes

Correcting more spelling mistakes

* #974

* #977
#989

* #1003 (#1012)

Also fix errors with settings containing backslashes.

* #983

* #1008
@comicchang
Copy link
Author

thanks, the new version works great.

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

3 participants