Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

New config API - #4631

Merged
maxbrunsfeld merged 20 commits into
masterfrom
mb-new-config-api
Dec 16, 2014
Merged

maxbrunsfeld merged 20 commits into
masterfrom
mb-new-config-api

Conversation

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

This PR updates the config API, but does not change the way global properties are stored. They still aren't stored in the scoped property store.

Refs #4567.

Steps

  • Make Config::get and ::set take trailing options hashes
  • Add a source option to Config::set
  • Use the user's settings file path as the default source in ::set
  • Add sources and excludeSources options to Config::get
  • Fix remaining failing specs related to the user config using new source information
  • Add Config::unset
  • Make Config::observe and ::onDidChange consistent with ::get by taking a scope as an option instead of the first argument.
  • Throw exception when trying to specify a source without a scope selector (To be fixed by Improve Config API with regard to scoped settings #4567).
  • Bugfix: only use special priority for settings w/ user's config file as source
  • Update docs
  • Deprecate ::isDefault and ::getDefault in favor of using the source option to ::get
  • Add a way to get settings set from with a source directory (needed by this code in settings-view)

Nathan Sobo and others added 17 commits December 16, 2014 14:00
Default it to the user’s config if no source is specified.
If the option is supplied, we will only retrieve values from the
specified sources.
Before, values loaded from the config file were set in a
way that allowed any key to be set in the root object.
Now, these values are set in a way that's similar to how
::set works.
Deprecate using the scope as an optional first argument
Deprecate passing the scope as an optional first argument
Deprecate Config::restoreDefault
@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

@benogle, @kevinsawicki - I think this is ready to go. It implements the API that @nathansobo outlined in #4567, with these differences:

  • Calling Config::set with a new source does not throw an exception.
  • There is no Config::add; to add settings for a new source, you just use Config::set.
  • There is not yet a way to set a source's priority. I'm thinking we should enable this later in an additive way, since we don't have a use case for it at the moment.

I've rebased the branch from #4567 onto this one, so that we can easily continue with the refactor after the holidays.

Comment thread spec/config-spec.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't use parens around the toBe params

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and this is why I am a fan of fully-parenthesized CoffeeScript, otherwise there are inconsistencies all over (not that i'm suggesting we change our style guide or anything)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I totally agree it is inconsistent overall, but this added line is inconsistent with the previous 2 which is why I brought it up.

maxbrunsfeld added a commit that referenced this pull request Dec 16, 2014
@maxbrunsfeld
maxbrunsfeld merged commit 5147fb6 into master Dec 16, 2014
@maxbrunsfeld
maxbrunsfeld deleted the mb-new-config-api branch December 16, 2014 23:22
maxbrunsfeld added a commit that referenced this pull request Dec 16, 2014
This reverts commit 5147fb6, reversing
changes made to 9bbbb58.
@maxbrunsfeld
maxbrunsfeld restored the mb-new-config-api branch December 18, 2014 18:21
@maxbrunsfeld
maxbrunsfeld deleted the mb-new-config-api branch December 18, 2014 18:25
maxbrunsfeld added a commit that referenced this pull request Dec 19, 2014
This reverts commit dc2a453.

Conflicts:
	spec/config-spec.coffee
	src/config.coffee
maxbrunsfeld added a commit that referenced this pull request Dec 20, 2014
This reverts commit dc2a453.

Conflicts:
	spec/config-spec.coffee
	src/config.coffee
maxbrunsfeld added a commit that referenced this pull request Dec 22, 2014
This reverts commit dc2a453.

Conflicts:
	spec/config-spec.coffee
	src/config.coffee
maxbrunsfeld added a commit that referenced this pull request Dec 23, 2014
This reverts commit dc2a453.

Conflicts:
	spec/config-spec.coffee
	src/config.coffee
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants