Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PromQL language support #2628

Merged
merged 9 commits into from Nov 12, 2020
Merged

Conversation

@arendjr
Copy link
Contributor

@arendjr arendjr commented Nov 10, 2020

This PR adds support for PromQL: https://prometheus.io/docs/prometheus/latest/querying/examples/

Copy link
Member

@RunDevelopment RunDevelopment left a comment

Thank you for the PR @arendjr!

I gave your PR a quick look and left you some comments. I'll give it a more in-depth review later.

Additional notes:

  • We only use single-quoted strings
  • Please quote all token names (e.g. 'comment', 'range-duration', etc) (like here).
  • Please use an IIFE to fix global namespace pollution (like here).

components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
tests/languages/promql/time_series_selection.test Outdated Show resolved Hide resolved
tests/languages/promql/subquery_selection.test Outdated Show resolved Hide resolved
tests/languages/promql/aggregate_selection.test Outdated Show resolved Hide resolved
@arendjr
Copy link
Contributor Author

@arendjr arendjr commented Nov 10, 2020

Thanks for the thorough feedback already! I have addressed the styling issues, split keywords and functions as appropriate, simplified some things and added another comment to address one of your questions :) To be honest, I'm not sure about all the original motivations, as I reused some code from the Monaco highlighter and the blog post I referenced, but thanks to your review, I think it's pretty cleaned up now.

examples/prism-promql.html Outdated Show resolved Hide resolved
components/prism-promql.js Outdated Show resolved Hide resolved
@RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Nov 10, 2020

Thank you for the quick response!

I still have some minor nits but it's overall it looks really good now.

arendjr and others added 2 commits Nov 10, 2020
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
components/prism-promql.js Outdated Show resolved Hide resolved
Co-authored-by: Michael Schmidt <mitchi5000.ms@googlemail.com>
Copy link
Member

@RunDevelopment RunDevelopment left a comment

Please rebuild, so I can merge.

@arendjr
Copy link
Contributor Author

@arendjr arendjr commented Nov 12, 2020

Done!

@RunDevelopment RunDevelopment merged commit 8831c70 into PrismJS:master Nov 12, 2020
7 checks passed
@RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented Nov 12, 2020

Thank you for contributing @arendjr!

@arendjr
Copy link
Contributor Author

@arendjr arendjr commented Nov 12, 2020

Thanks for your support! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants