Skip to content

bug: enum input values aren't offered, and an enum input with a default never shows its dropdown #204

Description

@X-Guardian

Bug summary

For a component input that declares options: (an enum), completion does not help you pick an allowed value in two situations:

  1. Value position — with the cursor after inputName: (where you type the value), completion offers the list of input names again instead of that input's allowed values. There is no way to pick an enum value from a dropdown at the point you are setting it.
  2. Name acceptance, enum + default — when an enum input also declares a default:, accepting the input by name inserts the bare default value (e.g. critical) instead of offering the enum choice. The allowed alternatives never appear, so the default silently wins.

The name-acceptance dropdown does work for an enum input that has no default — that path was added previously. The two cases above were never handled.

Steps to reproduce

  1. Open a .gitlab-ci.yml with an include whose component has an enum input (see snippet).
  2. Value position: put the cursor after environment: (in the value slot) and trigger completion. Observe the suggestions.
  3. Enum + default: on a blank input slot, trigger completion and accept an enum input that also has a default:. Observe what gets inserted.

Expected behavior

  1. In the value position after inputName:, completion offers that input's allowed values (e.g. staging, production) as selectable items; picking one inserts the bare value.
  2. Accepting an enum input by name inserts a ${1|a,b,c|} choice so the allowed values are one keystroke away — even when the input has a default. The default is pre-selected (placed first), not used to suppress the choice.

Actual behavior

  1. In the value position, completion offers the list of input names (the name-slot suggestions) rather than the input's allowed values.
  2. Accepting an enum input that has a default inserts the bare default value with no dropdown; the other allowed values are unreachable from completion.

Component context (if applicable)

No response

Minimal .gitlab-ci.yml snippet

include:
  - local: "templates/deploy.yml"
    inputs:
      environment:    # value position here offers input names, not staging/production


with `templates/deploy.yml`:


spec:
  inputs:
    environment:
      type: string
      default: staging          # accepting `environment` by name inserts `staging`, no dropdown
      options:
        - staging
        - production

Extension logs

N/A

Affected area

Completion provider

Extension version

0.14.1

VS Code version

1.126.0

Node.js version

No response

Operating system

macOS

Pre-submit checks

  • I searched existing issues and did not find a duplicate.
  • I can reproduce this on the latest version from main/beta.
  • I included a minimal YAML snippet and relevant logs.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions