[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44568: [PATCH] Fix font lock of assignments with type hints in Pytho
From: |
Dario Gjorgjevski |
Subject: |
bug#44568: [PATCH] Fix font lock of assignments with type hints in Python |
Date: |
Wed, 11 Nov 2020 09:41:33 +0100 |
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', '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.
The attached patch makes all of ‘var1’ through ‘var5’ be highlighted
correctly.
0001-Fix-font-lock-of-assignments-with-type-hints-in-Pyth.patch
Description: Fix font lock of assignments with type hints in Python
Best regards,
Dario
--
dario.gjorgjevski@gmail.com :: +49 1525 8666837
% gpg --keyserver 'hkps://hkps.pool.sks-keyservers.net' \
\`> --recv-keys '744A4F0B4F1C9371'
- bug#44568: [PATCH] Fix font lock of assignments with type hints in Python,
Dario Gjorgjevski <=