Merged
Conversation
efb0a9a to
be97c14
Compare
be97c14 to
e7a3298
Compare
There was a problem hiding this comment.
Pull request overview
This PR automates language mapping generation by reading all Chroma lexers dynamically and generating mappings, tests, and handling aliases. Key improvements include upgrading Chroma to v2.21.1 and adding support for new languages (C3, Kakoune, RGBDS Assembly).
- Replaces manual map creation in
language_maps.gowith automated generation from Chroma's lexer registry - Generates comprehensive test coverage with 802 primary string tests and 212 alias tests
- Adds chromaPriority entries for Protocol Buffer Text Format and WebAssembly Text Format
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/heartbeat/language_gen.go | Complete rewrite to generate mappings from Chroma lexers instead of parsing existing maps |
| pkg/heartbeat/language_generated.go | Generated file with all language mappings (stringToLanguage, chromaToLanguage, languageToString, languageToChroma) |
| pkg/heartbeat/language.go | Added new Language constants (C3, Kakoune, RGBDS Assembly) and chromaPriority documentation |
| pkg/heartbeat/language_test.go | Auto-generated test entries reorganized alphabetically with 802 tests and 212 alias tests |
| go.mod | Upgraded Chroma from v2.20.0 to v2.21.1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## develop #1256 +/- ##
========================================
Coverage 53.17% 53.17%
========================================
Files 394 394
Lines 11496 11496
========================================
Hits 6113 6113
Misses 4841 4841
Partials 542 542
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Closed
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
language_gen.goto automatically generate test entries inlanguage_test.go. The generator now:stringToLanguageandlanguageToStringmaps (excluding "unknown"/LanguageUnknown)chromaToLanguageandlanguageToChromamapslanguageTests()entries: These are the primary string values for each Language constant (e.g., "Go" →LanguageGo). The entries respect priority overrides from the priority section in language.go.languageTestsAliases()entries: These are aliases that parse to Language constants but differ from the primary string. They include:The generated test file now has:
802 languageTests entries (primary string values)
212 languageTestsAliases entries (aliases from Chroma and priority overrides)