Add BitBake grammar and missing extensions #6665
Merged
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.
Description
The BitBake language is a metadata language created for the Yocto project. Support in linguist was added in 2014 (PR #1129), but at the time only to solve conflicts with BlitzBasic. Only the
.bb
extension was implemented without any grammar.The Yocto project now has an official VSCode extension which includes a TextMate grammar. This PR adds the BitBake grammar from this repository (MIT License).
This PR also adds the following file extensions for the BitBake language:
.bbappend
.bbclass
.conf
.inc
The two first extensions are pretty unique so no heuristics was needed.
ForConcerning.conf
, I added it togeneric.yml
because a lot of Linux configuration files are using it (and are not BitBake). I tried to make heuristics that match BitBake specific assignments (e.g.,A += ...
) which are usually not present in generic conf files..inc
, there are many languages having this extension so making the heuristics was tricky. The current heuristics is a bit too restrictive (that's why I have added two.inc
sample files), but still matches the majority (~ 95%) of BitBake.inc
files in my experiments.Finally, I fixed the
.bb
heuristics to reduce BlitzBasic misclassification. In my experiments, the error rate was less than 1%.I made may experiments using the following repositories:
Checklist:
I am adding a new extension to a language.
The new extension is used in hundreds of repositories on github.com
https://github.com/search?type=code&q=NOT+is%3Afork+path%3A*.conf+MACHINEOVERRIDESI have included a real-world usage sample for all extensions added in this PR:
https://github.com/agherzan/meta-raspberrypi/blob/master/conf/machine/raspberrypi4-64.confI have included a change to the heuristics to distinguish my language from others using the same extension.
I am changing the source of a syntax highlighting grammar