nextjournal / lezer-clojure

This is a Clojure grammar for the lezer parser system.
ISC License
22 stars 3 forks source link

Specify style tags within the grammar #21

Open wavejumper opened 1 year ago

wavejumper commented 1 year ago

Hi there,

First off, thanks everyone for your work on this excellent library!

Lezer added support for specifying default props within the grammar file using @external propSource. As far as I understand this enables you to declare the syntax highlighting within the lezer grammar itself.

For example lezer-json defines an @external propSource linking to these styleTags.

It would be great if lezer-clojure did something similar. Right now you need to pull in the clojure-mode package to grab the style tags.

For our use case, nothing in clojure-mode is particularly applicable except for the style tags.

If this sounds like a reasonable request/contribution, I'd be happy to draft up a PR :)

zampino commented 1 year ago

Hi @wavejumper, yes I've recently seen this style in other grammars and it's probably worth to comply with it.

That said we also define highlight properties in @nextjournal/lang-clojure, which is a tiny package in the style of the official codemirror/lang-x languages. Using that, you won't need to pull the whole clojure-mode.