Skip to content

IDE: complete and validate Component.State keys in :c-* bindings #99

Closed

Description

@JuroOravec

What problem does this solve?

VS Code Citry 0.1.2 with citry-lsp 0.1.3 understands an existing valid :c-* State binding once it is written, but the attribute-name authoring path is incomplete.

Given a component with public State fields such as:

class State:
    query: str
    time: int

typing :c- does not offer the known State-backed attribute names. An invalid binding key also receives no diagnostic:

<input :c-querylol.debounce="refresh">

Here querylol is invalid when the owning component exposes only query and time.

Proposed solution

Extend the existing :c-* IDE contract in every template context where State binding resolution is available:

  1. When completion is requested while writing the attribute name at or after :c-, offer the owning component's available public State fields, producing entries such as :c-query and :c-time.
  2. Diagnose an unknown :c-* State field as an error by default when the owning State namespace is known. For :c-querylol.debounce, underline the querylol field-name segment rather than the prefix or modifiers.
  3. Preserve the existing channel-specific modifier completion/hover and server-handler completion, hover, and navigation on the attribute value.
  4. Keep completion and diagnostics ownership-aware for inline, standalone, and nested templates. Do not invent a closed namespace when the owning component or its State schema cannot be determined.

Acceptance examples

With State fields query and time:

  • :c- completion includes :c-query and :c-time.
  • :c-query.debounce.300ms="refresh" remains valid; query retains hover and navigation to Component.State.query, and refresh retains handler intelligence.
  • :c-querylol.debounce="refresh" produces an unknown-State-field error on querylol.
  • A modifier typo remains separate from a State-field typo and uses the existing modifier diagnostic contract.

This can ship with the next normal VS Code / citry-lsp release; it does not require an emergency republish of the current versions.

Activity

  1. added
    bug
    enhancement
    on Aug 30, 2026
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

    bugenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions