From unknown Fri Aug 15 19:27:04 2025 X-Loop: help-debbugs@gnu.org Subject: bug#78838: [PATCH] 31.0.50; python-ts-mode fontifies constructors as functions, not types Resent-From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Jun 2025 13:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78838 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 78838@debbugs.gnu.org Cc: Yuan Fu X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.175034091529531 (code B ref -1); Thu, 19 Jun 2025 13:49:02 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jun 2025 13:48:35 +0000 Received: from localhost ([127.0.0.1]:33689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSFd4-0007g8-BW for submit@debbugs.gnu.org; Thu, 19 Jun 2025 09:48:35 -0400 Received: from lists.gnu.org ([2001:470:142::17]:40752) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSFd1-0007ey-LA for submit@debbugs.gnu.org; Thu, 19 Jun 2025 09:48:32 -0400 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 1uSFcl-0002jZ-Lw for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 09:48:16 -0400 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSFch-0002wm-Nb for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 09:48:14 -0400 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id F21AC1140137; Thu, 19 Jun 2025 09:48:03 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Thu, 19 Jun 2025 09:48:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm3; t=1750340883; x=1750427283; bh=W3 mI8UDpeD1wQ0XF4rAJYhJ92m5eXedJnlWi0NAPnIA=; b=P776FPXG7c6y5slrf3 EoIeQAY/HFt99XsLnj/zvxUpLXYsjio5qWb4wOMpsHSLyi4fSwsXzdJPgwEujeck wtQse+8okhLNmLd+8AAITDTZKrG05BxybPHS2T5+TczTRAWxj1YSmbailDN8B7d1 LOPoW27N13qPXtbt30SOfOTXbqaHB8TRHNGchyx+salEqqQKDJ4B5R8nWkaF9m6b AdcRJo6u4i7zXvuq4aAmJPL+V1h+cT+F8ZlEVjzVhLKe/oPo+655oKCnJFM2IkVm N4H/gCSuvvd4zZ1ON/1mcpfxHGjfLYt6pWmFDZMzOrCjmRpf/7DfZMdnuzzm4+47 aOgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1750340883; x= 1750427283; bh=W3mI8UDpeD1wQ0XF4rAJYhJ92m5eXedJnlWi0NAPnIA=; b=p rd/W+XOjCGf+GJXtBFQM8Y3omCVdVUM3w9VCNSQ7NWh42CsNCBQ53PZsTQY78fvV 0ARfR2LLX6g+ph/w2wMPcs9nQEyDh0G7U6DyWOpXaWHTHAlbzuvnx78ZcZEA0B39 WwAP0gdxtW30i4yEDDlRL3jp6EzUcuQgvZCB1mUIbS6Bff7Mia8LwNOyUYcYG7U4 N+NJoswJGE/KRbOApb7XPjPyLYEfVDLpd1LbwoeByutr5EtSIQ62LbaA6HLBLvPe k8SWtSvcQcf6XuFwv74I99dMDVN2TK/bxKb8mgtT6lw66cAUv6Ae1QJPGXdkqYud yJiXs8HEdRIishuXc9B/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdehieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefhtggguffkffevvffosegrtdhmrehhtddvne cuhfhrohhmpeflohhsthgvihhnucfmjhppnhhighhsvghnuceojhhoshhtvghinhesshgv tghurhgvrdhkjhhonhhighhsvghnrdhnvghtqeenucggtffrrghtthgvrhhnpeelteevue ffiefhvdegiedvieevleelgeetudejhfejkeekffeukeejgfffgefgleenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhsthgvihhnsehsvg gtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvthdpnhgspghrtghpthhtohepvddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdroh hrghdprhgtphhtthhopegtrghsohhurhhisehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Jun 2025 09:48:02 -0400 (EDT) From: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Content-Type: multipart/alternative; boundary="Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Message-Id: Date: Thu, 19 Jun 2025 15:47:50 +0200 X-Mailer: Apple Mail (2.3826.600.51.1.1) Received-SPF: pass client-ip=202.12.124.149; envelope-from=jostein@secure.kjonigsen.net; helo=fout-b6-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hey everyone. When using python-ts-mode to write or read code, I've noticed it has a = few inconsistencies: 1. type-constructors are fontified as regular functions, not the type = they represent. 2. typed default parameters are not fontified as variables 3. kwarg arguments are not fontified either Attached is a patch which fixes this :) =EF=BF=BC =E2=80=94 Kind Regards Jostein Kj=C3=B8nigsen --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB Content-Type: multipart/mixed; boundary="Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81" --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
Hey everyone.

When using python-ts-mode to write or read code, I've noticed it has a few inconsistencies:

1. type-constructors are fontified as regular functions, not the type they represent.
2. typed default parameters are not fontified as variables
3. kwarg arguments are not fontified either

Attached is a patch which fixes this :)

--Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Disposition: attachment; filename=0002-python-ts-mode-Improve-fontification.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-python-ts-mode-Improve-fontification.patch" Content-Transfer-Encoding: quoted-printable =46rom=20126396350281591ac6432f6cc0a6bb0a7b3d9ccd=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Jostein=3D20Kj=3DC3=3DB8nigsen?=3D=20= =0ADate:=20Thu,=2020=20Mar=202025=2010:39:31=20= +0100=0ASubject:=20[PATCH=202/4]=20python-ts-mode:=20Improve=20= fontification=0A=0Apython--treesit-settings:=20Fontification=20based=20= on=20selectors=20&=20code-conventions=0A=0A-=20Constructor:=20Fontified=20= as=20type,=20not=20function-call.=0A-=20Typed=20default=20parameters=0A-=20= Fontify=20kwargs=20in=20function=20calls=20as=20property-use.=20= Differentiate=20from=0A=20=20variable-use=20(passed=20in=20arguments)=0A= ---=0A=20lisp/progmodes/python.el=20|=207=20++++++-=0A=201=20file=20= changed,=206=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/python.el=20b/lisp/progmodes/python.el=0Aindex=20= 3b83c5d3319..151d12d8557=20100644=0A---=20a/lisp/progmodes/python.el=0A= +++=20b/lisp/progmodes/python.el=0A@@=20-1236,6=20+1236,7=20@@=20= python--treesit-settings=0A=20=20=20=20=20=20(parameters=20(identifier)=20= @font-lock-variable-name-face)=0A=20=20=20=20=20=20(parameters=20= (typed_parameter=20(identifier)=20@font-lock-variable-name-face))=0A=20=20= =20=20=20=20(parameters=20(default_parameter=20name:=20(identifier)=20= @font-lock-variable-name-face))=0A+=20=20=20=20=20(parameters=20= (typed_default_parameter=20name:=20(identifier)=20= @font-lock-variable-name-face))=0A=20=20=20=20=20=20(lambda_parameters=20= (identifier)=20@font-lock-variable-name-face)=0A=20=20=20=20=20=20= (for_in_clause=0A=20=20=20=20=20=20=20left:=20(identifier)=20= @font-lock-variable-name-face)=0A@@=20-1266,7=20+1267,11=20@@=20= python--treesit-settings=0A=20=0A=20=20=20=20:feature=20'function=0A=20=20= =20=20:language=20'python=0A-=20=20=20'((call=20function:=20(identifier)=20= @font-lock-function-call-face)=0A+=20=20=20'(((call=20function:=20= (identifier)=20@font-lock-type-face)=0A+=20=20=20=20=20=20(:match=20= "\\`[A-Z][A-Za-z0-9]+\\'"=20@font-lock-type-face))=0A+=20=20=20=20=20= (call=20function:=20(identifier)=20@font-lock-function-call-face)=0A+=20=20= =20=20=20(call=20arguments:=20(argument_list=20(keyword_argument=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20name:=20(identifier)=20= @font-lock-property-name-face)))=0A=20=20=20=20=20=20(call=20function:=20= (attribute=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20attribute:=20(identifier)=20@font-lock-function-call-face)))=0A=20= =0A--=20=0A2.50.0=0A=0A= --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

=E2=80=94
Kind Regards
Jostein = Kj=C3=B8nigsen

= --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81-- --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB-- From unknown Fri Aug 15 19:27:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Subject: bug#78838: closed (Re: bug#78838: [PATCH] 31.0.50; python-ts-mode fontifies constructors as functions, not types) Message-ID: References: <86cyaxjyms.fsf@gnu.org> X-Gnu-PR-Message: they-closed 78838 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 78838@debbugs.gnu.org Date: Sat, 21 Jun 2025 08:20:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1750494002-12359-1" This is a multi-part message in MIME format... ------------=_1750494002-12359-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #78838: [PATCH] 31.0.50; python-ts-mode fontifies constructors as functions= , not types which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 78838@debbugs.gnu.org. --=20 78838: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D78838 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1750494002-12359-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 78838-done) by debbugs.gnu.org; 21 Jun 2025 08:19:05 +0000 Received: from localhost ([127.0.0.1]:33549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uStRI-00039g-3M for submit@debbugs.gnu.org; Sat, 21 Jun 2025 04:19:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42448) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uStRE-00037z-P2 for 78838-done@debbugs.gnu.org; Sat, 21 Jun 2025 04:19:02 -0400 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 1uStR8-0000Nk-3I; Sat, 21 Jun 2025 04:18:55 -0400 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=GpSn2P0Ju3GWvm4Prnusf+6U+QXUw9rB5RO/l6xYEj8=; b=KM+zmn+w7bch9F2mZ4Y3 Tn3in6Zdb5wF03PHKsP/Wr/gF7ve1wFqp8lyeyZ4lps2XUjcxWfDiI7lpcGWkqcoArSr6wMavN5aF vQinNyrpfC4t7brtmeG05oGInCPf1sT6oif0oXtOKvKLmLQLfMpMBqcIWlQjgU7P+Q7BFtxYExg3p 1tZYzy/lZarNgUBNpeWaHmJqnZ9xs+6GbR7gKP4ZIsCQOEmDefT9C59QvXjZnXBifwQxLKDHMXHkT +xsSoPC/IlcxkX140bkwv/T89hYeVjJCqTLq+h4angrPrroC9efuTIXmqv/r1dOK80Il1/vniap5A M0gRB0xDE8ezJw==; Date: Sat, 21 Jun 2025 11:18:51 +0300 Message-Id: <86cyaxjyms.fsf@gnu.org> From: Eli Zaretskii To: Jostein =?utf-8?Q?Kj=C3=B8nigsen?= In-Reply-To: (message from Jostein =?utf-8?Q?Kj=C3=B8nigsen?= on Thu, 19 Jun 2025 15:47:50 +0200) Subject: Re: bug#78838: [PATCH] 31.0.50; python-ts-mode fontifies constructors as functions, not types References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78838-done Cc: casouri@gmail.com, 78838-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: Yuan Fu > From: Jostein Kjønigsen > Date: Thu, 19 Jun 2025 15:47:50 +0200 > > When using python-ts-mode to write or read code, I've noticed it has a few inconsistencies: > > 1. type-constructors are fontified as regular functions, not the type they represent. > 2. typed default parameters are not fontified as variables > 3. kwarg arguments are not fontified either > > Attached is a patch which fixes this :) Thanks, installed on the master branch, and closing the bug. ------------=_1750494002-12359-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Jun 2025 13:48:35 +0000 Received: from localhost ([127.0.0.1]:33689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uSFd4-0007g8-BW for submit@debbugs.gnu.org; Thu, 19 Jun 2025 09:48:35 -0400 Received: from lists.gnu.org ([2001:470:142::17]:40752) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uSFd1-0007ey-LA for submit@debbugs.gnu.org; Thu, 19 Jun 2025 09:48:32 -0400 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 1uSFcl-0002jZ-Lw for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 09:48:16 -0400 Received: from fout-b6-smtp.messagingengine.com ([202.12.124.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uSFch-0002wm-Nb for bug-gnu-emacs@gnu.org; Thu, 19 Jun 2025 09:48:14 -0400 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.stl.internal (Postfix) with ESMTP id F21AC1140137; Thu, 19 Jun 2025 09:48:03 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Thu, 19 Jun 2025 09:48:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= secure.kjonigsen.net; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:message-id:mime-version:reply-to :subject:subject:to:to; s=fm3; t=1750340883; x=1750427283; bh=W3 mI8UDpeD1wQ0XF4rAJYhJ92m5eXedJnlWi0NAPnIA=; b=P776FPXG7c6y5slrf3 EoIeQAY/HFt99XsLnj/zvxUpLXYsjio5qWb4wOMpsHSLyi4fSwsXzdJPgwEujeck wtQse+8okhLNmLd+8AAITDTZKrG05BxybPHS2T5+TczTRAWxj1YSmbailDN8B7d1 LOPoW27N13qPXtbt30SOfOTXbqaHB8TRHNGchyx+salEqqQKDJ4B5R8nWkaF9m6b AdcRJo6u4i7zXvuq4aAmJPL+V1h+cT+F8ZlEVjzVhLKe/oPo+655oKCnJFM2IkVm N4H/gCSuvvd4zZ1ON/1mcpfxHGjfLYt6pWmFDZMzOrCjmRpf/7DfZMdnuzzm4+47 aOgA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1750340883; x= 1750427283; bh=W3mI8UDpeD1wQ0XF4rAJYhJ92m5eXedJnlWi0NAPnIA=; b=p rd/W+XOjCGf+GJXtBFQM8Y3omCVdVUM3w9VCNSQ7NWh42CsNCBQ53PZsTQY78fvV 0ARfR2LLX6g+ph/w2wMPcs9nQEyDh0G7U6DyWOpXaWHTHAlbzuvnx78ZcZEA0B39 WwAP0gdxtW30i4yEDDlRL3jp6EzUcuQgvZCB1mUIbS6Bff7Mia8LwNOyUYcYG7U4 N+NJoswJGE/KRbOApb7XPjPyLYEfVDLpd1LbwoeByutr5EtSIQ62LbaA6HLBLvPe k8SWtSvcQcf6XuFwv74I99dMDVN2TK/bxKb8mgtT6lw66cAUv6Ae1QJPGXdkqYud yJiXs8HEdRIishuXc9B/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdehieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucenucfjughrpefhtggguffkffevvffosegrtdhmrehhtddvne cuhfhrohhmpeflohhsthgvihhnucfmjhppnhhighhsvghnuceojhhoshhtvghinhesshgv tghurhgvrdhkjhhonhhighhsvghnrdhnvghtqeenucggtffrrghtthgvrhhnpeelteevue ffiefhvdegiedvieevleelgeetudejhfejkeekffeukeejgfffgefgleenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhsthgvihhnsehsvg gtuhhrvgdrkhhjohhnihhgshgvnhdrnhgvthdpnhgspghrtghpthhtohepvddpmhhouggv pehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdroh hrghdprhgtphhtthhopegtrghsohhurhhisehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: ib2f84088:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 19 Jun 2025 09:48:02 -0400 (EDT) From: =?utf-8?Q?Jostein_Kj=C3=B8nigsen?= Content-Type: multipart/alternative; boundary="Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: [PATCH] 31.0.50; python-ts-mode fontifies constructors as functions, not types Message-Id: Date: Thu, 19 Jun 2025 15:47:50 +0200 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3826.600.51.1.1) Received-SPF: pass client-ip=202.12.124.149; envelope-from=jostein@secure.kjonigsen.net; helo=fout-b6-smtp.messagingengine.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit Cc: Yuan Fu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.3 (/) --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hey everyone. When using python-ts-mode to write or read code, I've noticed it has a = few inconsistencies: 1. type-constructors are fontified as regular functions, not the type = they represent. 2. typed default parameters are not fontified as variables 3. kwarg arguments are not fontified either Attached is a patch which fixes this :) =EF=BF=BC =E2=80=94 Kind Regards Jostein Kj=C3=B8nigsen --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB Content-Type: multipart/mixed; boundary="Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81" --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
Hey everyone.

When using python-ts-mode to write or read code, I've noticed it has a few inconsistencies:

1. type-constructors are fontified as regular functions, not the type they represent.
2. typed default parameters are not fontified as variables
3. kwarg arguments are not fontified either

Attached is a patch which fixes this :)

--Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Disposition: attachment; filename=0002-python-ts-mode-Improve-fontification.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0002-python-ts-mode-Improve-fontification.patch" Content-Transfer-Encoding: quoted-printable =46rom=20126396350281591ac6432f6cc0a6bb0a7b3d9ccd=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Jostein=3D20Kj=3DC3=3DB8nigsen?=3D=20= =0ADate:=20Thu,=2020=20Mar=202025=2010:39:31=20= +0100=0ASubject:=20[PATCH=202/4]=20python-ts-mode:=20Improve=20= fontification=0A=0Apython--treesit-settings:=20Fontification=20based=20= on=20selectors=20&=20code-conventions=0A=0A-=20Constructor:=20Fontified=20= as=20type,=20not=20function-call.=0A-=20Typed=20default=20parameters=0A-=20= Fontify=20kwargs=20in=20function=20calls=20as=20property-use.=20= Differentiate=20from=0A=20=20variable-use=20(passed=20in=20arguments)=0A= ---=0A=20lisp/progmodes/python.el=20|=207=20++++++-=0A=201=20file=20= changed,=206=20insertions(+),=201=20deletion(-)=0A=0Adiff=20--git=20= a/lisp/progmodes/python.el=20b/lisp/progmodes/python.el=0Aindex=20= 3b83c5d3319..151d12d8557=20100644=0A---=20a/lisp/progmodes/python.el=0A= +++=20b/lisp/progmodes/python.el=0A@@=20-1236,6=20+1236,7=20@@=20= python--treesit-settings=0A=20=20=20=20=20=20(parameters=20(identifier)=20= @font-lock-variable-name-face)=0A=20=20=20=20=20=20(parameters=20= (typed_parameter=20(identifier)=20@font-lock-variable-name-face))=0A=20=20= =20=20=20=20(parameters=20(default_parameter=20name:=20(identifier)=20= @font-lock-variable-name-face))=0A+=20=20=20=20=20(parameters=20= (typed_default_parameter=20name:=20(identifier)=20= @font-lock-variable-name-face))=0A=20=20=20=20=20=20(lambda_parameters=20= (identifier)=20@font-lock-variable-name-face)=0A=20=20=20=20=20=20= (for_in_clause=0A=20=20=20=20=20=20=20left:=20(identifier)=20= @font-lock-variable-name-face)=0A@@=20-1266,7=20+1267,11=20@@=20= python--treesit-settings=0A=20=0A=20=20=20=20:feature=20'function=0A=20=20= =20=20:language=20'python=0A-=20=20=20'((call=20function:=20(identifier)=20= @font-lock-function-call-face)=0A+=20=20=20'(((call=20function:=20= (identifier)=20@font-lock-type-face)=0A+=20=20=20=20=20=20(:match=20= "\\`[A-Z][A-Za-z0-9]+\\'"=20@font-lock-type-face))=0A+=20=20=20=20=20= (call=20function:=20(identifier)=20@font-lock-function-call-face)=0A+=20=20= =20=20=20(call=20arguments:=20(argument_list=20(keyword_argument=0A+=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20name:=20(identifier)=20= @font-lock-property-name-face)))=0A=20=20=20=20=20=20(call=20function:=20= (attribute=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20attribute:=20(identifier)=20@font-lock-function-call-face)))=0A=20= =0A--=20=0A2.50.0=0A=0A= --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

=E2=80=94
Kind Regards
Jostein = Kj=C3=B8nigsen

= --Apple-Mail=_D7D52892-8417-4FB8-86FF-62C8D4FBBD81-- --Apple-Mail=_AA84D8B5-99C8-433E-A915-E4F6195480FB-- ------------=_1750494002-12359-1--