From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: JavaScript/TypeScript: What do people in 2024, on emacs 29, use for .js, .jsx, .ts and .tsx? Date: Tue, 9 Jan 2024 19:32:31 +0200 Message-ID: <77493010-0b8f-4173-88ed-e726b89a3fad@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11708"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Steinar Bang , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 09 18:33:13 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rNFyR-0002kM-CA for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 09 Jan 2024 18:33:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNFxx-0007ym-IV; Tue, 09 Jan 2024 12:32:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNFxv-0007tD-UI for help-gnu-emacs@gnu.org; Tue, 09 Jan 2024 12:32:39 -0500 Original-Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNFxu-0003BL-37 for help-gnu-emacs@gnu.org; Tue, 09 Jan 2024 12:32:39 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id EA09B5C01AE; Tue, 9 Jan 2024 12:32:35 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 09 Jan 2024 12:32:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1704821555; x=1704907955; bh=lvSwZ+AfGbhfgoRGn6yMStPbY9vMoRZcNs93c6x4i28=; b= I5RmE65xOTMfiC6PGKrhmVx+OeeZ1RBDWFmxNX45UjR/Jm7lujlhRWLtYIo0w55y pFetIzAsDPjvJW/P89CgKObCEHW59nf8m7YmfrvtniCa6xVCv6FLcaSUB7egqvfH NQ+QbvnweN/nrlYneR07BO8agL1t2rjxkAHaMl/2SUB6tmOL7LIwa379cY8gNxqE 0dKgOnFzvOKLapDmz80jBrJefuGhUs6CKSpYAbu7O5UMfim7dydbv1qofd0Cfx83 o9qPAC2UBByV7PeZeT5A1kU0dLO9RRAtXX180sY+uwrBM9L5uC/EissFajWFpiyM 49UuNSE8zLya6++GKQI3bA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1704821555; x= 1704907955; bh=lvSwZ+AfGbhfgoRGn6yMStPbY9vMoRZcNs93c6x4i28=; b=Q ho9DSPAFF2yNiD+cSoXmDltmaY34MGc7OU8xqrIBD5DwanbkMi5PYFHlX4dwYyaF K/+u+Kr7vndLtyBGzC/KLe+e5v3bUX3BxiQu8VYI737kURr+0AwpADur1qollodx BMVKCMqgDf7VUGA6DWcXmqcRH9gPGOuicc9Hi5IULI2GP/6WSG70gwiVQ1IGmdPp 238CAUZoqoMEbFNxA1fL0+c3ANsoUzjh/nDmAifOZ1FdBxRezYqq8HuI++4ctqWy tSKHPGx6TVb1EpuwFIRqg5euIxFhYTxJYsN9Hpbr+A2tjg3otwY1YsrPRBV2BoOi PNxPjD0hk/J81ikSkjLgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehledguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhephfeftdfhudejleelfeekjedtheefjedvlefgieeuteekheeuffekgfdviefg hfdtnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 9 Jan 2024 12:32:34 -0500 (EST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=66.111.4.27; envelope-from=dmitry@gutov.dev; helo=out3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145709 Archived-At: On 09/01/2024 14:12, Steinar Bang wrote: > So I decided to see what came up as default on emacs 29. > > What I get according to 'C-h m', is: > The major mode is JavaScript[JSX] mode defined in js.el: > > JSX tag syntax seems to be highlighted correctly and indentations seems > to be correct (I'm usinghttps://github.com/editorconfig/editorconfig-emacs ). > > But there doesn't seem to be the same electric tag splitting behaviour I > have on JSX mode...? Though that may be a configuration possibility...? > > What do others use? > > And what about typescript? > > I don't like typescript so I don't use that in any of my private > projects, but when working with frontends I have to adapt. > > Last time I worked with typescript (2021-2022) I think I ended up with > something called tide and web-mode for the .ts and .tsx files, while > staying with rjsx-mode for .js and .jsx files. > > I don't know if that's still the way to go for typescript or if the > built-in javascript mode now handles typescript? js-mode handles JSX indeed, but it's inevitaby limited in what it understands about its syntax (it uses sgml-mode under the covers to do highlighting, but I'm sure there would be odd edge cases). The latest new option in 29.1 is js-ts-mode (which uses tree-sitter parser and supports JSX too). It should provide the most accurate highlighting and reliable indentation, but some features (like tag splitting?) might have to be reimplemented anew. Should be easier to do that using tree-sitter parse tree than with sgml-mode. Perhaps if rjsx-mode has an implementation, it wouldn't be too hard to port it.