Hello,
I’m the developer of the Twig language plugin for Nova. Twig is a PHP-based templating language used by many projects, e.g. Drupal or Craft CMS.
My language plugin has two syntax definitions: Twig-HTML (Twig code alongside regular HTML tags) and Twig (Twig code inside bracktes). It’s pretty similar to the original PHP-syntax (before the Tree-sitter update).
The Twig-HTML syntax definition includes the original HTML syntax definition and expands it with a few <template-scopes>
.
<scopes spell-check="true" lookup="dictionary">
<include syntax="html" />
</scopes>
See: https://github.com/tpmatthes/Twig.novaextension/blob/main/Completions/Twig-HTML.xml
This make it possible to use HTML tags and Twig syntax alongside each other in .twig files.
In Nova 9.x, everything works just fine: HTML tags inside .twig files will be highlighted correctly, tags will be closed automatically if you type </
, and you can rely on the full set of built-in completions for HTML tags and attributes.
In Nova 10+, the syntax highlighting for HTML tags works as expected. However, tags won’t be automatically closed anymore and only a small fraction of built-in completions for HTML tags and attributes will be triggered.
In both versions, syntax highligting and completions for Twig work as expected, so it seems like this problem is caused by the new version of the built-in HTML syntax definition (using Tree-sitter).
My Twig language plugin is still regex-based, but I’d like to keep using the built-in HTML syntax definition which is now based on Tree-sitter. Is this possible?
As I can see, the new version of the built-in HTML syntax definition includes a few regex rules for backwards compatibility. Maybe that’s the reason why syntax highlighting for HTML tags still works?
I’d be happy to learn more about how Nova handles this case internally, so I can address this issue accordingly. Thanks!