Repository navigation
Highlighting for HQL, and for a cell in any language - #12
Merged
Merged
Conversation
HQL is a language of the extension: a `.hql` file is coloured, and so is the body of an `hql` fence in a card. The token rules follow the scanner and parser of HQL 0.8.0. A fence with a cell suffix, such as `python#eval id=plot`, is coloured as that language. The Markdown grammar does not read a language name followed by `#`, so the extension has its own fence rules, generated by `syntaxes/fences.mjs` from two tables: the languages VS Code ships a grammar for, and the 770 languages of GitHub Linguist 9.7.0 that have a TextMate scope. A fence in a language with no installed grammar has its opening line coloured and its body left plain. The mode, the attributes, and the `hql:output` markers have their own colours. `examples/highlighting` is a vault to look at in the editor: HQL cells with their saved output, fences in many languages, two standalone `.hql` files, and the forms of a fence the rules do not reach yet.
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.
What changes
.hqlfile is coloured, and so is the body of anhqlfence in a card. The token rules follow the scanner and parser of HQL 0.8.0.python#eval id=plotwas shown in one colour, because the Markdown grammar does not read a language name followed by#. The extension now has its own fence rules.syntaxes/fences.mjsfrom two tables: the languages VS Code ships a grammar for, and the 770 languages of GitHub Linguist 9.7.0 that have a TextMate scope. A fence in a language with no installed grammar has its opening line coloured and its body left plain.hql:outputmarkers have their own colours: the language, the mode, each attribute.examples/highlightingis a vault to look at in the editor, opened withnpm run example:highlighting.How it was checked
examples/highlighting/cells.hmdwere run withhql render, andqueries/catalog.hqlwithhql run.Known gaps, each a row in the extension's tracker