-
Notifications
You must be signed in to change notification settings - Fork 261
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
Add: show examples on hover. #660
Add: show examples on hover. #660
Conversation
@yassun4dev We have test failing on this PR. |
01955c4
to
80d4558
Compare
@evidolob Oh, sorry... I fixed sign of the commit, and check why the test failed on Linux only. |
@yassun4dev Are there any JSON schemas that you can suggest for testing this functionality? |
@gorkem I added one test case and put a simple schema in it. You need more comprehensive testing as separate schema files? |
Not necessarily for testing but wanted to see real world usages. |
@gorkem I see. I have encountered some cases that require examples in real world.
{
"type": "object",
"properties": {
"range": {
"type": "string",
"description": "Sheet range of Excel.",
"pattern": "^[A-Z]+[1-9][0-9]*:[A-Z]+[1-9][0-9]*$", // It's too complicated pattern.
"examples": ["A1:B12"] // Easy to read and understand.
}
}
}
|
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.
Thanks for the contribution. Just one comment on the format of the hover. It is up-to you if you want to address it or not.
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += 'Examples: [\n\n'; |
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.
Not a big one but I am not sure if we need the [
in here. The hovers looked better for me without them
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.
@gorkem I fixed hover format. I think it looks better. Thank you!!
What does this PR do?
If "examples" is defined in the schema, display it on the hover.
I think it useful to show what kind of input is expected for a string in user format.
Is it tested? How?
A test was added.