Skip to content

[Feature] Script Task Virtual Documents with Language Support & AI Writeback #860

@peterhnm

Description

@peterhnm

Motivation

When editing script tasks in the BPMN properties panel, users are limited to a small text area without syntax highlighting, IntelliSense, or AI assistant support. This makes writing and maintaining non-trivial scripts painful — especially for Camunda 7 projects that rely on inline Groovy or JavaScript.

Feature Description

Virtual Documents via FileSystemProvider

When a user selects a scripting language on a script task and clicks an "Open in Editor" button, the extension opens a virtual document (bpmn-script://<taskId>/script.<ext>) in a full VS Code editor tab. Using FileSystemProvider (not TextDocumentContentProvider) ensures the document is writable, so:

  • Users get full syntax highlighting and IntelliSense
  • AI coding assistants (e.g. Claude in VS Code) can read and write the document
  • Edits are synced back to the <script> element in the BPMN XML automatically

Autocompletion for Camunda 7 APIs

Provide autocompletion for the Camunda execution context (execution, task, connector) across supported script languages:

Language Approach
JavaScript .d.ts type declaration stubs — full IntelliSense out of the box
Python (Jython) .pyi stub files — picked up by Pylance automatically
Groovy Custom CompletionItemProvider scoped to bpmn-script scheme
Ruby (JRuby) Custom CompletionItemProvider (lower priority)
JUEL Custom CompletionItemProvider (lower priority)

Phased Rollout

Phase 1 — Virtual Documents + JS/Python stubs (high value, low effort)

  • Implement FileSystemProvider for bpmn-script:// URI scheme
  • Ship .d.ts stubs for the Camunda 7 execution context (e.g. execution.getVariable(), task.getAssignee())
  • Ship .pyi stubs for Python/Jython equivalent
  • Map BPMN properties panel language selection → VS Code languageId
  • Sync virtual document edits back to BPMN XML <script> content

Phase 2 — Groovy autocompletion

  • Register a CompletionItemProvider for Groovy scoped to the bpmn-script scheme
  • Cover execution.*, task.*, and connector.* API surfaces

Phase 3 — Ruby / JUEL (lower priority)

  • Same CompletionItemProvider pattern for remaining languages

Acceptance Criteria

  • FileSystemProvider registered for bpmn-script:// scheme; virtual documents are read/write
  • Opening a script task in the editor sets the correct languageId based on the selected script language
  • Edits in the virtual document are synced back to the BPMN XML model
  • JavaScript .d.ts stubs provide IntelliSense for execution, task, and connector objects
  • Python .pyi stubs provide equivalent autocompletion via Pylance
  • AI tools (e.g. Claude for VS Code) can read and edit virtual script documents
  • Groovy CompletionItemProvider offers completions for execution.* methods

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions