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#61081: 29.0.60; typescript-ts-mode does not correctly fontify imports with aliases [PATCH] Date: Fri, 27 Jan 2023 13:48:15 +0100 Message-ID: <87ilgsf8j4.fsf@thornhill.no> References: 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="5804"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , jostein@kjonigsen.net, 61081@debbugs.gnu.org To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 27 13:49:17 2023 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 1pLOAO-0001BJ-4Q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Jan 2023 13:49:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLOAE-0006Et-4y; Fri, 27 Jan 2023 07:49:06 -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 1pLOAB-0006CF-W8 for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2023 07:49:04 -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 1pLOAB-0003TS-EH for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2023 07:49:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pLOAA-0008B6-9i for bug-gnu-emacs@gnu.org; Fri, 27 Jan 2023 07:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Jan 2023 12:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61081 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61081-submit@debbugs.gnu.org id=B61081.167482370131370 (code B ref 61081); Fri, 27 Jan 2023 12:49:02 +0000 Original-Received: (at 61081) by debbugs.gnu.org; 27 Jan 2023 12:48:21 +0000 Original-Received: from localhost ([127.0.0.1]:36897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLO9U-00089s-WE for submit@debbugs.gnu.org; Fri, 27 Jan 2023 07:48:21 -0500 Original-Received: from out0.migadu.com ([94.23.1.103]:27033) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLO9S-00089b-Kj for 61081@debbugs.gnu.org; Fri, 27 Jan 2023 07:48:19 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674823697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gdKZ55p3la2JUT+mU6zAeuRCyDcksWEJTLtH8ovYUL4=; b=FHRg8A9ma6LT6Ukk170HcF+mQRcPuoHn0GLMo2c39oSMhIWKH6ACd6QI0SN4pOSqZlhCJc chf64UnWdBvs4/yDXImkZJjDie3ckSIcxZCznwGqZeuHEN1LfYuCx6du+vBfuvxwrwPVBS XJuxyLaNqqZj17wKORfYt2YfFF1zDoWaNP46+l7g84wKNCiCK+AhXMO1vf63sDV2/Pfs9/ QyZZDenzbVSKMXFMb/O+S1HDik/OVhCEi0ySAHuR70fUrpLXcl5zHtaoEVt0y7/P8ZhRjq EOGtRgP4sA5yfWEtRcW0lIQRlVyVVhKnwEWT4auxbaLIKePNxnaiB6HgEFNykg== In-Reply-To: ("Jostein =?UTF-8?Q?Kj=C3=B8nigsen?="'s message of "Thu, 26 Jan 2023 19:55:38 +0100") 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:254256 Archived-At: Jostein Kj=C3=B8nigsen writes: > Currently typescript-ts-mode and tsx-ts-mode handles imports with aliases= incorrectly. > > Consider the following case: > > import { someFunc as someAlias } from "module"; > > In this case the entire import ("someFunc as someAlias") will be highligh= ted as a variable name. "as" is also > highlighted as a variable, rather than a reserved keyword. > > To be consistent with how we otherwise do things, we should only highligh= t the variable which is new and/or > introduced, in this case "someAlias". > > Attached is a patch which fontifies import-declarations somewhat more cor= rectly. > > The following cases have been tested and all fontify properly: > > import gnu from "fsf"; // highlights gnu > import { gnu2 } from "fsf2"; // highlights gnu2 > import { gnu as gnu3 } from "fsf3"; // highlights gnu3 > import * as gnu4 from "fsf4"; // highlights gnu4 > > Theo: Looks good to you? > > Yuan: I believe these same sort of fixes could be applied to js-ts-mode a= nd friends. > Thanks! Installing today :) Theo