macor161 / atom-package-sync

Synchronize your atom packages and settings easily
MIT License
22 stars 5 forks source link

Not Sync Snippets and init.coffee #10

Open jefferyyuan opened 5 years ago

jefferyyuan commented 5 years ago

Update

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

macor161 commented 5 years ago

@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 commented 5 years ago

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?

wvidana commented 4 years ago

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