diff options
| author | Konstantin Kharlamov | 2020-06-03 14:51:03 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2020-06-13 10:31:13 +0300 |
| commit | a3474c59dee35d687f773993869f84eb5f9d2eda (patch) | |
| tree | 9b5a00e462d1a3f831669545f1dbbabd73761705 | |
| parent | 459bd56f46af8cd7c29965600c46387282c3c93f (diff) | |
| download | emacs-a3474c59dee35d687f773993869f84eb5f9d2eda.tar.gz emacs-a3474c59dee35d687f773993869f84eb5f9d2eda.zip | |
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)
| -rw-r--r-- | lisp/progmodes/python.el | 2 |
1 files changed, 2 insertions, 0 deletions
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.") | |||
| 633 | (,(lambda (limit) | 633 | (,(lambda (limit) |
| 634 | (let ((re (python-rx (group (+ (any word ?. ?_))) | 634 | (let ((re (python-rx (group (+ (any word ?. ?_))) |
| 635 | (? ?\[ (+ (not (any ?\]))) ?\]) (* space) | 635 | (? ?\[ (+ (not (any ?\]))) ?\]) (* space) |
| 636 | ;; A type, like " : int ". | ||
| 637 | (? ?: (* space) (+ (any word ?. ?_)) (* space)) | ||
| 636 | assignment-operator)) | 638 | assignment-operator)) |
| 637 | (res nil)) | 639 | (res nil)) |
| 638 | (while (and (setq res (re-search-forward re limit t)) | 640 | (while (and (setq res (re-search-forward re limit t)) |