You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Syntax highlighting does not use git.commentchar for highlighting comments #45
Currently, syntax highlighting assumes # is the comment character used in Git Commit messages. The comment character used in Git Commit messages can be configured using core.commentChar in .gitconfig. That functionality is commonly used to change the comment character to something else such that an issue tracker number can be used at the beginning of the commit message such as: #123: Some changes.
If possible, the syntax highlighting would read the configuration to determine the comment character instead of assuming # and highlight comments based on the configured character.
Many languages have some tokens whose structure is impossible or inconvenient to describe with a regular expression
...and...
..in order to add custom logic for recognizing certain tokens.
So, I'm hoping those statements mean that this could be used to in some way read the commentchar config and then detect the comment token without affecting the rest of the parser too heavily.
I started an implementation in the other fork the-mikedavis/tree-sitter-git-commit#17, but never finished before it was archived. Will keep you updated if I find time to submit a PR here.
Activity
gbprod commentedon Jul 27, 2023
Hey, that's really interesting !
I don't know if it's possible to do that with tree-sitter but I will do some research.
I don't have much time right now but I'll work on it 😅
alewis001 commentedon Jul 27, 2023
That's all I can and would ask for 😄 and thank you for any time you can spend looking at this.
I'll try to do some digging myself. Neovim, treesitter, etc. are somewhat new to me so don't hold your breath though 😄
alewis001 commentedon Jul 27, 2023
I'm probably only telling you what you already know but, just in case this helps at all... https://tree-sitter.github.io/tree-sitter/creating-parsers#external-scanners
It says...
...and...
So, I'm hoping those statements mean that this could be used to in some way read the commentchar config and then detect the comment token without affecting the rest of the parser too heavily.
iliekturtles commentedon Jul 31, 2025
I reported the same issue at the-mikedavis/tree-sitter-git-commit#16 before Helix switched to using this fork of tree-sitter-git-commit. Rather than parse
commentChar, another solution is to use a fixed list of comment characters, which is what Neovim appears to do: https://github.com/neovim/neovim/blob/2b21c9c23f889555dd93ba508a0f787b25ed9bb4/runtime/ftplugin/gitcommit.vim#L21.#;@!$%^&|:are all allowed.gbprod commentedon Jul 31, 2025
Interesting, I'll try to implements this. Not sure that I'll can do that this month but a PR is welcome :)
iliekturtles commentedon Jul 31, 2025
I started an implementation in the other fork the-mikedavis/tree-sitter-git-commit#17, but never finished before it was archived. Will keep you updated if I find time to submit a PR here.
feat: consider additional characters as comments (gbprod#45, gbprod#75)
fix(git): disable commentChar auto to prevent git 3.0 breaking change