-
Notifications
You must be signed in to change notification settings - Fork 266
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
fix: suggest hyphen in array #901
base: main
Are you sure you want to change the base?
fix: suggest hyphen in array #901
Conversation
46c0d3c
to
2af180a
Compare
test/autoCompletion.test.ts
Outdated
result.items.map((i) => ({ label: i.label, insertText: i.insertText })), | ||
[ | ||
{ | ||
insertText: 'Test', |
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.
there should be '- Test' insert text, but it's another problem
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.
Can you file that as an issue?
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.
I fixed it in this PR the end...
2af180a
to
519f984
Compare
} else { | ||
this.addSchemaValueCompletions(s.schema.items, separatorAfter, collector, types, 'value'); | ||
this.addSchemaValueCompletions(s.schema.items, separatorAfter, collector, types, 'value', true); |
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.
unify the code for both scenarios. If a schema contains items
it's an array. No need to check if type === 'object'
Hello @msivasubramaniaan, can I ask you for a review? |
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.
LGTM.
Needs to be rebased before I can merge and the failing CI (which looks like a GH problem) should clear with the rebase.
Another level of improvement to this PR would be to filter the items that are already on the array to avoid duplicate entries on the array. Approving this PR but please let me know if you are planning to add the improvement.
d0872b1
to
86a72ed
Compare
…-yaml-language-server into fix/suggest-hyphen-in-arrays
@gorkem , I don't think that there should be such a filter/condition
doesn't define that items of the array have to be unique. To be honest I am not sure how to define this (unique array items)... This should be allowed based on the schema items:
- Test1
- Test1
- Test2 or don't you agree? did I understand you incorrectly? |
I found another related problem |
Correct, item uniqueness is determined by the schema. The current implementation does not take into account the |
What does this PR do?
- (array item)
suggestion was missing for some specific situations, for example: enums.it worked ok for 1st item after a colon, but not for 2nd
after fix:
UPDATE
I extended this PR because there were related issues, with a tiny update of this original problem, I can fix another 2 problems:
2) auto add
-
when hyphen is missingchoose item will produce incorrect yaml
body
What issues does this PR fix or reference?
no ref
Is it tested? How?
modified existing
added one test for the enum
- array items
-
added test for default snippets with string value in the
body
property