Closed EmranMR closed 10 months ago
Hi @yaegassy and @calebdw!
I hope you are both very well! Can I please have your input on the v0.8.0
before I push it? There are breaking changes and I would really like to know if this is possible in Nvim! Everything is working as expected in Nova, it is just I am not sure about NVim. π
I have pushed the Envoy
branch so that you can have a look, pull and play around
Here are the supported predicates in Nvim, I can see there is also a has_ancestor
in the source code but I would like to have your input whether the new injections.scm
I have created, can simply be used as a copy and paste solution when users upgrade to v0.8.0
$text
node was un-aliased. It just did not make sense anymore semantically and it has become very inflexible for future releases and updates as the project is growing. simply because the actual general text can mean anything, html, shell etc.(#has-ancestor? @attr "rule_set")
; AND
(#not-has-ancestor? @attr "rule_set")
This was utilised to create a new injections.scm
((text) @injection.content
(#not-has-ancestor? @injection.content "envoy")
(#set! injection.combined)
(#set! injection.language php))
((text) @injection.content (#has-ancestor? @injection.content "envoy") (#set! injection.combined) (#set! injection.language shell))
((php_only) @injection.content (#set! injection.combined) (#set! injection.language php_only)) ((parameter) @injection.content (#set! injection.language php_only))
Are the queries above valid in Nvim as well. Because that is the only change the users need to apply to start using `0.8.0^`
- " parse text as shell if it has the `$envoy` as an ancestor, if not parse as php"
I hope it works because the results are amazing, you have php, html and shell injection in one document. The precision provided by tree-sitter is just mind blowing. I do not know any parser out there that this can be done with! Below is the working end result in Nova! π
π€―
<img width="625" alt="Screenshot 2023-11-30 at 12 16 38" src="https://github.com/EmranMR/tree-sitter-blade/assets/11975985/ef55d9b5-da33-4210-810f-80e4533cceb9">
Hi @EmranMR,
This is neat, however, the shell
language does not exist---I had to update to bash
@calebdw thank you so much for taking time and checking this. I really appreciate it!
I shall get on drafting the release.π
And good catch with the shell
as well, that was not intended!
I will certainly change to bash in theinjections.scm
, to avoid confusion for the broader audience! βΊοΈ
There is a bug, where, if you are in the
$.envoy
node, theshell
injection is not applied recursively. Whereby after one level of nesting it is parsed as HTML textExample
injection.scm
injections.scm
However this is unfortunately necessary to make the parser future proof and removing duplication, ie creating a separate
$.envoy_definition
which basically mirrors$.definition
, when implementingenvoy