@font-lock-constant-face)))
"Tree-sitter font-lock settings.")
-(defun js--fontify-template-string (beg end node _override &rest _)
+(defun js--fontify-template-string (beg end node override &rest _)
"Fontify template string but not substitution inside it.
-BEG, END, NODE refers to the template_string node."
+BEG, END, NODE refers to the template_string node.
+
+OVERRIDE is the override flag described in
+`treesit-font-lock-rules'."
(ignore end)
;; You would have thought that the children of the string node spans
;; the whole string. No, the children of the template_string only
(let ((child (treesit-node-child node 0)))
(while child
(if (equal (treesit-node-type child) "template_substitution")
- (put-text-property beg (treesit-node-start child)
- 'face 'font-lock-string-face)
- (put-text-property beg (treesit-node-end child)
- 'face 'font-lock-string-face))
+ (treesit-fontify-with-override
+ beg (treesit-node-start child)
+ 'font-lock-string-face override)
+ (treesit-fontify-with-override
+ beg (treesit-node-end child)
+ 'font-lock-string-face override))
(setq beg (treesit-node-end child)
child (treesit-node-next-sibling child)))))
"VMSError" "WindowsError"
))
-(defun python--treesit-fontify-string (_beg _end node _override &rest _)
+(defun python--treesit-fontify-string (_beg _end node override &rest _)
"Fontify string.
NODE is the last quote in the string. Do not fontify the initial
-f for f-strings."
+f for f-strings. OVERRIDE is the override flag described in
+`treesit-font-lock-rules'."
(let* ((string (treesit-node-parent node))
(string-beg (treesit-node-start string))
(string-end (treesit-node-end string))
'font-lock-string-face)))
(when (eq (char-after string-beg) ?f)
(cl-incf string-beg))
- (put-text-property string-beg string-end 'face face)))
+ (treesit-fontify-with-override string-beg string-end face override)))
(defvar python--treesit-settings
(treesit-font-lock-rules