{"id":13480323,"url":"https://github.com/stsewd/tree-sitter-comment","last_synced_at":"2025-05-16T13:02:54.124Z","repository":{"id":46645684,"uuid":"334554400","full_name":"stsewd/tree-sitter-comment","owner":"stsewd","description":"Tree-sitter grammar for comment tags like TODO, FIXME(user).","archived":false,"fork":false,"pushed_at":"2025-05-03T23:45:39.000Z","size":567,"stargazers_count":148,"open_issues_count":7,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-11T06:03:21.903Z","etag":null,"topics":["comment-tag","comments","tree-sitter","tree-sitter-parser"],"latest_commit_sha":null,"homepage":"https://stsewd.dev/tree-sitter-comment/","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stsewd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"stsewd","custom":["https://paypal.me/stsewd","https://www.buymeacoffee.com/stsewd"]}},"created_at":"2021-01-31T02:14:58.000Z","updated_at":"2025-05-03T23:45:43.000Z","dependencies_parsed_at":"2022-08-22T06:00:36.773Z","dependency_job_id":"aa31bd70-1ddd-47e3-9119-88823d6f0021","html_url":"https://github.com/stsewd/tree-sitter-comment","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stsewd%2Ftree-sitter-comment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stsewd%2Ftree-sitter-comment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stsewd%2Ftree-sitter-comment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stsewd%2Ftree-sitter-comment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stsewd","download_url":"https://codeload.github.com/stsewd/tree-sitter-comment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254535826,"owners_count":22087398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["comment-tag","comments","tree-sitter","tree-sitter-parser"],"created_at":"2024-07-31T17:00:37.409Z","updated_at":"2025-05-16T13:02:54.090Z","avatar_url":"https://github.com/stsewd.png","language":"C","readme":"# tree-sitter-comment\n\n[![CI](https://github.com/stsewd/tree-sitter-comment/workflows/CI/badge.svg)](https://github.com/stsewd/tree-sitter-comment/actions?query=workflow%3ACI+branch%3Amaster)\n\n[Tree-sitter](https://github.com/tree-sitter/tree-sitter) grammar for comment tags like `TODO:`, `FIXME(user):`, etc.\nUseful to be embedded inside comments.\n\nCheck the playground at \u003chttps://stsewd.dev/tree-sitter-comment/\u003e.\n\n## Syntax\n\nSince comment tags aren't a programming language or have a standard,\nI have chosen to follow popular conventions for the syntax.\n\n### Comment tags\n\n* Comment tags can contain:\n  - Upper case ascii letters\n  - Numbers (can't start with one)\n  - `-`, `_` (they can't start or end with these characters)\n* Optionally can have an user linked to the tag inside parentheses `()`\n* The name must be followed by `:` and a whitespace\n\n### URIs\n\n* http and https links are recognized\n\nIf you think there are other popular conventions this syntax doesn't cover,\nfeel free to open a issue.\n\n## Examples\n\n```\nTODO: something needs to be done\nTODO(stsewd): something needs to be done by @stsewd\n\nXXX: fix something else.\nXXX:    extra white spaces.\n\n(NOTE: this works too).\n\nNOTE-BUG (stsewd): tags can be separated by `-`\nNOTE_BUG: or by `_`.\n\nThis will be recognized as a URI\nhttps://github.com/stsewd/\n```\n\n## FAQ\n\n### Can I match a tag that doesn't end in `:`, like `TODO`?\n\nThis grammar doesn't provide a specific token for it,\nbut you can match it with this query:\n\n```scm\n(\"text\" @todo\n (#eq? @todo \"TODO\"))\n```\n\n### Can I highlight references to issues, PRs, MRs, like `#10` or `!10`?\n\nThis grammar doesn't provide a specific token for it,\nbut you can match it with this query:\n\n```scm\n(\"text\" @issue\n (#match? @issue \"^#[0-9]+$\"))\n\n;; NOTE: This matches `!10` and `! 10`.\n(\"text\" @symbol . \"text\" @issue\n (#eq? @symbol \"!\")\n (#match? @issue \"^[0-9]+$\"))\n```\n\n### I'm using Neovim and don't see all tags highlighted\n\nTo avoid false positives, Neovim doesn't highlight all tags,\nbut a list of specific ones,\nsee the list at [`queries/comment/highlights.scm`](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/comment/highlights.scm).\n\nIf you want your tag highlighted, you can extend the query locally, see `:h treesitter-query`.\nOr if you think it's very common, you can suggest it [upstream](https://github.com/nvim-treesitter/nvim-treesitter).\n\n## Why C?\n\nTree-sitter is a [LR parser](https://en.wikipedia.org/wiki/LR_parser) for context-free grammars,\nthat means it works great for grammars that don't require backtracking,\nor to keep a state for whitespaces (like indentation).\nFor these reasons, parsing _languages_ that need to keep a state or falling back to a general token,\nit requires some manual parsing in C.\n\n## Projects using this grammar\n\n- [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)\n- [helix](https://github.com/helix-editor/helix)\n- Yours?\n\n## Other grammars\n\n- [tree-sitter-rst](https://github.com/stsewd/tree-sitter-rst): reStructuredText grammar.\n","funding_links":["https://github.com/sponsors/stsewd","https://paypal.me/stsewd","https://www.buymeacoffee.com/stsewd"],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstsewd%2Ftree-sitter-comment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstsewd%2Ftree-sitter-comment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstsewd%2Ftree-sitter-comment/lists"}