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

Add a public way of setting config values associated with a source - #4558

Closed
maxbrunsfeld wants to merge 6 commits into
masterfrom
mb-public-package-config-setter
Closed

maxbrunsfeld wants to merge 6 commits into
masterfrom
mb-public-package-config-setter

Conversation

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

⚠️ WIP ⚠️

  • Eliminate disposable returned from Config::set
  • Associate all settings with a source regardless of whether or not they are scoped
  • Add a Config::unsetFromSource public method to remove settings from a given source
  • Add sources option to Config::get
  • Add excludeSources option to Config::get
  • Use actual user settings path as the user settings source
  • Add Config::unset to remove a setting from the user-config source
  • Add Config::unsetFromSource to remove all settings or one setting from a given source
  • Deprecate is/get/restoreDefault methods and replace with get and set plus source options

Previously, the private method ::addScopedSettings was used to associate config settings with a source other than the user's config file. It bypassed schema validation.

This is being driven out by changes made in atom/snippets#86; to fix deprecation warnings required calling private methods on Config.

@maxbrunsfeld
maxbrunsfeld force-pushed the mb-public-package-config-setter branch from 19876ac to 36f3c8c Compare December 11, 2014 19:37
Comment thread src/config.coffee

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@benogle, @nathansobo: should I go ahead and roll this behavior into ::set? I did this first just to avoid changing more than one thing at a time.

I could also see leaving it as its own method, though.

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.

I'm not sure. The only time we want to set config values without a source is presumably when the source is implied to be the user settings. I'm not sure I understand the usage of source well enough to think clearly about this. Maybe we should discuss it one more time. Think through how source is currently used and could be used in the future.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Oh. It turns out that autocomplete writes to editor.completions, which is not in the schema.

@maxbrunsfeld
maxbrunsfeld force-pushed the mb-public-package-config-setter branch from 1432fdb to 97d2c43 Compare December 11, 2014 20:25
@nathansobo

Copy link
Copy Markdown
Contributor

It's kinda weird that it's editor.completions since that namespace is owned by core. But it's probably not worth changing.

Comment thread src/config.coffee

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.

I think we need to clarify what we mean by source here. Maybe it's useful to say "associates the value with a given source, such as a path to a file on disk."

@maxbrunsfeld
maxbrunsfeld force-pushed the mb-public-package-config-setter branch from 7497f7c to 2856eb7 Compare December 11, 2014 22:58
maxbrunsfeld and others added 6 commits December 11, 2014 17:25
This is a public way for adding settings associated with
a source such as a package. It replaces ::addScopedSettings.
Unlike that method, it validates settings using the schemas.
It was implicitly part of the schema already, but it used
to be set in a way that bypassed schema validations
Currently only works when a scope descriptor is passed to ::get.
@nathansobo
nathansobo force-pushed the mb-public-package-config-setter branch from 2856eb7 to a0ad409 Compare December 12, 2014 02:19
@maxbrunsfeld

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4567.

@maxbrunsfeld
maxbrunsfeld deleted the mb-public-package-config-setter branch December 13, 2014 05:34
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.

2 participants