diff options
author | Dario Gjorgjevski <dario.gjorgjevski@gmail.com> | 2020-11-11 10:49:04 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-11-11 10:49:04 +0100 |
commit | 296e4dd15e3754fdddf70d33f2d630462d4b3309 (patch) | |
tree | c68acf1a006fefda69f8a5ec65807a10f38e5ba9 /lisp/emacs-lisp/re-builder.el | |
parent | 9038890ae21eed644251df9511cfda298a594ed9 (diff) | |
download | emacs-296e4dd15e3754fdddf70d33f2d630462d4b3309.tar.gz emacs-296e4dd15e3754fdddf70d33f2d630462d4b3309.tar.bz2 emacs-296e4dd15e3754fdddf70d33f2d630462d4b3309.zip |
Fix font lock of assignments with type hints in Python
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration): Fix regular
expressions for font lock of assignments with type hints (bug#44568).
The font lock of assignments with type hints in Python is rather bad.
Consider the following example:
from typing import Mapping, Tuple, Sequence
var1: int = 5
var2: Mapping[int, int] = {10: 1024}
var3: Mapping[Tuple[int, int], int] = {(2, 5): 32}
var4: Sequence[Sequence[int]] = [[1], [1, 2], [1, 2, 3]]
var5: Sequence[Mapping[str, Sequence[str]]] = [
{
'red': ['scarlet', 'vermilion', 'ruby'],
'green': ['emerald green', 'aqua']
},
{
'sword': ['cutlass', 'rapier']
}
]
As things stand right now, only ‘var1’ would be highlighted. To make
things worse, the ‘Mapping’ type hint of ‘var2’ would also be
highlighted, which is entirely incorrect.
This commit makes all of ‘var1’ through ‘var5’ be highlighted
correctly.
Diffstat (limited to 'lisp/emacs-lisp/re-builder.el')
0 files changed, 0 insertions, 0 deletions