-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grammar checking in source code comments #22
Comments
Sorry for the late reply. Being busy with something else! 😓 This require a parser to parse things correctly. Does flyspell do that already? But this indeed a nice feature to have. |
Flyspell already does it with a simple trick: First they set a predicate: (that's used here for example) flyspell-generic-check-word-predicate And when in prog-mode they set it to: (setq flyspell-generic-check-word-predicate
#'flyspell-generic-progmode-verify) With (defun flyspell-generic-progmode-verify ()
"Used for `flyspell-generic-check-word-predicate' in programming modes."
(unless (eql (point) (point-min))
;; (point) is next char after the word. Must check one char before.
(let ((f (get-text-property (1- (point)) 'face)))
(memq f flyspell-prog-text-faces)))) And (defcustom flyspell-prog-text-faces
'(font-lock-string-face font-lock-comment-face font-lock-doc-face)
"Faces corresponding to text in programming-mode buffers."
:type '(set (const font-lock-string-face)
(const font-lock-comment-face)
(const font-lock-doc-face))
:version "28.1") (this variable needs to be customised when using tree-sitter by adding tree-sitter-hl-face:comment
tree-sitter-hl-face:doc
tree-sitter-hl-face:string ) No worries for the late reply ;-) |
Thanks for the information! Just to let you know, PRs are welcome if you got any idea implementing this feature! I would take a harder look once I have time for this package! |
Yes, I was thinking about doing a PR but like you I have other things to do first ;-) |
Hi,
Thanks a lot for this package!
I wondered if it was possible to have a mode similar to flyspell-prog-mode to check grammars in source code comments, doc and strings.
The text was updated successfully, but these errors were encountered: