Add BIRD2 language
Summary
This PR introduces syntax highlighting support for the BIRD2 configuration language via .conf files used by the BIRD Internet Routing Daemon.
Unlike simpler configuration models (e.g., INI or Nginx), BIRD employs a uniquely intricate paradigm with distinct implementation challenges. We address this by adding a textmate grammar with precise scoping for:
- Protocol definitions
- Filter functions
- Route maps
- Other core BIRD2 constructs
Motivation
BIRD2 powers critical Internet infrastructure at scale, including:
- AMS-IX – 870+ ASNs, 14Tb/s traffic (ref)
- LINX – 1,000+ BGP sessions on v2.13 (ref)
- Cloudflare – Anycast routing across all edge PoPs (ref)
Despite its critical role in major Internet infrastructure, editors like VSCode and Shiki lack native grammar support for BIRD2 configurations. This PR aims to fill that gap.
References
- Grammar Source: bird-chinese-community/BIRD-tm-language-grammar
- Main Contributors: Alice39s, pppwaw
License
- Syntax files are distributed under Mozilla Public License 2.0
- Sample configuration files are distributed under MIT License
Checklist:
- [x] I am adding a new language.
-
[x] The extension of the new language is used in hundreds of repositories on GitHub.com.
- Search results for each extension:
- Public code rearch results -- 27k+ BIRD2 configuration snippets found in public repositories
- Public repo rearch results -- 883+ active repositories using BIRD configurations
bird.conf: 1.3k+ https://github.com/search?q=path%3Abird.conf&type=codebird6.conf: 275+ https://github.com/search?q=path%3Abird6.conf&type=codebird2.conf: 149+ https://github.com/search?q=path%3Abird2.conf&type=code
- Search results for each extension:
-
[x] I have included a real-world usage sample for all extensions added in this PR:
- Sample source:
- https://github.com/bird-chinese-community/BIRD-tm-language-grammar/blob/main/sample/
- Sample license: MIT License
- Sample source:
-
[x] I have included a syntax highlighting grammar: https://github.com/bird-chinese-community/BIRD-tm-language-grammar/blob/main/Syntaxes/bird2.tmLanguage.json
-
[x] I have added a color
- Hex value:
#b6d7e4 - Rationale: This color comes from the Official Documentation logo and accent colors.
- Hex value:
-
[x] I have updated the heuristics to distinguish my language from others using the same extension.
-
You're right — thanks for pointing that out.
I ran script/add-grammar and didn’t realize it would remove those entries automatically. That wasn’t my intention, and I’d be happy to fix it — though I’m not entirely sure what the best way is to restore them manually.
If you could point me in the right direction, I’d really appreciate it 🙏!
Apologies again for the unintended change.
The easiest would be to revert your previous commit and then re-apply just your changes.
Hi @lildude 👋
Gentle ping on this — updates done per your feedback (extensions & licenses) - Could you take a look when you have a moment?
Thanks for your time!
Samples can not be in subdirectories. Please move them to a level.
Please also update the PR template to provide individual links to the search results for each of the filenames you're adding and fix the information about the samples' sources and licences.
@lildude Thanks for the feedback and detailed explanation!
I've made the following changes based on your suggestions:
- I've moved all the sample configuration files from subdirectories to the top level. They are now all located in the
samples/BIRD2directory. - I've updated the PR template to provide individual search result links for each new filename.
- I've corrected the information regarding the samples' sources and licenses.
Please take another look, and let me know if there are any further changes required.
Hi @lildude, could you take a look at this when you have a chance? 🙂
Updates are in place, and I really appreciate your help!
Hi @lildude 👋
Hope you’re doing well! Just wanted to gently follow up on this PR when you have a moment. I believe all the requested changes have been addressed, and it’s currently awaiting your review.
Please let me know if there’s anything else you’d like me to adjust. Really appreciate your time and guidance on this!
Thanks in advance 🙏
The test failure is because
samples/BIRD2/bird.confis in the wrong place. It needs to be atsamples/BIRD2/filenames/bird.conf
Thanks for catching that! 🙏 I've moved the sample config to samples/BIRD2/filenames/bird.conf as suggested.
Please let me know if there’s anything else you'd like me to adjust.
a bunch of the regexes have extra erroneous backslashes https://github.com/bird-chinese-community/BIRD-tm-language-grammar/blob/c39653d00f6337f9fe4ba9c75f403c29dbec3907/grammars/bird2.tmLanguage.json#L558
a bunch of the regexes have extra erroneous backslashes
https://github.com/bird-chinese-community/BIRD-tm-language-grammar/blob/c39653d00f6337f9fe4ba9c75f403c29dbec3907/grammars/bird2.tmLanguage.json#L558
![]()
Hi, I I’ve just fixed the issue in the repo.