-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[core] Don't reject schemas with issues, but add valid properties. #6341
Conversation
@svenefftinge this appears to work with the invalid pref schema of the gitlense extension 🎉
But the broken schema of the rust extension is not cleaned up.
Looking at the code responsible to filter out invalid properties, I don't understand, how invalid ones are detected here: theia/packages/core/src/browser/preferences/preference-contribution.ts Lines 212 to 214 in b4972e3
|
419fcac
to
3598028
Compare
this is raised when trying to use the (tree based) preference editor for invalid pref items like I don't think this is critical here; now one can use at least the valid parts 👍 |
Improves #4902 Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works nicely for me. I tried with vscode extensions like gitlense and rust, and it let's you use the valid preference items 👍
The preference editor currently doesn't give any feedback on invalid schema items; we might think about it in follow-ups.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlexTugarev have you tried with not vscode extensions, but with native extensions like filesystem?
} | ||
const values = preferences.inspect(preferenceName, resourceUri); | ||
return values && values.defaultValue; | ||
return preferences.get(preferenceName, defaultValue, resourceUri || opts.resourceUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we are fine with runtime errors for statically typed proxies? None of clients is checking for invalid values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's strange to do it partly and VS code is not doing it at all.
@akosyakov now I got your point! |
I didn't find any preferences that would cause bad side effects with bad values myself during a quick try. We can add guards to those places but we had now multiple VS code extensions with bad or incomplete preference schema so being strict on this level doesn't seem right. |
What it does
Allows configuration schemas to have issues.
Some vs code extensions have schema validation issues in their
configuration
section.Instead of rejecting the full contribution, which will effectively break the extension, this PR just logs the validation message as a warning. Moreover the PR removes the runtime validation of actual preference values and leaves this to the user and the preference consumer.
How to test
Install gitlens.
Review checklist
Reminder for reviewers