From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly Date: Tue, 29 Nov 2022 14:10:19 +0200 Message-ID: <83k03em05w.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12420"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59660@debbugs.gnu.org, jostein@kjonigsen.net, theo@thornhill.no To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 29 13:10:17 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 1ozzRI-0002xq-PT for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Nov 2022 13:10:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ozzR8-0004Jv-FW; Tue, 29 Nov 2022 07:10: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 1ozzR4-0004JV-EF for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 07:10:02 -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 1ozzR4-00042E-5I for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 07:10:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ozzR4-0007sW-0t for bug-gnu-emacs@gnu.org; Tue, 29 Nov 2022 07:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Nov 2022 12:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59660 X-GNU-PR-Package: emacs Original-Received: via spool by 59660-submit@debbugs.gnu.org id=B59660.166972379530269 (code B ref 59660); Tue, 29 Nov 2022 12:10:01 +0000 Original-Received: (at 59660) by debbugs.gnu.org; 29 Nov 2022 12:09:55 +0000 Original-Received: from localhost ([127.0.0.1]:54334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozzQw-0007s9-Nu for submit@debbugs.gnu.org; Tue, 29 Nov 2022 07:09:55 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ozzQv-0007s2-En for 59660@debbugs.gnu.org; Tue, 29 Nov 2022 07:09:53 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozzQp-00040g-4x; Tue, 29 Nov 2022 07:09:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=lu9Dwl042oEau3t+S2u3o3o6VcuTcxoQEt+W8oHXH7M=; b=AI9sthsG25f15A3RVukc KLcKs1Czc262Fl5RpSpdkOlIJIFw1a5jaBZzPpS/B9YM/F93SQTOxZtEgiNu+CaFaTnEtdYNSIeyF GsbYMPFoJjlF7YzMxXuDh2U4YYFbU3DigsFxQSfwmB5hm9pn4Bx/JUb95qSa9fqu1NXvNyimXBC2D xpOT72IF5aCqSKfg73jo8AgDaQfd5aW6VNFWHNRVtd7mP5tUdG2fu5M1eGt7SspwRaGgaX3ttK9WN 0qAfVVbP2K3BNt1jXrnC7tZu2uIpvxSdj2/exxPY8WtiGVpIAHgAYLo8pdhMF/E9ZOsvRXRsQrV6K zPLhPIKZfyhXiA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozzQo-0002AH-Dh; Tue, 29 Nov 2022 07:09:46 -0500 In-Reply-To: (message from Yuan Fu on Mon, 28 Nov 2022 15:06:30 -0800) 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:249384 Archived-At: > Cc: 59660@debbugs.gnu.org, theo@thornhill.no > From: Yuan Fu > Date: Mon, 28 Nov 2022 15:06:30 -0800 > > > 1. create a typescript file (sample.ts) > > 2. create class and add some methods to it. > > > > I observe that: > > > > - method names are consistently fontified as font-lock-property-face. > > > > I expected that: > > > > - method names to be consistently fontified as font-luck-function-name-face. > > > > This seems to be because of the "property_identifier" is used for > > functions in the treesitter-grammar, and this property is used > > indiscriminately to apply font-lock-property-face at the bottom of the > > major-mode grammar. > > > > This "shadows" the former rules which correctly apply font-lock-function-name-face. > > > > The best would obviously have a way to identify properties more accurately, to precent > > shadowing from taking place. Unfortunately I cannot see a realiable way to do that > > based on the current parse-tree. > > > > Seeing as properties in Typescript are fairly rare while methods are very common, > > it seems appropriate to me to remove the property-specific fontification rules > > to restore the method-fontification rules. > > > > I got a patch for this ready, if people are willing to accept it. > > Maybe you can remove the :override flag for the property_identifier rule, so it doesn’t shadow the function rule? Would that work better? This could be a personal preference, perhaps? It isn't clear to me that only one of the two is definitely correct. So maybe we need a user option for which one overrides which?