Skip to content
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

Syntax highlighting does not use git.commentchar for highlighting comments #45

Open
alewis001 opened this issue Jul 11, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@alewis001
Copy link

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.

@gbprod
Copy link
Owner

gbprod commented 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
Copy link
Author

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
Copy link
Author

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...

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants