coffee-mode icon indicating copy to clipboard operation
coffee-mode copied to clipboard

feature request: support React

Open coyotemarin opened this issue 10 years ago • 6 comments

I'm using CoffeeScript for my startup, SpendRight and really appreciate being able to use coffee-mode in Emacs. I'd love to use React as well (compiling it with @jsdf's coffee-react compiler), but I don't have a working coffee-react mode for Emacs.

For plain JSX (i.e. JavaScript with React), the React project recommends just using web-mode.el, though there is also a jsx-mode, created by @abicky.

I haven't worked on emacs modes before, so I really have no idea if combining one emacs mode with another is easy or difficult. If it is relatively easy, I would totally appreciate it. :)

(I'm also the maintainer of mrjob and get feature requests all the time, so if you don't have the time or have different priorities for your project, I totally understand where you're coming from.)

coyotemarin avatar Jun 22 '15 17:06 coyotemarin

I don't understand React well. What feature should we implement for supporting React ? syntax highlight ? indentation ? others ?

syohex avatar Jun 24 '15 06:06 syohex

Just indentation would be awesome. Right now, if I try to have a block of JSX (basically an HTML template) in the middle of my coffeescript, it messes up the indentation of any coffeescript code below it.

coyotemarin avatar Jun 24 '15 18:06 coyotemarin

IIRC the CoffeeScript dialect of JSX is called CSX (could be wrong!)

Edit: wrong ... it's cjsx

jasonm23 avatar Dec 10 '15 05:12 jasonm23

https://github.com/jsdf/coffee-react

jasonm23 avatar Dec 10 '15 05:12 jasonm23

I'm curious enough to take a stab at this when I get some time, maybe this weekend or next... it seems js2-mode apparently has support for inline JSX now. I think just fixing indentation would be awesome, and syntax highlighting would be sweet as well. I wonder if something like MuMaMo would work, but I feel like that's more heavyweight of an approach than we really need.

(Note that I haven't worked with major modes before, but I've done a smattering of elisp here and there, so no idea how long it would take me to figure out what even needs to be done).

ibrahima avatar Jan 29 '16 20:01 ibrahima

That would be cool. Not urgent for me anymore; CoffeeScript's syntax is clean enough that you can create very readable code just using short names for React functions and CoffeeScript's indentation-based syntax.

CoffeeScript can be a bit brittle though; sometimes surprising things happen when you leave out a comma. So CJSX would probably be a bit more maintainable with proper editor support.

coyotemarin avatar Jan 29 '16 20:01 coyotemarin