-
Notifications
You must be signed in to change notification settings - Fork 16
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No syntax highliting with js2-mode and rjx-mode #8
Comments
No, this mode doesn't syntax/ident rules. The problem is with the js2-mode parser which requires a strict js syntax without any extensions (but in return gives 100% accurate results). Also flow supports jsx, so fixing j2-mode will be essentially replacing js2-mode Mozilla derived parser with Flow-derived one (means creating yet another one major JavaScript (jsx) mode). web-mode and plain js-mode are better to be used for flow in emacs (in my opinion). Probably there are some workarounds for using js2-mode with flow syntax, but i'm not familiar with anything sensible. |
So I just looked into how rjsx-mode extends js2-mode, and built a little proof-of-concept flow parsing scheme into js2-mode. It can understand type-annotated variables (with structured types, union/intersection types and a few other things, but no generic or function return types yet). If you're interested, I can submit this as a pull request - it does result in rather pleasing-looking JS files for me now, but on the other hand, it does reach somewhat deeply into js2-mode via |
Sure, i can look at it (but not sure when i have enough time). As far as i understand this will check if the major mode is js2 mode and active, right? |
I've took the work of @antifuchs and packaged and enhanced it here: https://github.com/Fuco1/flow-js2-mode You might want to include a link in the readme (I link back here as well :)) for people who are looking for the syntax support/fontification. It's a work in progress but I'd say 70% of the common usage is covered. |
Thanks, added. |
Is this minor-mode supposed to change syntax highlighting ?
I've tried several combinations:
The display is still using default js syntax highlithing (which looks like an error.)
Note that running
flow-mode-status
works as expected.The text was updated successfully, but these errors were encountered: