-
Notifications
You must be signed in to change notification settings - Fork 51
Use detail field for one-of qualifiers instead of label #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
base: main
Are you sure you want to change the base?
Conversation
1934094 to
96ae040
Compare
- Move qualifiers (list, full syntax) from label to detail field - Remove filterText since labels are now clean - Update distinctValues to preserve variants with different details - Standard LSP pattern: detail shown after label in completion UI
96ae040 to
10db944
Compare
| for (const value of values) { | ||
| map.set(value.label, value); | ||
| // Include detail in the key to preserve variants with different details | ||
| const key = value.detail ? `${value.label}\0${value.detail}` : value.label; |
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.
Note, this does not affect the actual value that is returned. This is just for finding distinct variations.
Refer ine 217 below, for the actual values that are returned from this funciton.
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.
Pull request overview
This PR improves the LSP completion items for workflow fields that accept multiple YAML structures (scalar, list, mapping) by moving qualifier information from the label field to the standard detail field. This is a cleaner, more idiomatic LSP approach that allows clients to render qualifiers separately.
Key Changes
- Moved qualifiers ("list", "full syntax") from label to the
detailfield in completion items - Removed
filterTextsince labels are now clean and filter automatically - Updated
distinctValues()to use a composite key combining label and detail to preserve variants
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| languageservice/src/value-providers/config.ts | Added detail field to the Value interface |
| languageservice/src/complete.ts | Wire through detail field from Value to CompletionItem |
| languageservice/src/value-providers/definition.ts | Updated distinctValues() to deduplicate by label+detail composite key; modified expandOneOfToCompletions() to populate detail instead of appending to label and removed filterText |
| languageservice/src/e2e.test.ts | Updated test to concatenate label and detail for assertion |
| languageservice/src/complete.test.ts | Updated all tests to find completion items by label+detail instead of qualified labels; replaced exact count assertions with more flexible checks |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Follow-up to PR:
Problem
When properties have multiple valid structural forms (scalar, list, mapping), we were appending qualifiers to the label like
runs-on (list)orconcurrency (full syntax). This required:filterTextto the base key so typing "runs-on" would still match all variantsSolution
Use the standard LSP
CompletionItem.detailfield for the qualifier instead. This is the idiomatic approach—detailis specifically designed for showing additional information after the label in completion UI.Before:
After:
Changes
list,full syntax) fromlabeltodetailfieldfilterTextsince labels are now clean (filtering works automatically)distinctValues()to preserve variants with same label but different detailsdetailfield to theValueinterface and wire it through toCompletionItem