Comment Shortcut Improvement in Complex Comment situations in tree-sitter based syntax extension


I had a feature request for Nova to allow us to implement a more complex universal comment. At the moment there is a discrepancy between the comment defined by the extension in the syntax.xml and the injected languages when using tree-sitter grammar.

To give you an example:
For Blade, if I have an empty document and press cmd+/ it will initiate the comment correctly

{{-- comment-- }}

Now consider the following, pressing cmd+/ in the html injected region in a blade file:

    <!-- comment -->

This, in fact is fine in many injection situations including markdown code blocks and so forth, the user expects that the entire region to be treated as html, including the comments.

However this is not the case for frameworks like Laravel. In blade the entire document is pretty much like a php file, loaded with html and php-code, with extra features added on top using the directives. The comment itself is part of the framework templating engine, ie universal and can be written anywhere in the blade document including the injected regions, alongside the html’s own comment syntax (please note the html comment syntax is still valid for special use cases in a blade, but not the preferred one).

As a result, I would like the ability to have the extension’s comment syntax to have a default, higher priority than the injected language comment syntax when using the cmd+/ shortcut:

   {{-- comment --}}

Thankfully everything else works fine. As shown below Nova picks both regions correctly as a comment. So if we can sort the shortcut situation that would be brilliant.