unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Jackson Ray Hamilton <jackson@jacksonrayhamilton.com>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: Comprehensive JSX support in Emacs
Date: Tue, 2 Apr 2019 04:07:15 +0300	[thread overview]
Message-ID: <f30ac596-2023-1c8f-481e-c0b6797d21d2@yandex.ru> (raw)
In-Reply-To: <8f533e76-302f-bd45-9eb5-f23b0bbd0ce8@jacksonrayhamilton.com>

Hi Jackson!

On 27.03.2019 10:03, Jackson Ray Hamilton wrote:

> Following up on my long email from a month ago, wherein I announced my 
> plan to fully support editing JSX in js-mode…
> 
> After many mornings and evenings of hacking (and many moonlight-melted 
> candlesticks, and many moments spent meandering and muttering), I’ve 
> finally got the JavaScript+JSX implementation to a state where I feel 
> it’s worth sharing again.
> 
> I’ve added pretty comprehensive indentation and font-locking support, 
> along with relatively simple automatic JSX detection support.

Thanks a lot!

I've checked out Marcin's branch and played with it a bit. To the 
untrained eye, at least, things work quite well. So as far as I'm 
concerned, you can just push the new code to master and continue 
refining it there. Especially since you seem to add tests quite regularly.

I personally don't work with JSX (or even JavaScript much, these days), 
so I hope others who do will provide more valuable feedback regarding 
missing features and regressions. It's probably still worth it to get 
the feature into master soon.

Do you have commit access?

> The indentation and font-locking code complimented each other well.  In 
> order to fix issues like the one with an unterminated quote inside JSX 
> (https://github.com/mooz/js2-mode/issues/409) (which truly haunted me 
> for the past years) I had to thoroughly parse the JSX code.  The 
> information I gained from parsing eventually led to the resolution of 
> all the failing indentation test cases I compiled, and some new ones I 
> added along the way.

:thumbsup:

> js-mode no longer relies on sgml-mode for any parsing or indentation.  
> It’s all performed precisely according to the semantics of JSX now, 
> borrowing just two blocks of code from sgml-mode as a basis for 
> overlapping indentation logic.  Also, the JSX code has pretty colors 
> now.

The colors are very nice to have. Do you think this approach is portable 
to js2-mode?

> I mentioned that a “js-syntax-extensions” list might have some esoteric 
> advantage by its ordering resolving theoretical conflicts between 
> multiple syntax extensions, but I figure 1) we can cross that bridge 
> when we get there, and 2) if we did add more syntax extensions for JS 
> /and/ those syntax extensions did partially conflict /and/ users wanted 
> to use conflicting extensions simultaneously, perhaps it’d be better to 
> add some booleans that would resolve such conflicts on a case-by-case 
> basis, anyway.

Maybe, yes.

> Taking into consideration Dmitry’s ambivalence on deprecating 
> js-jsx-mode and js-jsx-indent-line, I figured we could strike a 
> compromise.  We can keep these APIs without marking them obsolete.

*shrug* The way you've implemented jsx-jsx-mode is basically begging for 
an obsoletion marker. I don't really mind, though.

> However, I’ve tried to make the automatic detection of JSX—and the 
> viable alternatives to manually enabling JSX support—/so effective/ and 
> numerous as to render these functions superfluous relics.  The 
> go-forward answer to “how to enable JSX support in Emacs?” should be 
> “upgrade to Emacs 27—now it just works™”.
> 
> I also addressed the spelling / naming items that Stefan brought up.
> 
> I had a chance to play with the code in a few projects of mine over the 
> past week, and generally it is working well for me—much better than 
> before, in all the previously painful cases.  However, there is a 
> noticeable delay when editing some lines in my 1000-line monolith.jsx 
> file,

This sounds a bit worrisome. Slow font-lock rules?

But since you're working on this already, just let us know if you hit 
some strong obstacles there.

> (Note that the patch 
> “0015-Indent-broken-arrow-function-bodies-as-an-N-1th-arg.patch” isn’t 
> really related to the JSX feature.  I was just editing some code in a 
> project of mine, and found that this change provided more desirable 
> behavior with the code I was writing then.  A lot of my code using JSX 
> also uses arrow functions, so this was a convenient patch for me to lump 
> in.)

LGTM.

Thanks!



  parent reply	other threads:[~2019-04-02  1:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14  5:06 Comprehensive JSX support in Emacs Jackson Ray Hamilton
2019-02-14  8:03 ` Marcin Borkowski
2019-02-14 14:10 ` Stefan Monnier
2019-02-14 15:04   ` Clément Pit-Claudel
2019-02-15  8:21   ` Jackson Ray Hamilton
2019-02-15 13:25     ` Stefan Monnier
2019-02-15 13:54     ` Dmitry Gutov
2019-02-15 14:39 ` Dmitry Gutov
2019-02-16 20:50 ` Jostein Kjønigsen
2019-02-18  7:17   ` Jackson Ray Hamilton
2019-03-27  8:03 ` Jackson Ray Hamilton
2019-03-27  9:36   ` Marcin Borkowski
2019-03-30  2:18     ` Jackson Ray Hamilton
2019-04-02  1:12       ` Dmitry Gutov
2019-04-06 16:09         ` Jackson Ray Hamilton
2019-03-30  2:08   ` Jackson Ray Hamilton
2019-04-02  1:07   ` Dmitry Gutov [this message]
2019-04-02 11:23     ` Stefan Monnier
2019-04-06 16:02       ` Jackson Ray Hamilton
2019-04-07 23:19         ` Jackson Ray Hamilton
2019-04-09  6:06       ` Jackson Ray Hamilton
2019-04-09  8:12         ` Eli Zaretskii
2019-04-10  1:56           ` Jackson Ray Hamilton
2019-04-10 15:43             ` Eli Zaretskii
2019-04-06 15:55     ` Jackson Ray Hamilton
2019-04-07  0:31       ` Dmitry Gutov
2019-04-09  6:16         ` Jackson Ray Hamilton
2019-04-09  7:10           ` Marcin Borkowski
2019-04-09  8:00             ` Jackson Ray Hamilton
2019-04-11 19:51               ` Marcin Borkowski
2019-10-20 16:57                 ` Steinar Bang
  -- strict thread matches above, loose matches on Subject: below --
2019-02-15  6:38 Jackson Ray Hamilton
2019-02-17  6:10 ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f30ac596-2023-1c8f-481e-c0b6797d21d2@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=jackson@jacksonrayhamilton.com \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).