From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Comprehensive JSX support in Emacs Date: Tue, 2 Apr 2019 04:07:15 +0300 Message-ID: References: <8f533e76-302f-bd45-9eb5-f23b0bbd0ce8@jacksonrayhamilton.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="75362"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:66.0) Gecko/20100101 Thunderbird/66.0 Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org To: Jackson Ray Hamilton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 02 03:08:21 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hB7uV-000JRc-QZ for ged-emacs-devel@m.gmane.org; Tue, 02 Apr 2019 03:08:20 +0200 Original-Received: from localhost ([127.0.0.1]:50463 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB7uU-000259-MG for ged-emacs-devel@m.gmane.org; Mon, 01 Apr 2019 21:08:18 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB7tk-00024n-QZ for emacs-devel@gnu.org; Mon, 01 Apr 2019 21:07:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hB7ti-0001eL-9L for emacs-devel@gnu.org; Mon, 01 Apr 2019 21:07:32 -0400 Original-Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:35102) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hB7te-0001PW-0y for emacs-devel@gnu.org; Mon, 01 Apr 2019 21:07:28 -0400 Original-Received: by mail-lj1-x244.google.com with SMTP id t4so9978161ljc.2 for ; Mon, 01 Apr 2019 18:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=g07Ch9iRq69TyRxuEBN8IPvdeB91eetFHMWdIxwfgHg=; b=vHOplP9fuF6SxXyc1Ph8tmr7iyF7RkbnnBaTm9lzipmD0Lvl8jgl3BMQoY2nfM3o8R NTG4dsD9JN+kgEJVWqk8irDSr7K50k2LibTxU7IreovCZFmrZ2QgbvXzs4ExA0iIgbPq iegKzBCC8owJxurMkxBrIucjU3k5u+lThjpW93PGt4+jxwHB4tunPFJcJQhNsloqKgNU fRcVTUdQePWA/A9ZF8HuCAun2Esf2b3CSbExPd1Onj0977CcvEFyNco8+EZ8Ldj1jLle wl1+78XHFoSot9lnnRdtdy/1UpC9KFLkOdFYw5VvBJbvf5kpRVKh5VjTVnp8HADx4Ku5 OZ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=g07Ch9iRq69TyRxuEBN8IPvdeB91eetFHMWdIxwfgHg=; b=BYuhQ+GFGX5faWW6SnSrFhqkAMpC5E8/w8tVQAq9BBTLMlnW6kG0Oi+ltUcYGdYr2w bhOVPqNqxaSJIZXSJtwOjXDhIJ/JxRJJUYu1l2oUJEedLZ9s9aDgEfkUWM48qMPjlQ2m O3gNuWpwCTwAIugd2HdfvgTzU1m/Is5gYo4fsydeqbkhde3CmOx8KA4GVrrQm1pGBdvs qPG+OG81d66VejPh85roxP9fY7sab7+TGOjcs5aO9GUotF1p4DGyssJJnR7SekiOcwhp n22lcDiNbVEh7ByHymze3aStgIi9BG5vPqwc1cfQtSuZsDFPRyykNpyKQfdyZJFi/enX UblQ== X-Gm-Message-State: APjAAAW3qTFxI3WR4VMbmTKBodLj0ttYz5kJHrC6I8lUGROZAfdXLvlB vw+qIfBZ2ZpAbOOjfiVSMR4= X-Google-Smtp-Source: APXvYqyQxdi1m81NLnHrJ89VgoVBIHLTjUxCQzzbMPBauFIGlwbjH3Vxxt+5AOoLbFrca/seuJWFoA== X-Received: by 2002:a2e:5056:: with SMTP id v22mr37213615ljd.153.1554167238635; Mon, 01 Apr 2019 18:07:18 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.174.23]) by smtp.googlemail.com with ESMTPSA id d77sm2209958lfg.55.2019.04.01.18.07.16 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 18:07:17 -0700 (PDT) In-Reply-To: <8f533e76-302f-bd45-9eb5-f23b0bbd0ce8@jacksonrayhamilton.com> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::244 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:234853 Archived-At: 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!