Bounty 200$ - VSCode haxe-jsx extention

@jeremyfa Could you please update your version of haxe-TmLanguage according the latest official one.

Just updated the grammar with latest haxe syntax (GitHub - jeremyfa/haxe-TmLanguage: TextMate grammar files for Haxe and hxml used by the vshaxe extension).

The last idea that came of from this thread was that xml-in-single-quoted-strings syntax could be merged with main haxe repo given that the xml syntax part is on a separate grammar file.

I unfortunately didn’t manage to make it work with a separate file so we are pretty much at the same state as before. That said, even though the xm-related stuff is in the same grammar file as haxe language itself (in my repo), it is very loosely coupled with the rest of the grammar (thanks to that it took me only 5 minutes to merge with latest haxe changes).

Actually, it’s just about adding this line in single quoted string patterns:

- include: '#xml-in-single-quoted'

…and adding a big block of code at the end of the grammar file completely independent to the rest of haxe grammar.

It would be great if this could be merged with main haxe grammar repo as I believe it can only be beneficial to the community and would be very easy to remove if haxe team comes up with a better solution later, but I don’t have the bandwich currently to work more on it nor try to move the xml grammar in a separate file (not even sure this would be easily doable).

All I can say is that from all the test I have done, it seems to work great and doesn’t break any existing syntax. Invalid/Unclosed xml tags in strings are not breaking syntax highlighting anymore either.

So it’s up to haxe team to either merge it as is, rework it to make it fit with their requirement or simply discard it. The code is there and available for anybody to use it!

4 Likes

Thank you anyway:)

I have just submitted a small utility that creates a patched grammar from the main haxe repo to add xml syntax highlighting in single-quoted strings.

You can find it here: xmlgrammar (0.1.2)

It’s pretty rough but allows to patch grammar for vscode with a single command:

haxelib run xmlgrammar --vscode --vscode-ext-path '/path/to/your/.vscode/extensions'

Edit: I could not test it on windows yet, but it may work with haxelib run xmlgrammar --vscode --vscode-ext-path %USERPROFILE%\.vscode\extensions

3 Likes

in case someone still need it i have made haxe jsx extension to highlight syntax inside string argument of the jsx function.

it’s based on @jeremyfa PR to vshaxe

4 Likes

Awesome, that’s how I imagined this could / should work (with an injection grammar - I didn’t think of that at the time of the PR though). :slight_smile:

However, maybe there’s a more fitting icon that could be used on the marketplace - both to better indicate what the extension does and to distuingish it from the main Haxe extension? A screenshot in the readme wouldn’t hurt either.

1 Like

thanks for your feedback. it’s done!

2 Likes