Tree-Sitter php Injection Help for Syntax Extension Developments

Feature Requests Get Help

Hi

I have reached a roadblock🚫, and I was hoping if anyone could help.
Basically I am creating a blade extension based on a tree-sitter grammar I wrote.

The extension requires base-php to be injected into double brackets {{ parse-me-as-php }} as well as inside various other syntaxes.

Before Nova 10, I think it was possible to inject php using the php-base.xml.

The actual php-base.xml is still in Nova, for backward compatibility. However it is useless for the tree-sitter grammars. I can inject php but the problem is, that php already starts by injecting html . This means that even though I can inject php, I end up practically injecting html :face_with_spiral_eyes:

Therefore the only way for the user to get all the php autocompletion goodies, is inside the default <?php ?> tag, rendering all the template tags and the injections useless.

I really dont think this is possible at the moment with Nova 11, hence placing it under “feature request”, BUT if anyone knows a better way to do this, I would really appreciate the help as I can not develop any further without the ability to inject php :confused:

Should be a fairly easy fix for the future tbh? Nova needs to practically not inject html when the extensions tries to inject php

P.S: I also need to inject html inside blade as well, but I would be following the same procedure as the internal php. As a result I would rather decide myself when and where php and html are injected.

Thanks
Emran

Hi @logan I was wondering if you had a chance to look at this feature request?

My tree-sitter grammar is pretty much finished, and the extension is almost ready for the release.

The ability to inject pure php using tree-sitter query is all that is left for the initial release :blush:

I had a sneak peak into:
/Applications/Nova.app/Contents/SharedSupport/Extensions/PHP.novaextension
But I did not find any .dylib file in the Syntax/ folder. So initially I tried to copy everything in that folder, create a .dylib using the modified official tree-sitter-php and changing the names to base-php and tree-sitter-base-php. I then removed the injection query to get things working but I got told off by the extension log whoops :joy:

This would be immensely beneficial for pretty much every php framework! :pray::pray::pray::pray:

Thanks
Emran

Soooo…
I just released my tree-sitter-blade into the wild to get some feedback from the community (damn that was hell of a challenge! :sweat_smile:).

As it turns out, the injection problem is not limited to Nova :man_facepalming:. The NeoVim users report the same problem which actually makes sense, both are using the tree-sitter-php

So I am now on a mission to “possibly” create the required tree-sitter-phpbase and see if we can eventually add this new syntax into the core first party tree-sitter based syntax extensions completion.xml so that the auto completion pop in the future phpbase as well. :blush: