[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/tree-sitter 253126bf33 07/12: Fix python tree-sitter font-lock
From: |
Yuan Fu |
Subject: |
feature/tree-sitter 253126bf33 07/12: Fix python tree-sitter font-lock |
Date: |
Wed, 5 Oct 2022 22:52:21 -0400 (EDT) |
branch: feature/tree-sitter
commit 253126bf339a16589e86acd51c0f96da07e658d9
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Fix python tree-sitter font-lock
Add fontification for lhs attribute and some operators.
* lisp/progmodes/python.el (python--treesit-keywords): Add operators.
(python--treesit-settings): Add lhs attribute.
---
lisp/progmodes/python.el | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5b70c63f7b..3f85201c10 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -915,7 +915,10 @@ It makes underscores and dots word constituent chars.")
'("as" "assert" "async" "await" "break" "class" "continue" "def"
"del" "elif" "else" "except" "exec" "finally" "for" "from"
"global" "if" "import" "lambda" "nonlocal" "pass" "print"
- "raise" "return" "try" "while" "with" "yield"))
+ "raise" "return" "try" "while" "with" "yield"
+ ;; These are technically operators, but we fontify them as
+ ;; keywords.
+ "and" "in" "is" "not" "or"))
(defvar python--treesit-builtins
'("abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray"
@@ -934,6 +937,8 @@ It makes underscores and dots word constituent chars.")
"copyright" "credits" "exit" "license" "quit"))
(defvar python--treesit-operators
+ ;; This is not used. And and, or, not, is, in are fontified as
+ ;; keywords.
'("-" "-=" "!=" "*" "**" "**=" "*=" "/" "//" "//=" "/=" "&" "%" "%="
"^" "+" "+=" "<" "<<" "<=" "<>" "=" "==" ">" ">=" ">>" "|" "~"
"and" "in" "is" "not" "or"))
@@ -1019,6 +1024,9 @@ Do not fontify the initial f for f-strings."
;; Variable names.
(assignment left: (identifier)
@font-lock-variable-name-face)
+ (assignment left: (attribute
+ attribute: (identifier)
+ @font-lock-variable-name-face))
(pattern_list (identifier)
@font-lock-variable-name-face)
(tuple_pattern (identifier)
- feature/tree-sitter updated (9ed53535f5 -> 7ebbd4efc3), Yuan Fu, 2022/10/05
- feature/tree-sitter 23bb724c92 09/12: Add :override flag for tree-sitter font-lock, Yuan Fu, 2022/10/05
- feature/tree-sitter e504eabe88 02/12: Change tree-sitter indent anchor preset 'prev-line', Yuan Fu, 2022/10/05
- feature/tree-sitter 6a3caeab58 03/12: Remove treesit-query-in, Yuan Fu, 2022/10/05
- feature/tree-sitter 10f96a8c57 05/12: Improve documentation of tree-sitter search functions, Yuan Fu, 2022/10/05
- feature/tree-sitter cb183f6467 11/12: Add tree-sitter admin notes, Yuan Fu, 2022/10/05
- feature/tree-sitter 96d44c4321 06/12: Add treesit-language-version, Yuan Fu, 2022/10/05
- feature/tree-sitter 9b5ecffeb0 04/12: Ignore some capture name in treesit-font-lock-fontify-region, Yuan Fu, 2022/10/05
- feature/tree-sitter 1ea503ed4b 10/12: Add :override flag for python tree-sitter font-lock settings, Yuan Fu, 2022/10/05
- feature/tree-sitter 253126bf33 07/12: Fix python tree-sitter font-lock,
Yuan Fu <=
- feature/tree-sitter 6e60d46418 01/12: Fix tree-sitter manuals, Yuan Fu, 2022/10/05
- feature/tree-sitter 7a4380b905 08/12: ; * doc/lispref/parsing.texi (Language Definitions): Fix typo., Yuan Fu, 2022/10/05
- feature/tree-sitter 7ebbd4efc3 12/12: Merge branch 'master' into feature/tree-sitter, Yuan Fu, 2022/10/05