diff options
| -rw-r--r-- | lisp/progmodes/python.el | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 801432cd188..d87789fd773 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1031,8 +1031,8 @@ Do not fontify the initial f for f-strings." | |||
| 1031 | (defvar python--treesit-settings | 1031 | (defvar python--treesit-settings |
| 1032 | (treesit-font-lock-rules | 1032 | (treesit-font-lock-rules |
| 1033 | :language 'python | 1033 | :language 'python |
| 1034 | :override t | 1034 | :level 1 |
| 1035 | `(;; Queries for def and class. | 1035 | '(;; Queries for def and class. |
| 1036 | (function_definition | 1036 | (function_definition |
| 1037 | name: (identifier) @font-lock-function-name-face) | 1037 | name: (identifier) @font-lock-function-name-face) |
| 1038 | 1038 | ||
| @@ -1045,9 +1045,11 @@ Do not fontify the initial f for f-strings." | |||
| 1045 | (string) @python--treesit-fontify-string | 1045 | (string) @python--treesit-fontify-string |
| 1046 | ((string) @font-lock-doc-face | 1046 | ((string) @font-lock-doc-face |
| 1047 | (:match "^\"\"\"" @font-lock-doc-face)) | 1047 | (:match "^\"\"\"" @font-lock-doc-face)) |
| 1048 | (interpolation (identifier) @font-lock-variable-name-face) | 1048 | (interpolation (identifier) @font-lock-variable-name-face)) |
| 1049 | 1049 | :language 'python | |
| 1050 | ;; Keywords, builtins, and constants. | 1050 | :level 2 |
| 1051 | :override t | ||
| 1052 | `(;; Keywords, builtins, and constants. | ||
| 1051 | [,@python--treesit-keywords] @font-lock-keyword-face | 1053 | [,@python--treesit-keywords] @font-lock-keyword-face |
| 1052 | 1054 | ||
| 1053 | ((identifier) @font-lock-keyword-face | 1055 | ((identifier) @font-lock-keyword-face |
| @@ -1061,12 +1063,11 @@ Do not fontify the initial f for f-strings." | |||
| 1061 | eol)) | 1063 | eol)) |
| 1062 | @font-lock-builtin-face)) | 1064 | @font-lock-builtin-face)) |
| 1063 | 1065 | ||
| 1064 | [(true) (false) (none)] @font-lock-constant-face | 1066 | [(true) (false) (none)] @font-lock-constant-face) |
| 1065 | 1067 | :language 'python | |
| 1066 | ;; Escape sequences | 1068 | :level 3 |
| 1067 | (escape_sequence) @font-lock-constant-face | 1069 | :override t |
| 1068 | 1070 | `(;; Variable names. | |
| 1069 | ;; Variable names. | ||
| 1070 | (assignment left: (identifier) | 1071 | (assignment left: (identifier) |
| 1071 | @font-lock-variable-name-face) | 1072 | @font-lock-variable-name-face) |
| 1072 | (assignment left: (attribute | 1073 | (assignment left: (attribute |
| @@ -1088,7 +1089,10 @@ Do not fontify the initial f for f-strings." | |||
| 1088 | `(seq bol (or ,@python--treesit-exceptions) | 1089 | `(seq bol (or ,@python--treesit-exceptions) |
| 1089 | eol)) | 1090 | eol)) |
| 1090 | @font-lock-type-face)) | 1091 | @font-lock-type-face)) |
| 1091 | (type (identifier) @font-lock-type-face))) | 1092 | (type (identifier) @font-lock-type-face) |
| 1093 | |||
| 1094 | ;; Escape sequences | ||
| 1095 | (escape_sequence) @font-lock-constant-face)) | ||
| 1092 | "Tree-sitter font-lock settings.") | 1096 | "Tree-sitter font-lock settings.") |
| 1093 | 1097 | ||
| 1094 | 1098 | ||