Repository navigation
Support JSON Schema in Config - #3613
Conversation
Will this throw an error or silently fail? |
|
So |
|
It makes more sense IMO, to return a bool indicating set / not set. Do you rely on the returned value? Cant you call get afterward? Would you rather it throws an error? How do we handle those when they happen? |
|
I'm fine with it returning I'm kind of curious how this will handle values it reads off disk that are invalid though, like if you have a bad value already written to your |
|
Yeah, no more value returned, just the bool. I'm not sure yet on feedback when reading bad data from disk. Right now, it would just not set the bad data. Would be interesting to have it show somewhere in the UI (status icon!), or we could log a warning in the console (though no one will find it). |
c0e4fe0 to
2af9088
Compare
There was a problem hiding this comment.
Might want to check isFinite as well, or is Infinity, -Infinity allowed?
There was a problem hiding this comment.
I think they are reasonable, no? If they want bounds checking, they can use the bounds keys. As long as parsing some random string doesnt result in Infinity, I'm ok with allowing these
There was a problem hiding this comment.
parseInt called with a string can return Infinity.
Also you can't write out Infinity to a .json file, so it would seem weird to be able to set Infinity without being able to save it like that to disk.
9e62fad to
6035d9f
Compare
There was a problem hiding this comment.
-50 will get coerced to 10 as 10 is the minimum/
|
Ok, I'm happy with this. @nathansobo @kevinsawicki wanna give this a quick pass? |
There was a problem hiding this comment.
Since no one is directly subscribing, think it's safe to pull out the emits and the mixed in emitter?
There was a problem hiding this comment.
Obviously only one tiny, little voice, but I'm currently relying on the broad updated event being emitted to listen for any and all updates to configuration values. Is there any alternative means of doing that? Otherwise it'd be awesome if the emits could stay 🙏
There was a problem hiding this comment.
@thomasjo Makes sense. I can make onDidChange accept no keypath or something. Or Maybe an onDidChangeAnyKeyPath or something. @nathansobo wdyt?
There was a problem hiding this comment.
So this makes me want to rename the event methods. I want
observeKeyPath
onDidChangeKeyPath
onDidChange for all changes
Such pain for authors.
There was a problem hiding this comment.
onDidChange now accepts just a callback, and no keypath for watching all changes.
Support passing no keypath
It makes sense to coerce from more general -> more specific data types. eg. string -> int, etc. But coercing the other way is problematic in the case of chaining because the more general type will swallow the specific type. eg. Setting `false` on type: [‘string’, ‘boolean’] will coerce the boolean to a string, and will never allow the value to be a boolean.
aff5ebd to
b54decc
Compare
|
💖 |

JSON Schema (schema core, and the supported keys)
It will look like this:
Notes
::setcannot be coerced, it will not be set (eg. passing'omg'to an integer type)TODO
getIntstyle methodsconfigDefaults