atom-package-sync icon indicating copy to clipboard operation
atom-package-sync copied to clipboard

Not Sync Snippets and init.coffee

Open jefferyyuan opened this issue 6 years ago • 3 comments

Update

  • Is there an easy way to know whether sync is still ongoing? From the code, seems it will show SYNC_SUCCESS_MESSAGE somewhere when sync is finished.
  • But it would be great if we know sync is still running, so we are not panic : )
  • also seems this doesn't sync disabled packages: maybe it should? or has one option to let the user choose to sync disabled packages or not. Or maybe its because Atom's limit: afer sync, the code can't disable them.

Fresh install Atom in another laptop and use this awesome extension to sync.

It indeed syncs packages and keymap.cson, but it doesn't sync snippets.cson and init.coffee.

Atom    : 1.39.0-beta3
Electron: 3.1.10
Chrome  : 66.0.3359.181
Node    : 10.2.0

Thanks

jefferyyuan avatar Jul 03 '19 15:07 jefferyyuan

@jefferyyuan Thanks for creating this issue.

From the code, seems it will show SYNC_SUCCESS_MESSAGE somewhere when sync is finished Yes, it supposed to display a green popup. It stays there for about 5 seconds.

But it would be great if we know sync is still running, so we are not panic : ) Totally agree, a loading indicator would be pretty useful. I'm going to add a feature request for this.

I will look into the disabled packages, snippets.cson and init.coffee file sync over the weekend to see what's going on.

macor161 avatar Jul 04 '19 02:07 macor161

After having a look at the code, it seems that snippers.cson and init.coffee shoud sync:

            switch(fileName) {
                case 'settings.json':
                    this.applyPackageSettings('', JSON.parse(file.content))
                    break

                case 'keymap.cson':
                    fs.writeFileSync(atom.keymaps.getUserKeymapPath(), file.content)
                    break

                case 'styles.less':
                    fs.writeFileSync(atom.styles.getUserStyleSheetPath(), file.content)
                    break

                case 'init.coffee':
                    fs.writeFileSync(atom.config.configDirPath + "/init.coffee", file.content)
                    break

                case 'snippets.cson':
                    fs.writeFileSync(atom.config.configDirPath + "/snippets.cson", file.content)
                    break

                default: break
            }

Can you post the content of your files?

macor161 avatar Jul 20 '19 02:07 macor161

Not sure if a similar issue, but just did a fresh install and I don't see any synced packages or settings, though I do get the green popup. Looking at the logs i see erros in finding both files snippers.cson and init.coffee

Error reading file undefined/init.coffee. Probably doesn't exist. Error: ENOENT: no such file or directory, open 'undefined/init.coffee'
    at Object.fs.openSync (fs.js:577)
    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:166:20)
    at Object.fs.readFileSync (fs.js:483)
    at Object.fs.readFileSync (ELECTRON_ASAR.js:563)
    at AtomSettingsManager.fileContent (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:261)
    at AtomSettingsManager.getFiles (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:108)
    at AtomSettingsManager.getAtomSettingsChecksum (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:246)
    at AtomSettingsManager.setLastUpdate (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:223)
    at _qlApi.saveAtomSettings.then.result (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-package-sync.js:286)
fileContent @ /Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:264
/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:264
Error reading file undefined/snippets.cson. Probably doesn't exist. Error: ENOENT: no such file or directory, open 'undefined/snippets.cson'
    at Object.fs.openSync (fs.js:577)
    at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:166:20)
    at Object.fs.readFileSync (fs.js:483)
    at Object.fs.readFileSync (ELECTRON_ASAR.js:563)
    at AtomSettingsManager.fileContent (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:261)
    at AtomSettingsManager.getFiles (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:109)
    at AtomSettingsManager.getAtomSettingsChecksum (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:246)
    at AtomSettingsManager.setLastUpdate (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:223)
    at _qlApi.saveAtomSettings.then.result (/Users/t2207741/.atom/packages/atom-package-sync/lib/atom-package-sync.js:286)

Both errors on /Users/t2207741/.atom/packages/atom-package-sync/lib/atom-settings-manager.js:264, which is https://github.com/macor161/atom-package-sync/blob/master/lib/atom-settings-manager.js#L264

NOTE

This computer is behind a proxy which already had some issues with installing packages through the GUI, only worked with apm after manually adding some proxy settings

NOTE2

My snippets.cson and init.coffee files do exists, though both are just comment lines

wvidana avatar Oct 03 '19 22:10 wvidana