vshaxe / haxe-TmLanguage

TextMate grammars for Haxe and HXML
MIT License
7 stars 9 forks source link

Highlight inline templates (jsx/hxx/html, etc) #28

Closed kevinresol closed 7 years ago

kevinresol commented 7 years ago

I see language-haxe (atom) did it (screenshot) So I think it is possible to do.

Or let me know where to start from, I may give it a try.

Gama11 commented 7 years ago

I'm not sure that should be part of this repo, it's not exactly part of Haxe, rather third-party frameworks.

kevinresol commented 7 years ago

I'm not sure that should be part of this repo, it's not exactly part of Haxe, rather third-party frameworks.

No problem, but I wonder if I create a new extension for that, will it be able to coexist with vshaxe?

Gama11 commented 7 years ago

That's a good question. I think you may be able override the Haxe grammar if you have an extension that is loaded after vshaxe, but extension loading order is undefined. It would be cleaner to create a new language ID (haxe-react or whatever) and then remap .hx to that in haxe-react projects in settings.json.

https://github.com/vshaxe/vshaxe/blob/1.7.0/package.json#L197-L230

"files.associations": {
    "*.hx": "haxe-react"
}

Also, I don't think it's necessary to duplicate the entire Haxe grammar - you can include reference / include other grammars (there may even be a jsx one you can reuse that way). For instance, we do that to achieve Haxe highlighting in .hxml files after --macro:

https://github.com/vshaxe/haxe-TmLanguage/blob/4f320e79597e3a9856127add6b3357c072f01b2f/hxml.YAML-tmLanguage#L18

There's another (simple) example here:

https://github.com/vshaxe/vshaxe-debug-tools/blob/master/syntaxes/hxtest.json

Gama11 commented 7 years ago

Note: separate language IDs seems to be the approach that VSCode has taken for JS / TS as well:

kevinresol commented 7 years ago

Thanks for the info. I will take care of them :)

nadako commented 7 years ago

But will vshaxe activate for custom langs?

Gama11 commented 7 years ago

@nadako Why does it need to activate if this is implemented via a separate extension?

Gama11 commented 7 years ago

Oh, for completion etc of course. Hm...

Gama11 commented 7 years ago

Considering #30 is closed, this can probably be closed too.

kevinresol commented 7 years ago

I don't mind if this extension doesn't do the actual highlighting. But at least we need a mechanism. Especially when inline markup may become a standard feature. Shall we reopen and let the discussion go on?

djaonourside commented 7 years ago

Hi, guys! A supporting jsx hightlight and go to definition action is very necessary. So it's unconvenient to use vscode in haxe-react projects. HaxeDevelop can do this things but it runs on windows only.