Move away from lineWarningLength into validationProvider#42206
Move away from lineWarningLength into validationProvider#42206joaomoreno merged 2 commits intomasterfrom
Conversation
src/vs/vscode.d.ts
Outdated
| * @return A human readable string which is presented as diagnostic message. | ||
| * Return `undefined`, `null`, or the empty string when 'value' is valid. | ||
| */ | ||
| validateInput(value: string, cursorPosition: number): ProviderResult<SourceControlInputBoxValidation | undefined | null>; |
There was a problem hiding this comment.
Providers usually have a provide method, esp. when returning a ProviderResult. And you also wanna take a look at that type to learn why you don't need undefined | null here...
src/vs/vscode.d.ts
Outdated
| * the validation provider simply by setting this property to a different value. | ||
| */ | ||
| lineWarningLength: number | undefined; | ||
| validationProvider: SourceControlInputBoxValidationProvider; |
There was a problem hiding this comment.
Yeah, maybe... It doesn't fill well into the provider approach which usually is about registering multiple providers, like registerInputBoxValidationProvider('git', myProviderInstance). I'd say make it a real provider or let be a simple callback.
|
The simplified (maybe over-simpilied?), down-to-earth, variant is this: |
|
@jrieken I initially went with that approach and gave up on it given the lack of precedence. I feel it is not so obvious that one could set that property, since it is a function, you know? |
|
Yeah, it is JavaScript'ish but yeah, not commonly used in our API... Lets talk on Monday |
|
@jrieken Did the changes we talked about:
|
As discussed, here's another approach to fix #21144
This solution exposes a
validationProvideron the SCM input, instead of relying on a very specificlineWarningLengthproperty. It is a more general solution to the problem, which feels better on the API side of things.There are a few drawbacks, though:
@jrieken Please review the approach in the API and, given the drawbacks, let me know if this is still your preferred approach.