emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Highlight typed variables in python


From: Konstantin Kharlamov
Subject: [PATCH] Highlight typed variables in python
Date: Mon, 1 Jun 2020 23:58:33 +0300

* progmodes/python.el (python-font-lock-keywords-maximum-decoration):
recognize typed variables like "foo: int = 1" as well.
---
 lisp/progmodes/python.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ae5aff351c0..0263f4cc291 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -634,6 +634,7 @@ python-font-lock-keywords-maximum-decoration
     (,(lambda (limit)
         (let ((re (python-rx (group (+ (any word ?. ?_)))
                              (? ?\[ (+ (not (any  ?\]))) ?\]) (* space)
+                             (? ?: (* space) (+ (any word ?. ?_)) (* space)) 
;; a type, like " : int "
                              assignment-operator))
               (res nil))
           (while (and (setq res (re-search-forward re limit t))
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]