Skip to content

Participants introduced via messages (A.m(), A->B) are missing from autocomplete suggestions #804

@MrCoder

Description

@MrCoder

Steps to reproduce

  1. In the DSL editor, type OrderService.save()
  2. Press Enter.
  3. Type Order.

Expected

OrderService appears in the autocomplete list — it is a real participant (it renders as a participant box in the preview, and the ANTLR oracle recognises it as a message endpoint).

Actual

OrderService is not suggested. Only participants declared via an explicit @Type Name / bare-name declaration are offered; participants introduced implicitly by a message (A.m() From/To, A->B From/To) are invisible to autocomplete.

Location

web/src/editor/participantManager.ts:39-51 (collectParticipants)

Cause

collectParticipants iterates only Participant nodes and reads their direct Name child. The Lezer tree for OrderService.save() is Statement > Message > … > FromToPart > To > Name("OrderService") — there is no Participant node, so the endpoint name is never collected. A->B: msg similarly yields From > Name / To > Name outside any Participant. The ANTLR conformance oracle already includes these (web/src/editor/conformance/oracle.tsoracleParticipants() via ToCollector.onTo), so the editor's set is a strict subset that drops every message-introduced participant.

Fix sketch

Also collect From / To direct Name children in the tree walk:

if (nodeRef.name === 'From' || nodeRef.name === 'To') {
  const nameNode = nodeRef.node.getChild('Name')
  if (nameNode) names.add(state.doc.sliceString(nameNode.from, nameNode.to))
  return false
}

Note

web/src/editor/participantManager.test.ts:117 ("starts empty for a document with no participant declarations") deliberately uses a comment-only doc to sidestep this gap — it must be updated alongside the fix.

Found via the report-bug skill (browser-driven repro on :3000).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions