feat(editor): highlight Protocol Buffers in code blocks #841
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
Reviewed/Confirmed
Reviewed/Duplicate
Reviewed/Invalid
Reviewed/Won't Fix
Status/Abandoned
Status/Blocked
Status/Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
project-halkyon/halkyon-learn!841
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/841/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The gRPC deck is 336 cards about a contract-first protocol, and the
contract is always a
.protofile. Thirteen of its code blocks hold one,and every chapter's explanation hangs off the service or message
definition beside it — but
protobufwas in neither_grammarsnorkCodeBlockLanguages, so those blocks rendered as unstyled monospace andthe block language menu offered no way to tag them as anything but
text. A field number is easy to lose in grey when it is the whole pointof the line.
The grammar already ships in
highlight, so this is one import, one mapentry, and one row in each of the two menu lists — the same three
touchpoints as #840, in the same relative position: beside
sql, aheadof the data formats, since a
.protofile is a schema rather than ageneral-purpose language.
It is also the cheapest grammar added so far.
protobuf.dartis 978bytes of rule set, against the 31 KB the four Apple-platform and
build-file grammars cost in #840 — the language has a dozen keywords and
no expression syntax to speak of.
code_highlighting_test.dartgains the round-trip check the groupalready applies to every other newly registered grammar: the coloured
runs must rejoin to the source character for character, and at least one
must carry a colour, so a silent fallback to plain text fails rather than
passing as "rendered". The fixture is a service with a unary and a
server-streaming method plus a message with numbered and
repeatedfields, which is the shape most of the deck's blocks take.
The notebook's own registry in
code_editor_config.dartstays untouched,as with the last batch: those languages are the ones Judge0 can execute,
and there is nothing to execute in an IDL.