bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#69357: [PATCH] Improve fontification of Python assignment statement


From: kobarity
Subject: bug#69357: [PATCH] Improve fontification of Python assignment statement with type hints
Date: Sat, 24 Feb 2024 23:23:27 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

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

Attachment: 0001-Improve-fontification-of-Python-assignment-statement.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]