Skip to content

Conversation

@ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Dec 23, 2025

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) or concurrency (full syntax). This required:

  1. Setting filterText to the base key so typing "runs-on" would still match all variants
  2. Callers to parse the label if they wanted to render the qualifier differently (e.g., dimmed or in a separate column)

Solution

Use the standard LSP CompletionItem.detail field for the qualifier instead. This is the idiomatic approach—detail is specifically designed for showing additional information after the label in completion UI.

Before:

label: "runs-on (list)"
filterText: "runs-on"

After:

label: "runs-on"
detail: "list"

Changes

  • Move qualifiers (list, full syntax) from label to detail field
  • Remove filterText since labels are now clean (filtering works automatically)
  • Update distinctValues() to preserve variants with same label but different details
  • Add detail field to the Value interface and wire it through to CompletionItem

@ericsciple ericsciple force-pushed the users/ericsciple/25-12-detail branch 3 times, most recently from 1934094 to 96ae040 Compare December 23, 2025 03:37
- 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
@ericsciple ericsciple force-pushed the users/ericsciple/25-12-detail branch from 96ae040 to 10db944 Compare December 23, 2025 17:04
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;
Copy link
Collaborator Author

@ericsciple ericsciple Dec 23, 2025

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.

@ericsciple ericsciple marked this pull request as ready for review December 23, 2025 17:21
@ericsciple ericsciple requested a review from a team as a code owner December 23, 2025 17:21
Copilot AI review requested due to automatic review settings December 23, 2025 17:21
Copy link
Contributor

Copilot AI left a 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 detail field in completion items
  • Removed filterText since 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants