diff --git a/spec/atom-spec.coffee b/spec/atom-spec.coffee
index 82795d3b9..e00bb024a 100644
--- a/spec/atom-spec.coffee
+++ b/spec/atom-spec.coffee
@@ -22,11 +22,11 @@ describe "the `atom` global", ->
it "continues if the package has an invalid package.json", ->
spyOn(console, 'warn')
- config.set("core.disabledPackages", [])
+ atom.config.set("core.disabledPackages", [])
expect(-> atom.loadPackage("package-with-broken-package-json")).not.toThrow()
it "continues if the package has an invalid keymap", ->
- config.set("core.disabledPackages", [])
+ atom.config.set("core.disabledPackages", [])
expect(-> atom.loadPackage("package-with-broken-keymap")).not.toThrow()
describe ".unloadPackage(name)", ->
@@ -72,10 +72,10 @@ describe "the `atom` global", ->
expect(pack.mainModule).toBe indexModule
it "assigns config defaults from the module", ->
- expect(config.get('package-with-config-defaults.numbers.one')).toBeUndefined()
+ expect(atom.config.get('package-with-config-defaults.numbers.one')).toBeUndefined()
atom.activatePackage('package-with-config-defaults')
- expect(config.get('package-with-config-defaults.numbers.one')).toBe 1
- expect(config.get('package-with-config-defaults.numbers.two')).toBe 2
+ expect(atom.config.get('package-with-config-defaults.numbers.one')).toBe 1
+ expect(atom.config.get('package-with-config-defaults.numbers.two')).toBe 2
describe "when the package metadata includes activation events", ->
[mainModule, pack] = []
@@ -125,7 +125,7 @@ describe "the `atom` global", ->
expect(pack.mainModule.activate).toHaveBeenCalledWith({someNumber: 77})
it "logs warning instead of throwing an exception if the package fails to load", ->
- config.set("core.disabledPackages", [])
+ atom.config.set("core.disabledPackages", [])
spyOn(console, "warn")
expect(-> atom.activatePackage("package-that-throws-an-exception")).not.toThrow()
expect(console.warn).toHaveBeenCalled()
@@ -387,7 +387,7 @@ describe "the `atom` global", ->
packageName = 'package-with-main'
atom.config.pushAtKeyPath('core.disabledPackages', packageName)
atom.packages.observeDisabledPackages()
- expect(config.get('core.disabledPackages')).toContain packageName
+ expect(atom.config.get('core.disabledPackages')).toContain packageName
pack = atom.packages.enablePackage(packageName)
@@ -395,19 +395,19 @@ describe "the `atom` global", ->
activatedPackages = atom.packages.getActivePackages()
expect(loadedPackages).toContain(pack)
expect(activatedPackages).toContain(pack)
- expect(config.get('core.disabledPackages')).not.toContain packageName
+ expect(atom.config.get('core.disabledPackages')).not.toContain packageName
it ".disablePackage() disables an enabled package", ->
packageName = 'package-with-main'
atom.packages.activatePackage(packageName)
atom.packages.observeDisabledPackages()
- expect(config.get('core.disabledPackages')).not.toContain packageName
+ expect(atom.config.get('core.disabledPackages')).not.toContain packageName
pack = atom.packages.disablePackage(packageName)
activatedPackages = atom.packages.getActivePackages()
expect(activatedPackages).not.toContain(pack)
- expect(config.get('core.disabledPackages')).toContain packageName
+ expect(atom.config.get('core.disabledPackages')).toContain packageName
describe "with themes", ->
beforeEach ->
@@ -420,20 +420,20 @@ describe "the `atom` global", ->
it ".enablePackage() and .disablePackage() enables and disables a theme", ->
packageName = 'theme-with-package-file'
- expect(config.get('core.themes')).not.toContain packageName
- expect(config.get('core.disabledPackages')).not.toContain packageName
+ expect(atom.config.get('core.themes')).not.toContain packageName
+ expect(atom.config.get('core.disabledPackages')).not.toContain packageName
# enabling of theme
pack = atom.packages.enablePackage(packageName)
activatedPackages = atom.packages.getActivePackages()
expect(activatedPackages).toContain(pack)
- expect(config.get('core.themes')).toContain packageName
- expect(config.get('core.disabledPackages')).not.toContain packageName
+ expect(atom.config.get('core.themes')).toContain packageName
+ expect(atom.config.get('core.disabledPackages')).not.toContain packageName
# disabling of theme
pack = atom.packages.disablePackage(packageName)
activatedPackages = atom.packages.getActivePackages()
expect(activatedPackages).not.toContain(pack)
- expect(config.get('core.themes')).not.toContain packageName
- expect(config.get('core.themes')).not.toContain packageName
- expect(config.get('core.disabledPackages')).not.toContain packageName
+ expect(atom.config.get('core.themes')).not.toContain packageName
+ expect(atom.config.get('core.themes')).not.toContain packageName
+ expect(atom.config.get('core.disabledPackages')).not.toContain packageName
diff --git a/spec/config-spec.coffee b/spec/config-spec.coffee
index ca25dceff..6eb5d2eb3 100644
--- a/spec/config-spec.coffee
+++ b/spec/config-spec.coffee
@@ -8,104 +8,104 @@ describe "Config", ->
describe ".get(keyPath)", ->
it "allows a key path's value to be read", ->
- expect(config.set("foo.bar.baz", 42)).toBe 42
- expect(config.get("foo.bar.baz")).toBe 42
- expect(config.get("bogus.key.path")).toBeUndefined()
+ expect(atom.config.set("foo.bar.baz", 42)).toBe 42
+ expect(atom.config.get("foo.bar.baz")).toBe 42
+ expect(atom.config.get("bogus.key.path")).toBeUndefined()
it "returns a deep clone of the key path's value", ->
- config.set('value', array: [1, b: 2, 3])
- retrievedValue = config.get('value')
+ atom.config.set('value', array: [1, b: 2, 3])
+ retrievedValue = atom.config.get('value')
retrievedValue.array[0] = 4
retrievedValue.array[1].b = 2.1
- expect(config.get('value')).toEqual(array: [1, b: 2, 3])
+ expect(atom.config.get('value')).toEqual(array: [1, b: 2, 3])
describe ".set(keyPath, value)", ->
it "allows a key path's value to be written", ->
- expect(config.set("foo.bar.baz", 42)).toBe 42
- expect(config.get("foo.bar.baz")).toBe 42
+ expect(atom.config.set("foo.bar.baz", 42)).toBe 42
+ expect(atom.config.get("foo.bar.baz")).toBe 42
it "updates observers and saves when a key path is set", ->
observeHandler = jasmine.createSpy "observeHandler"
- config.observe "foo.bar.baz", observeHandler
+ atom.config.observe "foo.bar.baz", observeHandler
observeHandler.reset()
- config.set("foo.bar.baz", 42)
+ atom.config.set("foo.bar.baz", 42)
- expect(config.save).toHaveBeenCalled()
+ expect(atom.config.save).toHaveBeenCalled()
expect(observeHandler).toHaveBeenCalledWith 42, {previous: undefined}
describe "when the value equals the default value", ->
it "does not store the value", ->
- config.setDefaults("foo", same: 1, changes: 1)
- expect(config.settings.foo).toBeUndefined()
- config.set('foo.same', 1)
- config.set('foo.changes', 2)
- expect(config.settings.foo).toEqual {changes: 2}
+ atom.config.setDefaults("foo", same: 1, changes: 1)
+ expect(atom.config.settings.foo).toBeUndefined()
+ atom.config.set('foo.same', 1)
+ atom.config.set('foo.changes', 2)
+ expect(atom.config.settings.foo).toEqual {changes: 2}
- config.set('foo.changes', 1)
- expect(config.settings.foo).toEqual {}
+ atom.config.set('foo.changes', 1)
+ expect(atom.config.settings.foo).toEqual {}
describe ".toggle(keyPath)", ->
it "negates the boolean value of the current key path value", ->
- config.set('foo.a', 1)
- config.toggle('foo.a')
- expect(config.get('foo.a')).toBe false
+ atom.config.set('foo.a', 1)
+ atom.config.toggle('foo.a')
+ expect(atom.config.get('foo.a')).toBe false
- config.set('foo.a', '')
- config.toggle('foo.a')
- expect(config.get('foo.a')).toBe true
+ atom.config.set('foo.a', '')
+ atom.config.toggle('foo.a')
+ expect(atom.config.get('foo.a')).toBe true
- config.set('foo.a', null)
- config.toggle('foo.a')
- expect(config.get('foo.a')).toBe true
+ atom.config.set('foo.a', null)
+ atom.config.toggle('foo.a')
+ expect(atom.config.get('foo.a')).toBe true
- config.set('foo.a', true)
- config.toggle('foo.a')
- expect(config.get('foo.a')).toBe false
+ atom.config.set('foo.a', true)
+ atom.config.toggle('foo.a')
+ expect(atom.config.get('foo.a')).toBe false
describe ".pushAtKeyPath(keyPath, value)", ->
it "pushes the given value to the array at the key path and updates observers", ->
- config.set("foo.bar.baz", ["a"])
+ atom.config.set("foo.bar.baz", ["a"])
observeHandler = jasmine.createSpy "observeHandler"
- config.observe "foo.bar.baz", observeHandler
+ atom.config.observe "foo.bar.baz", observeHandler
observeHandler.reset()
- expect(config.pushAtKeyPath("foo.bar.baz", "b")).toBe 2
- expect(config.get("foo.bar.baz")).toEqual ["a", "b"]
- expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz"), {previous: ['a']}
+ expect(atom.config.pushAtKeyPath("foo.bar.baz", "b")).toBe 2
+ expect(atom.config.get("foo.bar.baz")).toEqual ["a", "b"]
+ expect(observeHandler).toHaveBeenCalledWith atom.config.get("foo.bar.baz"), {previous: ['a']}
describe ".unshiftAtKeyPath(keyPath, value)", ->
it "unshifts the given value to the array at the key path and updates observers", ->
- config.set("foo.bar.baz", ["b"])
+ atom.config.set("foo.bar.baz", ["b"])
observeHandler = jasmine.createSpy "observeHandler"
- config.observe "foo.bar.baz", observeHandler
+ atom.config.observe "foo.bar.baz", observeHandler
observeHandler.reset()
- expect(config.unshiftAtKeyPath("foo.bar.baz", "a")).toBe 2
- expect(config.get("foo.bar.baz")).toEqual ["a", "b"]
- expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz"), {previous: ['b']}
+ expect(atom.config.unshiftAtKeyPath("foo.bar.baz", "a")).toBe 2
+ expect(atom.config.get("foo.bar.baz")).toEqual ["a", "b"]
+ expect(observeHandler).toHaveBeenCalledWith atom.config.get("foo.bar.baz"), {previous: ['b']}
describe ".removeAtKeyPath(keyPath, value)", ->
it "removes the given value from the array at the key path and updates observers", ->
- config.set("foo.bar.baz", ["a", "b", "c"])
+ atom.config.set("foo.bar.baz", ["a", "b", "c"])
observeHandler = jasmine.createSpy "observeHandler"
- config.observe "foo.bar.baz", observeHandler
+ atom.config.observe "foo.bar.baz", observeHandler
observeHandler.reset()
- expect(config.removeAtKeyPath("foo.bar.baz", "b")).toEqual ["a", "c"]
- expect(config.get("foo.bar.baz")).toEqual ["a", "c"]
- expect(observeHandler).toHaveBeenCalledWith config.get("foo.bar.baz"), {previous: ['a', 'b', 'c']}
+ expect(atom.config.removeAtKeyPath("foo.bar.baz", "b")).toEqual ["a", "c"]
+ expect(atom.config.get("foo.bar.baz")).toEqual ["a", "c"]
+ expect(observeHandler).toHaveBeenCalledWith atom.config.get("foo.bar.baz"), {previous: ['a', 'b', 'c']}
describe ".getPositiveInt(keyPath, defaultValue)", ->
it "returns the proper current or default value", ->
- config.set('editor.preferredLineLength', 0)
- expect(config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
- config.set('editor.preferredLineLength', -1234)
- expect(config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
- config.set('editor.preferredLineLength', 'abcd')
- expect(config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
- config.set('editor.preferredLineLength', null)
- expect(config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
+ atom.config.set('editor.preferredLineLength', 0)
+ expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
+ atom.config.set('editor.preferredLineLength', -1234)
+ expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
+ atom.config.set('editor.preferredLineLength', 'abcd')
+ expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
+ atom.config.set('editor.preferredLineLength', null)
+ expect(atom.config.getPositiveInt('editor.preferredLineLength', 80)).toBe 80
describe ".save()", ->
nodeFs = require 'fs'
@@ -116,86 +116,86 @@ describe "Config", ->
describe "when ~/.atom/config.json exists", ->
it "writes any non-default properties to ~/.atom/config.json", ->
- config.configFilePath = path.join(config.configDirPath, "config.json")
- config.set("a.b.c", 1)
- config.set("a.b.d", 2)
- config.set("x.y.z", 3)
- config.setDefaults("a.b", e: 4, f: 5)
+ atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.json")
+ atom.config.set("a.b.c", 1)
+ atom.config.set("a.b.d", 2)
+ atom.config.set("x.y.z", 3)
+ atom.config.setDefaults("a.b", e: 4, f: 5)
nodeFs.writeFileSync.reset()
- config.save()
+ atom.config.save()
- expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.json"))
+ expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.json"))
writtenConfig = JSON.parse(nodeFs.writeFileSync.argsForCall[0][1])
- expect(writtenConfig).toEqual 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", ->
- config.configFilePath = path.join(config.configDirPath, "config.cson")
- config.set("a.b.c", 1)
- config.set("a.b.d", 2)
- config.set("x.y.z", 3)
- config.setDefaults("a.b", e: 4, f: 5)
+ atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
+ atom.config.set("a.b.c", 1)
+ atom.config.set("a.b.d", 2)
+ atom.config.set("x.y.z", 3)
+ atom.config.setDefaults("a.b", e: 4, f: 5)
nodeFs.writeFileSync.reset()
- config.save()
+ atom.config.save()
- expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(config.configDirPath, "config.cson"))
+ expect(nodeFs.writeFileSync.argsForCall[0][0]).toBe(path.join(atom.config.configDirPath, "atom.config.cson"))
CoffeeScript = require 'coffee-script'
writtenConfig = CoffeeScript.eval(nodeFs.writeFileSync.argsForCall[0][1], bare: true)
- expect(writtenConfig).toEqual config.settings
+ expect(writtenConfig).toEqual atom.config.settings
describe ".setDefaults(keyPath, defaults)", ->
it "assigns any previously-unassigned keys to the object at the key path", ->
- config.set("foo.bar.baz", a: 1)
- config.setDefaults("foo.bar.baz", a: 2, b: 3, c: 4)
- expect(config.get("foo.bar.baz.a")).toBe 1
- expect(config.get("foo.bar.baz.b")).toBe 3
- expect(config.get("foo.bar.baz.c")).toBe 4
+ atom.config.set("foo.bar.baz", a: 1)
+ atom.config.setDefaults("foo.bar.baz", a: 2, b: 3, c: 4)
+ expect(atom.config.get("foo.bar.baz.a")).toBe 1
+ expect(atom.config.get("foo.bar.baz.b")).toBe 3
+ expect(atom.config.get("foo.bar.baz.c")).toBe 4
- config.setDefaults("foo.quux", x: 0, y: 1)
- expect(config.get("foo.quux.x")).toBe 0
- expect(config.get("foo.quux.y")).toBe 1
+ atom.config.setDefaults("foo.quux", x: 0, y: 1)
+ expect(atom.config.get("foo.quux.x")).toBe 0
+ expect(atom.config.get("foo.quux.y")).toBe 1
describe ".observe(keyPath)", ->
observeHandler = null
beforeEach ->
observeHandler = jasmine.createSpy("observeHandler")
- config.set("foo.bar.baz", "value 1")
- config.observe "foo.bar.baz", observeHandler
+ atom.config.set("foo.bar.baz", "value 1")
+ atom.config.observe "foo.bar.baz", observeHandler
it "fires the given callback with the current value at the keypath", ->
expect(observeHandler).toHaveBeenCalledWith("value 1")
it "fires the callback every time the observed value changes", ->
observeHandler.reset() # clear the initial call
- config.set('foo.bar.baz', "value 2")
+ atom.config.set('foo.bar.baz', "value 2")
expect(observeHandler).toHaveBeenCalledWith("value 2", {previous: 'value 1'})
observeHandler.reset()
- config.set('foo.bar.baz', "value 1")
+ atom.config.set('foo.bar.baz', "value 1")
expect(observeHandler).toHaveBeenCalledWith("value 1", {previous: 'value 2'})
it "fires the callback when the observed value is deleted", ->
observeHandler.reset() # clear the initial call
- config.set('foo.bar.baz', undefined)
+ atom.config.set('foo.bar.baz', undefined)
expect(observeHandler).toHaveBeenCalledWith(undefined, {previous: 'value 1'})
it "fires the callback when the full key path goes into and out of existence", ->
observeHandler.reset() # clear the initial call
- config.set("foo.bar", undefined)
+ atom.config.set("foo.bar", undefined)
expect(observeHandler).toHaveBeenCalledWith(undefined, {previous: 'value 1'})
observeHandler.reset()
- config.set("foo.bar.baz", "i'm back")
+ atom.config.set("foo.bar.baz", "i'm back")
expect(observeHandler).toHaveBeenCalledWith("i'm back", {previous: undefined})
describe ".initializeConfigDirectory()", ->
beforeEach ->
- config.configDirPath = dotAtomPath
- expect(fs.existsSync(config.configDirPath)).toBeFalsy()
+ atom.config.configDirPath = dotAtomPath
+ expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
afterEach ->
fs.removeSync(dotAtomPath) if fs.existsSync(dotAtomPath)
@@ -204,94 +204,94 @@ describe "Config", ->
it "copies the contents of dot-atom to ~/.atom", ->
initializationDone = false
jasmine.unspy(window, "setTimeout")
- config.initializeConfigDirectory ->
+ atom.config.initializeConfigDirectory ->
initializationDone = true
waitsFor -> initializationDone
runs ->
- expect(fs.existsSync(config.configDirPath)).toBeTruthy()
- expect(fs.existsSync(path.join(config.configDirPath, 'packages'))).toBeTruthy()
- expect(fs.existsSync(path.join(config.configDirPath, 'snippets'))).toBeTruthy()
- expect(fs.isFileSync(path.join(config.configDirPath, 'config.cson'))).toBeTruthy()
+ expect(fs.existsSync(atom.config.configDirPath)).toBeTruthy()
+ expect(fs.existsSync(path.join(atom.config.configDirPath, 'packages'))).toBeTruthy()
+ expect(fs.existsSync(path.join(atom.config.configDirPath, 'snippets'))).toBeTruthy()
+ expect(fs.isFileSync(path.join(atom.config.configDirPath, 'atom.config.cson'))).toBeTruthy()
describe ".loadUserConfig()", ->
beforeEach ->
- config.configDirPath = dotAtomPath
- config.configFilePath = path.join(config.configDirPath, "config.cson")
- expect(fs.existsSync(config.configDirPath)).toBeFalsy()
+ atom.config.configDirPath = dotAtomPath
+ atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
+ expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
afterEach ->
fs.removeSync(dotAtomPath) if fs.existsSync(dotAtomPath)
describe "when the config file contains valid cson", ->
beforeEach ->
- fs.writeFileSync(config.configFilePath, "foo: bar: 'baz'")
- config.loadUserConfig()
+ fs.writeFileSync(atom.config.configFilePath, "foo: bar: 'baz'")
+ atom.config.loadUserConfig()
it "updates the config data based on the file contents", ->
- expect(config.get("foo.bar")).toBe 'baz'
+ expect(atom.config.get("foo.bar")).toBe 'baz'
describe "when the config file contains invalid cson", ->
beforeEach ->
spyOn(console, 'error')
- fs.writeFileSync(config.configFilePath, "{{{{{")
+ fs.writeFileSync(atom.config.configFilePath, "{{{{{")
it "logs an error to the console and does not overwrite the config file on a subsequent save", ->
- config.loadUserConfig()
+ atom.config.loadUserConfig()
expect(console.error).toHaveBeenCalled()
- config.set("hair", "blonde") # trigger a save
- expect(config.save).not.toHaveBeenCalled()
+ atom.config.set("hair", "blonde") # trigger a save
+ expect(atom.config.save).not.toHaveBeenCalled()
describe "when the config file does not exist", ->
it "creates it with an empty object", ->
- fs.makeTreeSync(config.configDirPath)
- config.loadUserConfig()
- expect(fs.existsSync(config.configFilePath)).toBe true
- expect(CSON.readFileSync(config.configFilePath)).toEqual {}
+ fs.makeTreeSync(atom.config.configDirPath)
+ atom.config.loadUserConfig()
+ expect(fs.existsSync(atom.config.configFilePath)).toBe true
+ expect(CSON.readFileSync(atom.config.configFilePath)).toEqual {}
describe ".observeUserConfig()", ->
updatedHandler = null
beforeEach ->
- config.configDirPath = dotAtomPath
- config.configFilePath = path.join(config.configDirPath, "config.cson")
- expect(fs.existsSync(config.configDirPath)).toBeFalsy()
- fs.writeFileSync(config.configFilePath, "foo: bar: 'baz'")
- config.loadUserConfig()
- config.observeUserConfig()
+ atom.config.configDirPath = dotAtomPath
+ atom.config.configFilePath = path.join(atom.config.configDirPath, "atom.config.cson")
+ expect(fs.existsSync(atom.config.configDirPath)).toBeFalsy()
+ fs.writeFileSync(atom.config.configFilePath, "foo: bar: 'baz'")
+ atom.config.loadUserConfig()
+ atom.config.observeUserConfig()
updatedHandler = jasmine.createSpy("updatedHandler")
- config.on 'updated', updatedHandler
+ atom.config.on 'updated', updatedHandler
afterEach ->
- config.unobserveUserConfig()
+ atom.config.unobserveUserConfig()
fs.removeSync(dotAtomPath) if fs.existsSync(dotAtomPath)
describe "when the config file changes to contain valid cson", ->
it "updates the config data", ->
- fs.writeFileSync(config.configFilePath, "foo: { bar: 'quux', baz: 'bar'}")
+ fs.writeFileSync(atom.config.configFilePath, "foo: { bar: 'quux', baz: 'bar'}")
waitsFor 'update event', -> updatedHandler.callCount > 0
runs ->
- expect(config.get('foo.bar')).toBe 'quux'
- expect(config.get('foo.baz')).toBe 'bar'
+ expect(atom.config.get('foo.bar')).toBe 'quux'
+ expect(atom.config.get('foo.baz')).toBe 'bar'
describe "when the config file changes to contain invalid cson", ->
beforeEach ->
spyOn(console, 'error')
- fs.writeFileSync(config.configFilePath, "}}}")
+ fs.writeFileSync(atom.config.configFilePath, "}}}")
waitsFor "error to be logged", -> console.error.callCount > 0
it "logs a warning and does not update config data", ->
expect(updatedHandler.callCount).toBe 0
- expect(config.get('foo.bar')).toBe 'baz'
- config.set("hair", "blonde") # trigger a save
- expect(config.save).not.toHaveBeenCalled()
+ expect(atom.config.get('foo.bar')).toBe 'baz'
+ atom.config.set("hair", "blonde") # trigger a save
+ expect(atom.config.save).not.toHaveBeenCalled()
describe "when the config file subsequently changes again to contain valid cson", ->
beforeEach ->
- fs.writeFileSync(config.configFilePath, "foo: bar: 'baz'")
+ fs.writeFileSync(atom.config.configFilePath, "foo: bar: 'baz'")
waitsFor 'update event', -> updatedHandler.callCount > 0
it "updates the config data and resumes saving", ->
- config.set("hair", "blonde")
- expect(config.save).toHaveBeenCalled()
+ atom.config.set("hair", "blonde")
+ expect(atom.config.save).toHaveBeenCalled()
diff --git a/spec/display-buffer-spec.coffee b/spec/display-buffer-spec.coffee
index d2d18e646..d877639ce 100644
--- a/spec/display-buffer-spec.coffee
+++ b/spec/display-buffer-spec.coffee
@@ -66,14 +66,14 @@ describe "DisplayBuffer", ->
describe "rendering of soft-wrapped lines", ->
describe "when editor.softWrapAtPreferredLineLength is set", ->
it "uses the preferred line length as the soft wrap column when it is less than the configured soft wrap column", ->
- config.set('editor.preferredLineLength', 100)
- config.set('editor.softWrapAtPreferredLineLength', true)
+ atom.config.set('editor.preferredLineLength', 100)
+ atom.config.set('editor.softWrapAtPreferredLineLength', true)
expect(displayBuffer.lineForRow(10).text).toBe ' return '
- config.set('editor.preferredLineLength', 5)
+ atom.config.set('editor.preferredLineLength', 5)
expect(displayBuffer.lineForRow(10).text).toBe 'funct'
- config.set('editor.softWrapAtPreferredLineLength', false)
+ atom.config.set('editor.softWrapAtPreferredLineLength', false)
expect(displayBuffer.lineForRow(10).text).toBe ' return '
describe "when the line is shorter than the max line length", ->
diff --git a/spec/edit-session-spec.coffee b/spec/edit-session-spec.coffee
index 03ebbf406..cd2f50430 100644
--- a/spec/edit-session-spec.coffee
+++ b/spec/edit-session-spec.coffee
@@ -57,17 +57,17 @@ describe "EditSession", ->
describe "config defaults", ->
it "uses the `editor.tabLength`, `editor.softWrap`, and `editor.softTabs` config values", ->
- config.set('editor.tabLength', 4)
- config.set('editor.softWrap', true)
- config.set('editor.softTabs', false)
+ atom.config.set('editor.tabLength', 4)
+ atom.config.set('editor.softWrap', true)
+ atom.config.set('editor.softTabs', false)
editSession1 = project.openSync('a')
expect(editSession1.getTabLength()).toBe 4
expect(editSession1.getSoftWrap()).toBe true
expect(editSession1.getSoftTabs()).toBe false
- config.set('editor.tabLength', 100)
- config.set('editor.softWrap', false)
- config.set('editor.softTabs', true)
+ atom.config.set('editor.tabLength', 100)
+ atom.config.set('editor.softWrap', false)
+ atom.config.set('editor.softTabs', true)
editSession2 = project.openSync('b')
expect(editSession2.getTabLength()).toBe 100
expect(editSession2.getSoftWrap()).toBe false
@@ -1335,7 +1335,7 @@ describe "EditSession", ->
expect(editSession.getCursorBufferPosition()).toEqual [0,2]
it "inserts a newline below the cursor's current line, autoindents it, and moves the cursor to the end of the line", ->
- config.set("editor.autoIndent", true)
+ atom.config.set("editor.autoIndent", true)
editSession.insertNewlineBelow()
expect(buffer.lineForRow(0)).toBe "var quicksort = function () {"
expect(buffer.lineForRow(1)).toBe " "
@@ -2419,13 +2419,13 @@ describe "EditSession", ->
editSession.insertText("\n ")
expect(editSession.lineForBufferRow(2)).toBe " "
- config.set("editor.autoIndent", false)
+ atom.config.set("editor.autoIndent", false)
editSession.indent()
expect(editSession.lineForBufferRow(2)).toBe " "
describe "when editor.autoIndent is true", ->
beforeEach ->
- config.set("editor.autoIndent", true)
+ atom.config.set("editor.autoIndent", true)
describe "when `indent` is triggered", ->
it "auto-indents the line", ->
@@ -2433,7 +2433,7 @@ describe "EditSession", ->
editSession.insertText("\n ")
expect(editSession.lineForBufferRow(2)).toBe " "
- config.set("editor.autoIndent", true)
+ atom.config.set("editor.autoIndent", true)
editSession.indent()
expect(editSession.lineForBufferRow(2)).toBe " "
@@ -2463,7 +2463,7 @@ describe "EditSession", ->
editSession.insertText(' var this-line-should-be-indented-more\n')
expect(editSession.indentationForBufferRow(1)).toBe 1
- config.set("editor.autoIndent", true)
+ atom.config.set("editor.autoIndent", true)
editSession.setCursorBufferPosition([2, Infinity])
editSession.insertText('\n')
expect(editSession.indentationForBufferRow(1)).toBe 1
@@ -2508,11 +2508,11 @@ describe "EditSession", ->
describe "editor.normalizeIndentOnPaste", ->
beforeEach ->
- config.set('editor.normalizeIndentOnPaste', true)
+ atom.config.set('editor.normalizeIndentOnPaste', true)
it "does not normalize the indentation level of the text when editor.normalizeIndentOnPaste is false", ->
copyText(" function() {\nvar cool = 1;\n }\n")
- config.set('editor.normalizeIndentOnPaste', false)
+ atom.config.set('editor.normalizeIndentOnPaste', false)
editSession.setCursorBufferPosition([5, 2])
editSession.pasteText()
expect(editSession.lineForBufferRow(5)).toBe " function() {"
diff --git a/spec/editor-spec.coffee b/spec/editor-spec.coffee
index 35bdea5fa..a765d15e5 100644
--- a/spec/editor-spec.coffee
+++ b/spec/editor-spec.coffee
@@ -310,7 +310,7 @@ describe "Editor", ->
charWidthBefore = editor.charWidth
editor.setCursorScreenPosition [5, 6]
- config.set("editor.fontFamily", fontFamily)
+ atom.config.set("editor.fontFamily", fontFamily)
expect(editor.css('font-family')).toBe fontFamily
expect(editor.charWidth).not.toBe charWidthBefore
expect(editor.getCursorView().position()).toEqual { top: 5 * editor.lineHeight, left: 6 * editor.charWidth }
@@ -325,17 +325,17 @@ describe "Editor", ->
expect(editor.css('font-size')).not.toBe "10px"
it "sets the initial font size based on the value from config", ->
- expect(editor.css('font-size')).toBe "#{config.get('editor.fontSize')}px"
+ expect(editor.css('font-size')).toBe "#{atom.config.get('editor.fontSize')}px"
describe "when the font size changes", ->
it "updates the font sizes of editors and recalculates dimensions critical to cursor positioning", ->
- config.set("editor.fontSize", 10)
+ atom.config.set("editor.fontSize", 10)
editor.attachToDom()
lineHeightBefore = editor.lineHeight
charWidthBefore = editor.charWidth
editor.setCursorScreenPosition [5, 6]
- config.set("editor.fontSize", 30)
+ atom.config.set("editor.fontSize", 30)
expect(editor.css('font-size')).toBe '30px'
expect(editor.lineHeight).toBeGreaterThan lineHeightBefore
expect(editor.charWidth).toBeGreaterThan charWidthBefore
@@ -349,11 +349,11 @@ describe "Editor", ->
expect(newEditor.css('font-size')).toBe '30px'
it "updates the position and size of selection regions", ->
- config.set("editor.fontSize", 10)
+ atom.config.set("editor.fontSize", 10)
editor.setSelectedBufferRange([[5, 2], [5, 7]])
editor.attachToDom()
- config.set("editor.fontSize", 30)
+ atom.config.set("editor.fontSize", 30)
selectionRegion = editor.find('.region')
expect(selectionRegion.position().top).toBe 5 * editor.lineHeight
expect(selectionRegion.position().left).toBe 2 * editor.charWidth
@@ -365,7 +365,7 @@ describe "Editor", ->
originalLineCount = editor.renderedLines.find(".line").length
expect(originalLineCount).toBeGreaterThan 0
- config.set("editor.fontSize", 10)
+ atom.config.set("editor.fontSize", 10)
expect(editor.renderedLines.find(".line").length).toBeGreaterThan originalLineCount
describe "when the font size changes while editor is detached", ->
@@ -378,7 +378,7 @@ describe "Editor", ->
initialScrollbarHeight = editor.verticalScrollbarContent.height()
editor.detach()
- config.set("editor.fontSize", 10)
+ atom.config.set("editor.fontSize", 10)
expect(editor.lineHeight).toBe initialLineHeight
expect(editor.charWidth).toBe initialCharWidth
@@ -1482,15 +1482,15 @@ describe "Editor", ->
buffer.insert([0, 0], "–")
expect(editor.find('.line:eq(0)').outerHeight()).toBe editor.find('.line:eq(1)').outerHeight()
- describe "when config.editor.showInvisibles is set to true", ->
+ describe "when editor.showInvisibles config is set to true", ->
it "displays spaces, tabs, and newlines using visible non-empty values", ->
editor.setText " a line with tabs\tand spaces "
editor.attachToDom()
- expect(config.get("editor.showInvisibles")).toBeFalsy()
+ expect(atom.config.get("editor.showInvisibles")).toBeFalsy()
expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces "
- config.set("editor.showInvisibles", true)
+ atom.config.set("editor.showInvisibles", true)
space = editor.invisibles?.space
expect(space).toBeTruthy()
tab = editor.invisibles?.tab
@@ -1499,7 +1499,7 @@ describe "Editor", ->
expect(eol).toBeTruthy()
expect(editor.renderedLines.find('.line').text()).toBe "#{space}a line with tabs#{tab} and spaces#{space}#{eol}"
- config.set("editor.showInvisibles", false)
+ atom.config.set("editor.showInvisibles", false)
expect(editor.renderedLines.find('.line').text()).toBe " a line with tabs and spaces "
it "displays newlines as their own token outside of the other tokens scope", ->
@@ -1508,21 +1508,21 @@ describe "Editor", ->
editor.setText "var"
expect(editor.find('.line').html()).toBe 'var¬'
- it "allows invisible glyphs to be customized via config.editor.invisibles", ->
+ it "allows invisible glyphs to be customized via the editor.invisibles config", ->
editor.setText(" \t ")
editor.attachToDom()
- config.set("editor.showInvisibles", true)
- config.set("editor.invisibles", eol: ";", space: "_", tab: "tab")
+ atom.config.set("editor.showInvisibles", true)
+ atom.config.set("editor.invisibles", eol: ";", space: "_", tab: "tab")
expect(editor.find(".line:first").text()).toBe "_tab _;"
it "displays trailing carriage return using a visible non-empty value", ->
editor.setText "a line that ends with a carriage return\r\n"
editor.attachToDom()
- expect(config.get("editor.showInvisibles")).toBeFalsy()
+ expect(atom.config.get("editor.showInvisibles")).toBeFalsy()
expect(editor.renderedLines.find('.line:first').text()).toBe "a line that ends with a carriage return"
- config.set("editor.showInvisibles", true)
+ atom.config.set("editor.showInvisibles", true)
cr = editor.invisibles?.cr
expect(cr).toBeTruthy()
eol = editor.invisibles?.eol
@@ -1537,7 +1537,7 @@ describe "Editor", ->
editor.setText "a line that wraps"
editor.attachToDom()
editor.setWidthInChars(6)
- config.set "editor.showInvisibles", true
+ atom.config.set "editor.showInvisibles", true
space = editor.invisibles?.space
expect(space).toBeTruthy()
eol = editor.invisibles?.eol
@@ -1549,7 +1549,7 @@ describe "Editor", ->
editor.setText "a line that\r\n"
editor.attachToDom()
editor.setWidthInChars(6)
- config.set "editor.showInvisibles", true
+ atom.config.set "editor.showInvisibles", true
space = editor.invisibles?.space
expect(space).toBeTruthy()
cr = editor.invisibles?.cr
@@ -1560,12 +1560,12 @@ describe "Editor", ->
expect(editor.renderedLines.find('.line:eq(1)').text()).toBe "that#{cr}#{eol}"
expect(editor.renderedLines.find('.line:last').text()).toBe "#{eol}"
- describe "when config.editor.showIndentGuide is set to true", ->
+ describe "when editor.showIndentGuide is set to true", ->
it "adds an indent-guide class to each leading whitespace span", ->
editor.attachToDom()
- expect(config.get("editor.showIndentGuide")).toBeFalsy()
- config.set("editor.showIndentGuide", true)
+ expect(atom.config.get("editor.showIndentGuide")).toBeFalsy()
+ atom.config.set("editor.showIndentGuide", true)
expect(editor.showIndentGuide).toBeTruthy()
expect(editor.renderedLines.find('.line:eq(0) .indent-guide').length).toBe 0
@@ -1608,7 +1608,7 @@ describe "Editor", ->
describe "when the indentation level on a line before an empty line is changed", ->
it "updates the indent guide on the empty line", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showIndentGuide", true)
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').length).toBe 1
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').text()).toBe ' '
@@ -1622,7 +1622,7 @@ describe "Editor", ->
describe "when the indentation level on a line after an empty line is changed", ->
it "updates the indent guide on the empty line", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showIndentGuide", true)
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').length).toBe 1
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').text()).toBe ' '
@@ -1636,7 +1636,7 @@ describe "Editor", ->
describe "when a line contains only whitespace", ->
it "displays an indent guide on the line", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showIndentGuide", true)
editor.setCursorBufferPosition([10])
editor.indent()
@@ -1647,7 +1647,7 @@ describe "Editor", ->
it "uses the highest indent guide level from the next or previous non-empty line", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showIndentGuide", true)
editor.setCursorBufferPosition([1, Infinity])
editor.insertNewline()
@@ -1658,7 +1658,7 @@ describe "Editor", ->
describe "when the line has leading and trailing whitespace", ->
it "does not display the indent guide in the trailing whitespace", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showIndentGuide", true)
editor.insertText("/*\n * \n*/")
expect(editor.renderedLines.find('.line:eq(1) .indent-guide').length).toBe 1
@@ -1667,8 +1667,8 @@ describe "Editor", ->
describe "when the line is empty and end of show invisibles are enabled", ->
it "renders the indent guides interleaved with the end of line invisibles", ->
editor.attachToDom()
- config.set("editor.showIndentGuide", true)
- config.set("editor.showInvisibles", true)
+ atom.config.set("editor.showIndentGuide", true)
+ atom.config.set("editor.showInvisibles", true)
eol = editor.invisibles?.eol
expect(editor.renderedLines.find('.line:eq(10) .indent-guide').length).toBe 1
@@ -1903,7 +1903,7 @@ describe "Editor", ->
expect(miniEditor.find('.line.cursor-line').length).toBe 0
it "doesn't show the end of line invisible", ->
- config.set "editor.showInvisibles", true
+ atom.config.set "editor.showInvisibles", true
miniEditor = new Editor(mini: true)
miniEditor.attachToDom()
space = miniEditor.invisibles?.space
@@ -1914,7 +1914,7 @@ describe "Editor", ->
expect(miniEditor.renderedLines.find('.line').text()).toBe "#{space}a line with tabs#{tab} and spaces#{space}"
it "doesn't show the indent guide", ->
- config.set "editor.showIndentGuide", true
+ atom.config.set "editor.showIndentGuide", true
miniEditor = new Editor(mini: true)
miniEditor.attachToDom()
miniEditor.setText(" and indented line")
@@ -1932,10 +1932,10 @@ describe "Editor", ->
# doesn't allow regular editors to set grammars
expect(-> editor.setGrammar()).toThrow()
- describe "when config.editor.showLineNumbers is false", ->
+ describe "when the editor.showLineNumbers config is false", ->
it "doesn't render any line numbers", ->
expect(editor.gutter.lineNumbers).toBeVisible()
- config.set("editor.showLineNumbers", false)
+ atom.config.set("editor.showLineNumbers", false)
expect(editor.gutter.lineNumbers).not.toBeVisible()
describe "using gutter's api", ->
diff --git a/spec/project-spec.coffee b/spec/project-spec.coffee
index 448027d38..5df379830 100644
--- a/spec/project-spec.coffee
+++ b/spec/project-spec.coffee
@@ -449,7 +449,7 @@ describe "Project", ->
it "excludes ignored files", ->
project.setPath(projectPath)
- config.set('core.excludeVcsIgnoredPaths', true)
+ atom.config.set('core.excludeVcsIgnoredPaths', true)
resultHandler = jasmine.createSpy("result found")
waitsForPromise ->
project.scan /match/, (results) ->
@@ -495,9 +495,9 @@ describe "Project", ->
it "excludes values in core.ignoredNames", ->
projectPath = path.join(__dirname, 'fixtures', 'git', 'working-dir')
- ignoredNames = config.get("core.ignoredNames")
+ ignoredNames = atom.config.get("core.ignoredNames")
ignoredNames.push("a")
- config.set("core.ignoredNames", ignoredNames)
+ atom.config.set("core.ignoredNames", ignoredNames)
resultHandler = jasmine.createSpy("result found")
waitsForPromise ->
diff --git a/spec/root-view-spec.coffee b/spec/root-view-spec.coffee
index f093f37f7..65222bd84 100644
--- a/spec/root-view-spec.coffee
+++ b/spec/root-view-spec.coffee
@@ -195,20 +195,20 @@ describe "RootView", ->
describe "font size adjustment", ->
it "increases/decreases font size when increase/decrease-font-size events are triggered", ->
- fontSizeBefore = config.get('editor.fontSize')
+ fontSizeBefore = atom.config.get('editor.fontSize')
rootView.trigger 'window:increase-font-size'
- expect(config.get('editor.fontSize')).toBe fontSizeBefore + 1
+ expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 1
rootView.trigger 'window:increase-font-size'
- expect(config.get('editor.fontSize')).toBe fontSizeBefore + 2
+ expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 2
rootView.trigger 'window:decrease-font-size'
- expect(config.get('editor.fontSize')).toBe fontSizeBefore + 1
+ expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore + 1
rootView.trigger 'window:decrease-font-size'
- expect(config.get('editor.fontSize')).toBe fontSizeBefore
+ expect(atom.config.get('editor.fontSize')).toBe fontSizeBefore
it "does not allow the font size to be less than 1", ->
- config.set("editor.fontSize", 1)
+ atom.config.set("editor.fontSize", 1)
rootView.trigger 'window:decrease-font-size'
- expect(config.get('editor.fontSize')).toBe 1
+ expect(atom.config.get('editor.fontSize')).toBe 1
describe ".openSync(filePath, options)", ->
describe "when there is no active pane", ->
diff --git a/spec/space-pen-extensions-spec.coffee b/spec/space-pen-extensions-spec.coffee
index f121a683f..3102752ca 100644
--- a/spec/space-pen-extensions-spec.coffee
+++ b/spec/space-pen-extensions-spec.coffee
@@ -23,21 +23,21 @@ describe "SpacePen extensions", ->
expect(observeHandler).toHaveBeenCalledWith(undefined)
observeHandler.reset()
- config.set("foo.bar", "hello")
+ atom.config.set("foo.bar", "hello")
expect(observeHandler).toHaveBeenCalledWith("hello", previous: undefined)
observeHandler.reset()
view.unobserveConfig()
- config.set("foo.bar", "goodbye")
+ atom.config.set("foo.bar", "goodbye")
expect(observeHandler).not.toHaveBeenCalled()
it "unobserves when the view is removed", ->
observeHandler.reset()
parent.remove()
- config.set("foo.bar", "hello")
+ atom.config.set("foo.bar", "hello")
expect(observeHandler).not.toHaveBeenCalled()
describe "View.subscribe(eventEmitter, eventName, callback)", ->
diff --git a/spec/spec-helper.coffee b/spec/spec-helper.coffee
index 95f6618c9..db35f8908 100644
--- a/spec/spec-helper.coffee
+++ b/spec/spec-helper.coffee
@@ -77,15 +77,15 @@ beforeEach ->
config = new Config
resourcePath: window.resourcePath
configDirPath: atom.getConfigDirPath()
- config.packageDirPaths.unshift(fixturePackagesPath)
+ atom.config.packageDirPaths.unshift(fixturePackagesPath)
spyOn(config, 'load')
spyOn(config, 'save')
- config.set "editor.fontFamily", "Courier"
- config.set "editor.fontSize", 16
- config.set "editor.autoIndent", false
- config.set "core.disabledPackages", ["package-that-throws-an-exception",
+ atom.config.set "editor.fontFamily", "Courier"
+ atom.config.set "editor.fontSize", 16
+ atom.config.set "editor.autoIndent", false
+ atom.config.set "core.disabledPackages", ["package-that-throws-an-exception",
"package-with-broken-package-json", "package-with-broken-keymap"]
- config.save.reset()
+ atom.config.save.reset()
atom.config = config
window.config = config
diff --git a/spec/theme-manager-spec.coffee b/spec/theme-manager-spec.coffee
index 1f7638e43..7d1e2c05b 100644
--- a/spec/theme-manager-spec.coffee
+++ b/spec/theme-manager-spec.coffee
@@ -30,7 +30,7 @@ describe "ThemeManager", ->
describe "getImportPaths()", ->
it "returns the theme directories before the themes are loaded", ->
- config.set('core.themes', ['atom-dark-syntax', 'atom-dark-ui', 'atom-light-ui'])
+ atom.config.set('core.themes', ['atom-dark-syntax', 'atom-dark-ui', 'atom-light-ui'])
paths = themeManager.getImportPaths()
@@ -40,7 +40,7 @@ describe "ThemeManager", ->
expect(paths[1]).toContain 'atom-light-ui'
it "ignores themes that cannot be resolved to a directory", ->
- config.set('core.themes', ['definitely-not-a-theme'])
+ atom.config.set('core.themes', ['definitely-not-a-theme'])
expect(-> themeManager.getImportPaths()).not.toThrow()
describe "when the core.themes config value changes", ->
@@ -49,24 +49,24 @@ describe "ThemeManager", ->
spyOn(themeManager, 'getUserStylesheetPath').andCallFake -> null
themeManager.activateThemes()
- config.set('core.themes', [])
+ atom.config.set('core.themes', [])
expect($('style.theme').length).toBe 0
expect(reloadHandler).toHaveBeenCalled()
- config.set('core.themes', ['atom-dark-syntax'])
+ atom.config.set('core.themes', ['atom-dark-syntax'])
expect($('style.theme').length).toBe 1
expect($('style.theme:eq(0)').attr('id')).toMatch /atom-dark-syntax/
- config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
+ atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-syntax'])
expect($('style.theme').length).toBe 2
expect($('style.theme:eq(0)').attr('id')).toMatch /atom-dark-syntax/
expect($('style.theme:eq(1)').attr('id')).toMatch /atom-light-syntax/
- config.set('core.themes', [])
+ atom.config.set('core.themes', [])
expect($('style.theme').length).toBe 0
# atom-dark-ui has an directory path, the syntax ones dont.
- config.set('core.themes', ['atom-light-syntax', 'atom-dark-ui', 'atom-dark-syntax'])
+ atom.config.set('core.themes', ['atom-light-syntax', 'atom-dark-ui', 'atom-dark-syntax'])
importPaths = themeManager.getImportPaths()
expect(importPaths.length).toBe 1
expect(importPaths[0]).toContain 'atom-dark-ui'
@@ -144,7 +144,7 @@ describe "ThemeManager", ->
themeManager.activateThemes()
it "loads the correct values from the theme's ui-variables file", ->
- config.set('core.themes', ['theme-with-ui-variables'])
+ atom.config.set('core.themes', ['theme-with-ui-variables'])
# an override loaded in the base css
expect(rootView.css("background-color")).toBe "rgb(0, 0, 255)"
diff --git a/src/atom-package.coffee b/src/atom-package.coffee
index 7566c887f..9a3f54c0f 100644
--- a/src/atom-package.coffee
+++ b/src/atom-package.coffee
@@ -89,7 +89,7 @@ class AtomPackage extends Package
@requireMainModule()
if @mainModule?
- config.setDefaults(@name, @mainModule.configDefaults)
+ atom.config.setDefaults(@name, @mainModule.configDefaults)
@mainModule.activateConfig?()
@configActivated = true
diff --git a/src/atom.coffee b/src/atom.coffee
index 2a45beeeb..876ce39e2 100644
--- a/src/atom.coffee
+++ b/src/atom.coffee
@@ -58,7 +58,7 @@ class Atom
MenuManager = require './menu-manager'
@config = new Config({configDirPath, resourcePath})
- @keymap = new Keymap()
+ @keymap = new Keymap({configDirPath, resourcePath})
@packages = new PackageManager({devMode, configDirPath, resourcePath})
@subscribe @packages, 'activated', => @watchThemes()
diff --git a/src/config-observer.coffee b/src/config-observer.coffee
index 399c02e3e..4a62951c8 100644
--- a/src/config-observer.coffee
+++ b/src/config-observer.coffee
@@ -1,7 +1,7 @@
module.exports =
observeConfig: (keyPath, args...) ->
@configSubscriptions ?= {}
- @configSubscriptions[keyPath] = config.observe(keyPath, args...)
+ @configSubscriptions[keyPath] = atom.config.observe(keyPath, args...)
unobserveConfig: ->
if @configSubscriptions?
diff --git a/src/cursor.coffee b/src/cursor.coffee
index 128f0bb17..4e7402015 100644
--- a/src/cursor.coffee
+++ b/src/cursor.coffee
@@ -111,7 +111,7 @@ class Cursor
# Returns a RegExp.
wordRegExp: ({includeNonWordCharacters}={})->
includeNonWordCharacters ?= true
- nonWordCharacters = config.get('editor.nonWordCharacters')
+ nonWordCharacters = atom.config.get('editor.nonWordCharacters')
segments = ["^[\t ]*$"]
segments.push("[^\\s#{_.escapeRegExp(nonWordCharacters)}]+")
if includeNonWordCharacters
@@ -153,7 +153,7 @@ class Cursor
[before, after] = @editSession.getTextInBufferRange(range)
return false if /\s/.test(before) or /\s/.test(after)
- nonWordCharacters = config.get('editor.nonWordCharacters').split('')
+ nonWordCharacters = atom.config.get('editor.nonWordCharacters').split('')
_.contains(nonWordCharacters, before) isnt _.contains(nonWordCharacters, after)
# Public: Returns whether this cursor is between a word's start and end.
diff --git a/src/display-buffer.coffee b/src/display-buffer.coffee
index f80b3c892..2ec4280c9 100644
--- a/src/display-buffer.coffee
+++ b/src/display-buffer.coffee
@@ -38,7 +38,7 @@ class DisplayBuffer
version: @constructor.version
id: @id
tokenizedBuffer: @tokenizedBuffer.getState()
- softWrap: softWrap ? config.get('editor.softWrap') ? false
+ softWrap: softWrap ? atom.config.get('editor.softWrap') ? false
editorWidthInChars: editorWidthInChars
@markers = {}
@@ -56,7 +56,7 @@ class DisplayBuffer
@updateWrappedScreenLines()
@observeConfig 'editor.preferredLineLength', callNow: false, =>
- @updateWrappedScreenLines() if @getSoftWrap() and config.get('editor.softWrapAtPreferredLineLength')
+ @updateWrappedScreenLines() if @getSoftWrap() and atom.config.get('editor.softWrapAtPreferredLineLength')
@observeConfig 'editor.softWrapAtPreferredLineLength', callNow: false, =>
@updateWrappedScreenLines() if @getSoftWrap()
@@ -113,8 +113,8 @@ class DisplayBuffer
getSoftWrapColumn: ->
editorWidthInChars = @state.get('editorWidthInChars')
- if config.get('editor.softWrapAtPreferredLineLength')
- Math.min(editorWidthInChars, config.getPositiveInt('editor.preferredLineLength', editorWidthInChars))
+ if atom.config.get('editor.softWrapAtPreferredLineLength')
+ Math.min(editorWidthInChars, atom.config.getPositiveInt('editor.preferredLineLength', editorWidthInChars))
else
editorWidthInChars
diff --git a/src/edit-session.coffee b/src/edit-session.coffee
index 68434efaf..a3bb2673c 100644
--- a/src/edit-session.coffee
+++ b/src/edit-session.coffee
@@ -85,7 +85,7 @@ class EditSession
version: @constructor.version
id: @id
displayBuffer: displayBuffer.getState()
- softTabs: buffer.usesSoftTabs() ? softTabs ? config.get('editor.softTabs') ? true
+ softTabs: buffer.usesSoftTabs() ? softTabs ? atom.config.get('editor.softTabs') ? true
scrollTop: 0
scrollLeft: 0
@setBuffer(buffer)
@@ -567,7 +567,7 @@ class EditSession
pasteText: (options={}) ->
[text, metadata] = atom.pasteboard.read()
- if config.get('editor.normalizeIndentOnPaste') and metadata
+ if atom.config.get('editor.normalizeIndentOnPaste') and metadata
options.indentBasis ?= metadata.indentBasis
@insertText(text, options)
@@ -1398,7 +1398,7 @@ class EditSession
# Private:
shouldAutoIndent: ->
- config.get("editor.autoIndent")
+ atom.config.get("editor.autoIndent")
# Public: Performs all editor actions from the given function within a single
# undo step.
diff --git a/src/editor.coffee b/src/editor.coffee
index 2027e429a..7ee6cd12f 100644
--- a/src/editor.coffee
+++ b/src/editor.coffee
@@ -203,9 +203,9 @@ class Editor extends View
'editor:move-line-down': @moveLineDown
'editor:duplicate-line': @duplicateLine
'editor:join-line': @joinLine
- 'editor:toggle-indent-guide': => config.set('editor.showIndentGuide', !config.get('editor.showIndentGuide'))
+ 'editor:toggle-indent-guide': => atom.config.toggle('editor.showIndentGuide')
'editor:save-debug-snapshot': @saveDebugSnapshot
- 'editor:toggle-line-numbers': => config.set('editor.showLineNumbers', !config.get('editor.showLineNumbers'))
+ 'editor:toggle-line-numbers': => atom.config.toggle('editor.showLineNumbers')
'editor:scroll-to-cursor': @scrollToCursorPosition
documentation = {}
diff --git a/src/less-compile-cache.coffee b/src/less-compile-cache.coffee
index 977ede9ff..6828c843b 100644
--- a/src/less-compile-cache.coffee
+++ b/src/less-compile-cache.coffee
@@ -20,7 +20,7 @@ class LessCompileCache
@subscribe atom.themes, 'reloaded', => @cache.setImportPaths(@getImportPaths())
- getImportPaths: -> atom.themes.getImportPaths().concat(config.lessSearchPaths)
+ getImportPaths: -> atom.themes.getImportPaths().concat(atom.config.lessSearchPaths)
read: (stylesheetPath) -> @cache.readFileSync(stylesheetPath)
diff --git a/src/package-manager.coffee b/src/package-manager.coffee
index 3cb6720b0..76a85cd73 100644
--- a/src/package-manager.coffee
+++ b/src/package-manager.coffee
@@ -106,13 +106,13 @@ class PackageManager
unobserveDisabledPackages: ->
return unless @observingDisabledPackages
- config.unobserve('core.disabledPackages')
+ atom.config.unobserve('core.disabledPackages')
@observingDisabledPackages = false
observeDisabledPackages: ->
return if @observingDisabledPackages
- config.observe 'core.disabledPackages', callNow: false, (disabledPackages, {previous}) =>
+ atom.config.observe 'core.disabledPackages', callNow: false, (disabledPackages, {previous}) =>
packagesToEnable = _.difference(previous, disabledPackages)
packagesToDisable = _.difference(disabledPackages, previous)
@@ -182,7 +182,7 @@ class PackageManager
return packagePath if @isInternalPackage(packagePath)
isPackageDisabled: (name) ->
- _.include(config.get('core.disabledPackages') ? [], name)
+ _.include(atom.config.get('core.disabledPackages') ? [], name)
isInternalPackage: (packagePath) ->
{engines} = Package.loadMetadata(packagePath, true)
diff --git a/src/project.coffee b/src/project.coffee
index b314f8578..f523c450a 100644
--- a/src/project.coffee
+++ b/src/project.coffee
@@ -34,7 +34,7 @@ class Project
@pathForRepositoryUrl: (repoUrl) ->
[repoName] = url.parse(repoUrl).path.split('/')[-1..]
repoName = repoName.replace(/\.git$/, '')
- path.join(config.get('core.projectHome'), repoName)
+ path.join(atom.config.get('core.projectHome'), repoName)
rootDirectory: null
editSessions: null
@@ -137,14 +137,14 @@ class Project
# Public: Determines if a path is ignored via Atom configuration.
isPathIgnored: (path) ->
for segment in path.split("/")
- ignoredNames = config.get("core.ignoredNames") or []
+ ignoredNames = atom.config.get("core.ignoredNames") or []
return true if _.contains(ignoredNames, segment)
@ignoreRepositoryPath(path)
# Public: Determines if a given path is ignored via repository configuration.
ignoreRepositoryPath: (repositoryPath) ->
- config.get("core.hideGitIgnoredFiles") and @repo?.isPathIgnored(path.join(@getPath(), repositoryPath))
+ atom.config.get("core.hideGitIgnoredFiles") and @repo?.isPathIgnored(path.join(@getPath(), repositoryPath))
# Public: Given a uri, this resolves it relative to the project directory. If
# the path is already absolute or if it is prefixed with a scheme, it is
@@ -315,8 +315,8 @@ class Project
ignoreCase: regex.ignoreCase
inclusions: options.paths
includeHidden: true
- excludeVcsIgnores: config.get('core.excludeVcsIgnoredPaths')
- exclusions: config.get('core.ignoredNames')
+ excludeVcsIgnores: atom.config.get('core.excludeVcsIgnoredPaths')
+ exclusions: atom.config.get('core.ignoredNames')
task = Task.once require.resolve('./scan-handler'), @getPath(), regex.source, searchOptions, ->
deferred.resolve()
diff --git a/src/root-view.coffee b/src/root-view.coffee
index 22a0ab54d..d1d071272 100644
--- a/src/root-view.coffee
+++ b/src/root-view.coffee
@@ -107,22 +107,22 @@ class RootView extends View
@command 'window:run-package-specs', => ipc.sendChannel('run-package-specs', path.join(project.getPath(), 'spec'))
@command 'window:increase-font-size', =>
- config.set("editor.fontSize", config.get("editor.fontSize") + 1)
+ atom.config.set("editor.fontSize", config.get("editor.fontSize") + 1)
@command 'window:decrease-font-size', =>
fontSize = config.get "editor.fontSize"
- config.set("editor.fontSize", fontSize - 1) if fontSize > 1
+ atom.config.set("editor.fontSize", fontSize - 1) if fontSize > 1
@command 'window:focus-next-pane', => @focusNextPane()
@command 'window:focus-previous-pane', => @focusPreviousPane()
@command 'window:save-all', => @saveAll()
@command 'window:toggle-invisibles', =>
- config.set("editor.showInvisibles", !config.get("editor.showInvisibles"))
+ atom.config.toggle("editor.showInvisibles")
@command 'window:toggle-ignored-files', =>
- config.set("core.hideGitIgnoredFiles", not config.core.hideGitIgnoredFiles)
+ atom.config.toggle("core.hideGitIgnoredFiles")
@command 'window:toggle-auto-indent', =>
- config.set("editor.autoIndent", !config.get("editor.autoIndent"))
+ atom.config.toggle("editor.autoIndent")
@command 'pane:reopen-closed-item', =>
@panes.reopenItem()
diff --git a/src/tokenized-buffer.coffee b/src/tokenized-buffer.coffee
index f5dcc1af1..4dc775496 100644
--- a/src/tokenized-buffer.coffee
+++ b/src/tokenized-buffer.coffee
@@ -37,7 +37,7 @@ class TokenizedBuffer
@state = atom.site.createDocument
deserializer: @constructor.name
bufferPath: @buffer.getRelativePath()
- tabLength: tabLength ? config.get('editor.tabLength') ? 2
+ tabLength: tabLength ? atom.config.get('editor.tabLength') ? 2
@subscribe syntax, 'grammar-added grammar-updated', (grammar) =>
if grammar.injectionSelector?