Skip to content

Send Twig, YAML and XML documents to PHPantom - #155

Open
giuseppe-esposito-87 wants to merge 2 commits into
zed-extensions:mainfrom
giuseppe-esposito-87:feat/phpantom-twig-yaml-xml
Open

giuseppe-esposito-87 wants to merge 2 commits into
zed-extensions:mainfrom
giuseppe-esposito-87:feat/phpantom-twig-yaml-xml

Conversation

@giuseppe-esposito-87

Copy link
Copy Markdown

🤖 This was written by an AI agent on behalf of @giuseppe-esposito-87 (claude-code/claude-opus-5-5).

Lets PHPantom serve Twig templates and YAML and XML configuration files, as the VS Code extension already does. PHPantom answers completion, go to definition, references and rename for the names a PHP project writes in those files: Symfony and Drupal services, routes, templates and translation keys.

  • Added, not replacing. The files keep their language, and the Twig, YAML and XML extensions keep serving them.
  • Opt-in. The three languages are listed in opt_in_languages, so PHPantom never starts for them unless a user enables it, and a project without PHP is unaffected. Zed versions before 1.24 ignore that key.

To enable it, add PHPantom to the language, ideally in a PHP project's .zed/settings.json:

{
  "languages": {
    "YAML": { "language_servers": ["phpantom", "..."] },
    "Twig": { "language_servers": ["phpantom", "..."] }
  }
}

Tested as a dev extension in Zed 1.27 on a Drupal 11 site, with the PHPantom Drupal support from PHPantom-dev/phpantom_lsp#535: go to definition from a routing file to the controller, from a menu link and a Twig path() to the route, and references from a route to its PHP, YAML and Twig uses. Formatting a YAML file still goes to the YAML extension.

PHPantom answers completion, go-to-definition, references and rename for the names it reads in Twig templates and in YAML and XML configuration (services, routes, templates, translations). The files keep their language; the Twig, YAML and XML extensions keep serving them.

Assisted-by: claude-code/claude-opus-5-5
Zed's defaults set no language_servers for these languages, so without this every user of the extension would get PHPantom on any YAML, Twig or XML file, in projects without PHP too. Users enable it per language, ideally in the project settings of a PHP project. Zed versions before 1.24 ignore opt_in_languages.

Assisted-by: claude-code/claude-opus-5-5
@cla-bot

cla-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @giuseppe-esposito-87 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@giuseppe-esposito-87

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot cla-bot Bot added the cla-signed label Nov 5, 2026
@cla-bot

cla-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant