From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59691: Html-like constructs fail in typescript Date: Wed, 30 Nov 2022 14:16:14 +0100 Message-ID: <5332D6E2-B0C8-423F-B88B-9A9BB4D5D6BF@thornhill.no> References: <1B6E5D5C-3EF3-4FDF-894D-B8577A030EF7@thornhill.no> <786DAB7F-F45D-405B-A4E5-4A60FD6CE7A7@secure.kjonigsen.net> <0c7829a2-b5e0-ca19-e3be-2b568e203bc8@secure.kjonigsen.net> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30425"; mail-complaints-to="usenet@ciao.gmane.io" To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= , Yuan Fu , 59691@debbugs.gnu.org, Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 30 14:17:24 2022 Return-path: Envelope-to: geb-bug-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 1p0Mxo-0007i2-25 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Nov 2022 14:17:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0MxZ-0007V8-En; Wed, 30 Nov 2022 08:17:09 -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 1p0MxS-0007Uh-EQ for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 08:17:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0MxS-000414-4B for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 08:17:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0MxR-00054O-PE for bug-gnu-emacs@gnu.org; Wed, 30 Nov 2022 08:17:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Nov 2022 13:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59691 X-GNU-PR-Package: emacs Original-Received: via spool by 59691-submit@debbugs.gnu.org id=B59691.166981420819479 (code B ref 59691); Wed, 30 Nov 2022 13:17:01 +0000 Original-Received: (at 59691) by debbugs.gnu.org; 30 Nov 2022 13:16:48 +0000 Original-Received: from localhost ([127.0.0.1]:60926 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MxD-000547-M9 for submit@debbugs.gnu.org; Wed, 30 Nov 2022 08:16:48 -0500 Original-Received: from out2.migadu.com ([188.165.223.204]:19511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0MxB-000541-Av for 59691@debbugs.gnu.org; Wed, 30 Nov 2022 08:16:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1669814204; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=W4cca2534y/bZHXYCCAiS9YBXUW+9vy/Wh3vuzdKsWA=; b=B3r5yh83kyk3kgQQ4ikY4+liG92pg1P76+42PdbAt++0edd9whPHznkSRt4PQj2C9buO1y 3wm5pFxRYwB0y0APYpfZbJ/ZkJ4IBTCEs5Lz3iPy028g7rV/opchqrFYMVNxvz71STX+ks /VOb9btcOLeO/8TA6lHXxqVf51P32jnMlFI4OZFQXI01qeH+geXJA8V2ck/kbUfFDFhnPi 49GjLfd6Z/Y1vKLWSF90E863/QLj8hDlfsQF7ylh+ewSX/OCgmrtAyzh+aj0iMnv5k+uZO 2w9nS/S5076HQJuvDT8mKo1J+Y+0M1x8n+Nz6eWb26miXbNdAEWNHb3B1gO/9w== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <0c7829a2-b5e0-ca19-e3be-2b568e203bc8@secure.kjonigsen.net> X-Migadu-Flow: FLOW_OUT X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249492 Archived-At: On 30 November 2022 13:59:20 CET, "Jostein Kj=C3=B8nigsen" wrote: >On 29=2E11=2E2022 23:20, Jostein Kj=C3=B8nigsen wrote: >>=20 >>> On 29 Nov 2022, at 22:48, Theodor Thornhill wrot= e: >>>=20 >>> =EF=BB=BF >>>=20 >>>> On 29 November 2022 22:37:25 CET, "Jostein Kj=C3=B8nigsen" wrote: >>>> Nice! >>>>=20 >>>> Should we until further notice assume that js-ts-mode suffers from th= e same issues, and that a jsx-ts-mode might be needed too? To me it at leas= t sounds plausible=2E >>> No, because there are no ambiguities in the grammar with types and jsx= =2E >>>=20 >> Note this behaviour was triggered even when a HTML-tag was contained in= side a plain string=2E >>=20 >> Even without hard typescript casts, there are places where I suspect th= e same issues can bleed into js-ts-mode=2E >>=20 >> I=E2=80=99ll try to do more testing tomorrow=2E > >First of all - good news! > >Contrary to my expectations, I've tested and I cannot reproduce this issu= e in js-ts-mode=2E > Yeah, that's what I've seen as well=2E >Even more good news: > >Looking deeper into this using treesit-explorer-mode (an extremely helpfu= l tool, Yuan!), I found I may have misinterpreted the state of the parse-tr= ee in previous report=2E > >Based on that, I would like to revise this bug report: > > * HTML-like constructs inside strings are --/not/-- treated at > jsx_opening_elements, That's correct! > * only angle-bracket "hard" casts (which isn't present in Javascript) > is causing issues for fontification=2E > >Also, reading up, from what I can tell "hard casts" using angle-brackets = are no longer encouraged as the default way to cast: > >=C2=A0=C2=A0=C2=A0 const service =3D object; > >This is because the above code will cause a compiler error if used in TSX= -files (as opposed to TS-files)=2E Instead "as" expressions are preferred, = because they work equally well for both TS & TSX-files: > >=C2=A0=C2=A0=C2=A0 const service =3D object as IService; > >That means that writing idiomatic TypeScript with typescrip-ts-mode shoul= d produce the expected behaviour, while one may encounter issues with older= code=2E > >I'm not sure introducing a new major-mode for this 1 aspect of TypeScript= development is worth it? > >Does anyone else have an opinion on this? > >-- >Jostein I think that because this is an actual feature it makes sense to have two = modes=2E But defaulting to tsx as the language of choice until now is ok to= o=2E Theo