From a3474c59dee35d687f773993869f84eb5f9d2eda Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Wed, 3 Jun 2020 14:51:03 +0300 Subject: [PATCH] Highlight typed variables in Python * progmodes/python.el (python-font-lock-keywords-maximum-decoration): Recognize typed variables like "foo: int = 1" as well. (Bug#41684) --- lisp/progmodes/python.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1ca9f019638..aec27a58dea 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -633,6 +633,8 @@ builtins.") (,(lambda (limit) (let ((re (python-rx (group (+ (any word ?. ?_))) (? ?\[ (+ (not (any ?\]))) ?\]) (* space) + ;; A type, like " : int ". + (? ?: (* space) (+ (any word ?. ?_)) (* space)) assignment-operator)) (res nil)) (while (and (setq res (re-search-forward re limit t)) -- 2.39.5