unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Highlight typed variables in python
@ 2020-06-01 20:58 Konstantin Kharlamov
  0 siblings, 0 replies; only message in thread
From: Konstantin Kharlamov @ 2020-06-01 20:58 UTC (permalink / raw)
  To: emacs-devel

* 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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-01 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-01 20:58 [PATCH] Highlight typed variables in python Konstantin Kharlamov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).