Repository navigation
Send Twig, YAML and XML documents to PHPantom - #155
giuseppe-esposito-87 wants to merge 2 commits into
Conversation
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
|
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'. |
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
|
Tested this on Zed 1.29.3 as a dev extension (PHPantom 1.0.0), on Symfony 7.4 projects, with PHPantom attached to YAML, XML and Twig: YAML (
XML (Doctrine
Twig
Without this change none of it is reachable in Zed, since the extension only attaches PHPantom to PHP and Blade. Would be great to get this merged 🙏 Note: my build registered the languages without |
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.
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.