]> git.eshelyaron.com Git - emacs.git/commitdiff
Highlight typed variables in Python
authorKonstantin Kharlamov <Hi-Angel@yandex.ru>
Wed, 3 Jun 2020 11:51:03 +0000 (14:51 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 13 Jun 2020 07:31:13 +0000 (10:31 +0300)
* progmodes/python.el
(python-font-lock-keywords-maximum-decoration): Recognize
typed variables like "foo: int = 1" as well.  (Bug#41684)

lisp/progmodes/python.el

index 1ca9f019638c5e0d3ea2072a3f4d914b074add4a..aec27a58dea50412a5e9c214116610e5d6eda5ce 100644 (file)
@@ -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))