mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2025-01-06 23:26:25 +03:00
Merge pull request #4606 from atom/ns-use-global-selector-in-config
Use `*` instead of `global` as the global selector in user settings
This commit is contained in:
commit
493035fe4e
@ -599,7 +599,7 @@ describe "Config", ->
|
||||
|
||||
expect(CSON.writeFileSync.argsForCall[0][0]).toBe atom.config.configFilePath
|
||||
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
|
||||
expect(writtenConfig).toEqual global: atom.config.settings
|
||||
expect(writtenConfig).toEqual '*': atom.config.settings
|
||||
|
||||
describe "when ~/.atom/config.json doesn't exist", ->
|
||||
it "writes any non-default properties to ~/.atom/config.cson", ->
|
||||
@ -613,7 +613,7 @@ describe "Config", ->
|
||||
|
||||
expect(CSON.writeFileSync.argsForCall[0][0]).toBe path.join(atom.config.configDirPath, "atom.config.cson")
|
||||
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
|
||||
expect(writtenConfig).toEqual global: atom.config.settings
|
||||
expect(writtenConfig).toEqual '*': atom.config.settings
|
||||
|
||||
describe "when scoped settings are defined", ->
|
||||
it 'writes out explicitly set config settings', ->
|
||||
@ -626,7 +626,7 @@ describe "Config", ->
|
||||
|
||||
writtenConfig = CSON.writeFileSync.argsForCall[0][1]
|
||||
expect(writtenConfig).toEqualJson
|
||||
global:
|
||||
'*':
|
||||
atom.config.settings
|
||||
'.ruby.source':
|
||||
foo:
|
||||
@ -655,7 +655,7 @@ describe "Config", ->
|
||||
describe "when the config file contains scoped settings", ->
|
||||
beforeEach ->
|
||||
fs.writeFileSync atom.config.configFilePath, """
|
||||
global:
|
||||
'*':
|
||||
foo:
|
||||
bar: 'baz'
|
||||
|
||||
@ -752,7 +752,7 @@ describe "Config", ->
|
||||
|
||||
expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
|
||||
fs.writeFileSync atom.config.configFilePath, """
|
||||
global:
|
||||
'*':
|
||||
foo:
|
||||
bar: 'baz'
|
||||
scoped: false
|
||||
@ -817,7 +817,7 @@ describe "Config", ->
|
||||
atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], scopedSpy)
|
||||
|
||||
writeConfigFile """
|
||||
global:
|
||||
'*':
|
||||
foo:
|
||||
scoped: false
|
||||
"""
|
||||
@ -832,7 +832,7 @@ describe "Config", ->
|
||||
atom.config.onDidChange('foo.scoped', scope: ['.source.ruby'], noChangeSpy)
|
||||
|
||||
writeConfigFile """
|
||||
global:
|
||||
'*':
|
||||
foo:
|
||||
bar: 'baz'
|
||||
'.source.ruby':
|
||||
|
@ -837,7 +837,7 @@ class Config
|
||||
console.error detail
|
||||
|
||||
save: ->
|
||||
allSettings = global: @settings
|
||||
allSettings = {'*': @settings}
|
||||
allSettings = _.extend allSettings, @scopedSettingsStore.propertiesForSource(@getUserConfigPath())
|
||||
CSON.writeFileSync(@configFilePath, allSettings)
|
||||
|
||||
@ -852,9 +852,13 @@ class Config
|
||||
return
|
||||
|
||||
if newSettings.global?
|
||||
newSettings['*'] = newSettings.global
|
||||
delete newSettings.global
|
||||
|
||||
if newSettings['*']?
|
||||
scopedSettings = newSettings
|
||||
newSettings = newSettings.global
|
||||
delete scopedSettings.global
|
||||
newSettings = newSettings['*']
|
||||
delete scopedSettings['*']
|
||||
@resetUserScopedSettings(scopedSettings)
|
||||
|
||||
@transact =>
|
||||
|
Loading…
Reference in New Issue
Block a user