Repository: atom/atom
File: src/config.js (JavaScript)

Code before:
  //     for more information.
  //
  // Returns the value from Atom's default settings, the user's configuration
  // file in the type specified by the configuration schema.
  get (...args) {
    let keyPath, scope, value
    let options = {}

    if (args.length > 1) {
      if ((typeof args[0] === 'string') || (args[0] == null)) {
        [keyPath, options] = args;
        ({scope} = options)
      }
    } else {
      [keyPath] = args
    }

    const noSources = !options.sources || (Array.isArray(options.sources) && options.sources.length === 0)
    if (this.hasCurrentProject && noSources) {
      const projectScope = Array.isArray(scope) ? scope.push(PROJECT) : [PROJECT]
      const projectOptions = Object.assign({sources: [PROJECT]}, options)
      value = this.getRawScopedValue(projectScope, keyPath, projectOptions)
      if (value != null) {
        return value
      }
    }

    if (scope != null) {
      value = this.getRawScopedValue(scope, keyPath, options)
      return value != null ? value : this.getRawValue(keyPath, options)
    } else {
      return this.getRawValue(keyPath, options)
    }
  }

  // Extended: Get all of the values for the given key-path, along with their
  // associated scope selector.
  //
  // * `keyPath` The {String} name of the key to retrieve
  // * `options` (optional) {Object} see the `options` argument to {::get}
  //
  // Returns an {Array} of {Object}s with the following keys:
  //  * `scopeDescriptor` The {ScopeDescriptor} with which the value is associated
  //  * `value` The value for the key-path
  getAll (keyPath, options = {}) {
    let result, scope
    if (options != null) { ({scope} = options) }

    const priorities = []

    // getAll returns all values that would normally be returned

Review comment (suggestion):
Can you explain why this logic :point_up: (and also the additions to `getAll` below) is needed?

I would think that `get` and `getAll` would not need to change much if at all; we'd just need to give the `PROJECT` source a higher priority, kind of like what [we do for the user settings](https://github.com/atom/atom/blob/7b490c66ec6a9b277c44db082383ea1c5f50a2f3/src/config.js#L1170-L1172).

Code after:
  //     See [the scopes docs](http://flight-manual.atom.io/behind-atom/sections/scoped-settings-scopes-and-scope-descriptors/)
  //     for more information.
  //
  // Returns the value from Atom's default settings, the user's configuration
  // file in the type specified by the configuration schema.
  get (...args) {
    let keyPath, options, scope
    if (args.length > 1) {
      if ((typeof args[0] === 'string') || (args[0] == null)) {
        [keyPath, options] = args;
        ({scope} = options)
      }
    } else {
      [keyPath] = args
    }

    if (scope != null) {
      const value = this.getRawScopedValue(scope, keyPath, options)
      return value != null ? value : this.getRawValue(keyPath, options)
    } else {
      return this.getRawValue(keyPath, options)
    }
  }

  // Extended: Get all of the values for the given key-path, along with their
  // associated scope selector.
  //
  // * `keyPath` The {String} name of the key to retrieve
  // * `options` (optional) {Object} see the `options` argument to {::get}
  //
  // Returns an {Array} of {Object}s with the following keys:
  //  * `scopeDescriptor` The {ScopeDescriptor} with which the value is associated
  //  * `value` The value for the key-path
  getAll (keyPath, options) {
    let globalValue, result, scope
    if (options != null) { ({scope} = options) }

    if (scope != null) {
      let legacyScopeDescriptor
      const scopeDescriptor = ScopeDescriptor.fromObject(scope)
      result = this.scopedSettingsStore.getAll(
          scopeDescriptor.getScopeChain(),
          keyPath,
          options
        )
      legacyScopeDescriptor = this.getLegacyScopeDescriptorForNewScopeDescriptor(scopeDescriptor)
      if (legacyScopeDescriptor) {
        result.push(...Array.from(this.scopedSettingsStore.getAll(
           legacyScopeDescriptor.getScopeChain(),
           keyPath,
           options