Closed LemonBreezes closed 8 months ago
Actually, I just realized I can use cape-capf-predicate
.
Oh wait, it's more performant to make a real wrapper. XD
(defun doom-point-in-docstring-or-comment-p ()
"Check if the point is in a docstring or comment."
(let ((faces (get-text-property (point) 'face)))
(pcase faces
((or 'tree-sitter-hl-face:doc 'font-lock-doc-face) t)
((pred listp) (or (memq 'tree-sitter-hl-face:doc faces)
(memq 'font-lock-doc-face faces)))
(_ (doom-point-in-comment-p)))))
(defun cape-wrap-inside-docstring-or-comment (capf)
(and (doom-point-in-docstring-or-comment-p) (funcall capf)))
I think a more general cape-capf-inside-faces would be nice to have. It could take a list of faces as rest argument.
Hi. It would be nice if we had a cape wrapper for when the point is inside a docstring. Maybe with
tree-sitter-hl-face:doc
andfont-lock-dock-face
. Then we could write emojis in docs!