lang-sql highlight feature request

is it possible to have more highlight setting on lang-sql, just like the way monaco editor does.

as they are dividing keywords into builtin functions, builtin variables. The granularity of monaco editor towards keywords is higher. Can we do that as well?

@codemirror/lang-sql dialects support keyword, builtin, and type words, so at a glance, this seems to already exist.

however, I haven’t found a way to highlight builtin and type words based on the implementation of lezer highlight mechanism.

As you see in the following snapshot, builtin is derived from tags.name??
My requirement is like, Monaco editor treat things like SUM AVG as `builtin function which can be configured into a different color than keyword.

Maybe I haven’t read through the source code, care to give an example?

Which dialect are you using? It looks like the Postgres dialect doesn’t define any builtins and has everything under keyword. The Postgres docs just have a big list of keywords (including things like avg) and don’t seem to differentiate between the two. I don’t know enough about the language to know these apart, but if you think you can separate them, the definition is in lang-sql/src/sql.ts at main · codemirror/lang-sql · GitHub under export const PostgreSQL.

for things that need to be differentiated, e.g. distinguish AVG from keywords, I can do it by myself.

But, how can I configure my highlight color if I put AVG under builtin?
AFAIK, there is no way to define a color for built in as this is based on tags.name, which is literally all names listed for a specific language. right?

so, in my code, how can I configure another color for builtin? there is no property named builtin at this time point.

if not, can you show me an example?

Builtins are styled with tags.standard(tags.name). You can use that in a highlight style.

alright. this does fix my issue.
but what’s the meaning of standard? so does other functionalities defined in tags within lezer?


are they used for extended highlight tag properties? if so, why not directly define a new property?
just curious.

back to my original request, it seems that we can not do further extract, right?
like split regular sql operators e.g. INNER JOIN from builtIn.
As I’d like to reserve builtin for those functions, e.g. AVG, SUM. Is there a way to do that?