COMMUNITY

Bounty 200$ - VSCode haxe-jsx extention

jsx
react
haxe-js

(Alexander Djafarov) #41

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


(Jérémy Faivre) #42

Just updated the grammar with latest haxe syntax (https://github.com/jeremyfa/haxe-TmLanguage).

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!


(Alexander Djafarov) #43

Thank you anyway:)


(Jérémy Faivre) #44

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: https://lib.haxe.org/p/xmlgrammar/

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