From: Konstantin Kharlamov Date: Wed, 3 Jun 2020 11:51:03 +0000 (+0300) Subject: Highlight typed variables in Python X-Git-Tag: emacs-28.0.90~7178 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a3474c59dee35d687f773993869f84eb5f9d2eda;p=emacs.git 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) --- 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))