       description: "Remember query per provider basis and apply it at startup"
   )
 
-module.exports = new Settings('narrow', _.defaults(globalSettings, providerSettings))
+module.exports = new Settings('narrow', Object.assign(complimentField(globalSettings), providerSettings))


class Settings
  constructor: (@scope, @config) ->
    complimentField(@config)

  get: (param) ->
    atom.config.get("#{@scope}.#{param}")

  default: 'inherit'
  enum: ['inherit', globalSettings[name].enum...]

ProviderConfig =
  directionToOpen: inheritGlobalEnum('directionToOpen')
  caseSensitivityForNarrowQuery: inheritGlobalEnum('caseSensitivityForNarrowQuery')
  revealOnStartCondition:
    default: 'always'
    enum: ['always', 'never', 'on-input']
  focusOnStartCondition:
    default: 'always'
    description: "Condition when focus to narrow-editor on start"
    enum: ['always', 'never', 'no-input']
  negateNarrowQueryByEndingExclamation: false
  autoPreview: true
  autoPreviewOnQueryChange: true
  closeOnConfirm: true

newProviderConfig = (other={}) ->
  properties = Object.assign({}, ProviderConfig, other)
  return {
    type: 'object'
    collapsed: true
    properties: complimentField(properties, true)
  }

ScanAndSearchAndAtomScanConfig =
  caseSensitivityForSearchTerm:
    default: 'smartcase'
    enum: ['smartcase', 'sensitive', 'insensitive']
  revealOnStartCondition: 'on-input'
  searchWholeWord: false
  searchUseRegex: false
  minimumLengthToStartRegexSearch: 3
  rememberUseRegex: false

newProviderConfigForScanAndSearchAndAtomScan = (other={}) ->
  newProviderConfig(Object.assign({}, ScanAndSearchAndAtomScanConfig, other))

providerSettings =
  Scan: newProviderConfigForScanAndSearchAndAtomScan()
