Skip to content

bug: a !reference tag anywhere in the file suppresses all input completion #262

Description

@X-Guardian

Bug summary

!reference [.job, key] is GitLab's own YAML tag for splicing another job's key into the current one. It belongs to no YAML schema, so js-yaml throws unknown sequence tag !<!reference> when it hits one. The throw is caught and the parse returns null/[], which takes down the entire file — the include: block included — even though the tag sits in an unrelated job further down. The completion, hover, and validation providers then see no include: and silently do nothing.

!reference is common in real pipelines (it is the standard way to reuse a .setup-style hidden job's script), so any file using one loses input completion entirely.

Steps to reproduce

  1. Open a .gitlab-ci.yml with an include: entry carrying an inputs: block, and a later job using - !reference [.some-job, script] (see the snippet below).
  2. Put the cursor on a blank, correctly-indented line inside that include's inputs: block.
  3. Request input-name completion (Ctrl+Space).

Expected behavior

  • Input-name completions are offered for the include's not-yet-set inputs. The !reference tag is in an unrelated job and should have no bearing on the include: block.

Actual behavior

  • No completions are offered. The debug log shows No inputs parameter-name slot at cursor.
  • Deleting the - !reference [.pnpm-setup, script] line makes completions work immediately — confirming the tag is the trigger.

Component context (if applicable)

Component URL: n/a (reproduces with local: and component: includes)
GitLab instance: n/a
Project path: n/a
Version/reference: n/a
Source type: local include / component

Minimal .gitlab-ci.yml snippet

include:
  - component: $CI_SERVER_FQDN/my-group/my-project/my-component@1.0.0
    inputs:
      # cursor on the blank line here — no completions offered before the fix

.pnpm-setup:
  script:
    - corepack enable
    - pnpm install --frozen-lockfile

test:
  script:
    - !reference [.pnpm-setup, script]
    - pnpm test

Extension logs

N/A

Affected area

Completion provider

Extension version

0.16.2

VS Code version

1.128.0

Node.js version

22.x

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