Doc Update for enum 'label' display in settings?
In the Config docs, the object enum array states the following:
config:
someSetting:
type: 'string'
default: 'foo'
enum: [
{value: 'foo', description: 'Foo mode. You want this.'}
{value: 'bar', description: 'Bar mode. Nobody wants that!'}
]
However, if I don't put a label field, the select fields are not labeled. Correct number of items though. By adding a label, the options are labeled correctly:
config:
someSetting:
type: 'string'
default: 'foo'
enum: [
{value: 'foo', label: 'foo', description: 'Foo mode. You want this.'}
{value: 'bar', label: 'bar', description: 'Bar mode. Nobody wants that!'}
]
I couldn't find where to change the docs after poking around. If this is merely a documentation change, if someone can point me to them, I'll update the example and description.
Documentation about the Config can be found here: https://github.com/atom/atom/blob/v1.10.2/src/config.coffee#L17-L342
@jerone This issue is about the actual documentation here: https://atom.io/docs/api/v1.10.2/Config#enum
@Arcanemagus To my understanding has https://github.com/atom/atom/blob/v1.10.2/src/config.coffee#L240-L285 the original documentation, which is extracted to https://atom.io/docs/api/v1.10.2/Config#enum
The user above asked "... where to change the docs...", which I delivered. Please correct me if I'm wrong.
Anyways, a proposed docs update was already denied: https://github.com/atom/atom/pull/11973
The top setting works fine here - we have no documentation for a label property because I don't believe we ever added one. The code certainly doesn't have any such reference.
The default Atom config at https://github.com/atom/atom/blob/master/src/config-schema.coffee also doesn't use a label property on enums.
I guess the real question is why some people are needing a label - it's certainly doesn't appear by design.
@damieng Around when this was filed (+/- a month?) there was a bug where enum of objects like was shown in the documentation wouldn't show at all... just as blank entries. I'm pretty sure it was fixed, but haven't verified myself as none of my packages have needed it (yet).
Edit, the related issue @jerone linked actually mentions the cause of the bug, and says it was fixed in "1.9": https://github.com/atom/atom/pull/11973#issuecomment-252158934