github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
11.95k stars 4.14k forks source link

Add PromQL language #5570

Open daquinoaldo opened 2 years ago

daquinoaldo commented 2 years ago

Language name

PromQL – Prometheus Query Language

URL of syntax highlighting grammar

https://github.com/prometheus-community/codemirror-promql

Nixinova commented 2 years ago

What is the file extension for PromQL? There are only 12 '.promql' files

SuperQ commented 1 year ago

PromQL is often embedded in documentation rather than split out into separate files.

roidelapluie commented 1 year ago

New link is https://github.com/prometheus/prometheus/tree/main/web/ui/module/codemirror-promql

RiRa12621 commented 1 year ago

To follow up here a little. PromQL is usually not used as "code" per-se and therefore there are rarely any .promql files. However, it is widely used and you'd often find the language itself embedded in other file types like here https://github.com/prometheus-operator/kube-prometheus/blob/6cdfe6ef23885d00ae1642e666f843db12793322/manifests/prometheus-prometheusRule.yaml#L51 where you'd see a collection of prometheus rules. Those PromQL parts can often be shared as part of PRs and therefore a highlighting in the snippets would be quite useful, as in this PR for example: https://github.com/pyrra-dev/pyrra/pull/711

Now that that's a little clarified, does it make sense to follow the regular process for adding a new language from https://github.com/github-linguist/linguist/blob/master/CONTRIBUTING.md#adding-a-language and if so, are there further pointers as to how the grammar repository should look like?

cc @metalmatze

soma-kurisu commented 2 months ago

I'm interested what's your preferred highlighting mitigation. Until we hopefully do get PromQL syntax highlighting support one day, I keep using the existing C language support, although it's not really convincing.