GNU bug report logs - #69357
[PATCH] Improve fontification of Python assignment statement with type hints

Previous Next

Package: emacs;

Reported by: kobarity <kobarity <at> gmail.com>

Date: Sat, 24 Feb 2024 14:25:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 69357 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#69357; Package emacs. (Sat, 24 Feb 2024 14:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to kobarity <kobarity <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 24 Feb 2024 14:25:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: kobarity <kobarity <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Improve fontification of Python assignment statement with
 type hints
Date: Sat, 24 Feb 2024 23:23:27 +0900
[Message part 1 (text/plain, inline)]
In python-mode (not python-ts-mode), "List" in the type hints of the
following code are fontified as variable names.

#+begin_src python
a: List[List[CustomInt], List[CustomInt]] = []
#+end_src

This is due to misinterpretation as a multiple assignment statement
such as:

#+begin_src python
a, b = 1, 2
#+end_src

To address this issue and to improve fontification, I suggest to
fontify type hints in the assignment statement as type names before
processing multiple assignment statements, as in the attached patch.

--
In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2024-02-24 built on ubuntu
Repository revision: eeb89a5cb292bffe40ba7d0b0cf81f82f8452bf8
Repository branch: master
System Description: Ubuntu 22.04.4 LTS
[0001-Improve-fontification-of-Python-assignment-statement.patch (text/plain, attachment)]

This bug report was last modified 69 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.