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

languages: add CEL, SpiceDB schema language #9296

Merged
merged 5 commits into from Feb 12, 2024

Conversation

jzelinskie
Copy link
Contributor

CEL (Common Expression Language) is a non-Turing-Complete language created at Google for embedding into programs. It's used in a variety of projects such as Kubernetes and SpiceDB.

SpiceDB is a popular, open source authorization system inspired by the system internal at Google, Zanzibar.

This PR adds language/grammar support for both of these projects.

I'm not sure the CEL highlighting is working -- I might need some help with writing custom queries for it. The SpiceDB grammar includes queries that target Helix.

@jzelinskie
Copy link
Contributor Author

I seem to be getting the following error when I run cargo xtask docgen:

error[E0658]: use of unstable library feature 'stdsimd'

@the-mikedavis
Copy link
Member

Are you running on aarch64? That may be #9294. You can apply the diff suggested in the Docs CI or revert the dep locally temporarily to fix the build

languages.toml Outdated Show resolved Hide resolved
languages.toml Outdated Show resolved Hide resolved
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to add the queries to runtime/queries/cel/highlights.scm and runtime/queries/spicedb/highlights.scm. You can use the queries in the repos if they exist (queries/highlights.scm) as guides or copy them if they already use the Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting) - we don't automatically use the ones in the repos.

@the-mikedavis the-mikedavis added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-language-support Area: Support for programming/text languages labels Jan 10, 2024
@jzelinskie
Copy link
Contributor Author

Thanks for the feedback!

I am using an M1, so rebasing on master fixed my issue.

I copied over the queries. I'd love a sanity check from someone better at tree-sitter because I'm not sure CEL is being properly injected into the (caveat_expr) .

runtime/queries/cel/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/cel/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/cel/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/spicedb/highlights.scm Outdated Show resolved Hide resolved
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
@jzelinskie
Copy link
Contributor Author

Thanks very much for the feedback! I've commit your changes.

What's a good way to test the injecting of CEL into the SpiceDB schema?

@the-mikedavis
Copy link
Member

the-mikedavis commented Feb 7, 2024

You'll have to test the injection manually by finding a caveat_expr node in a SpiceDB file and checking its highlighting.

You can examine the syntax trees when you're in a SpiceDB file by selecting a block for example and using :tree-sitter-subtree

@jzelinskie
Copy link
Contributor Author

Thanks a ton!
I'm not sure how I didn't discover that command before, but it was vital for debugging.

I've got it all working now!

@kirawi kirawi added S-waiting-on-review Status: Awaiting review from a maintainer. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 8, 2024
@pascalkuthe pascalkuthe merged commit d9f7aaa into helix-editor:master Feb 12, 2024
6 checks passed
@jzelinskie jzelinskie deleted the spicedb-ls branch February 12, 2024 14:41
cosmikwolf pushed a commit to cosmikwolf/helix that referenced this pull request Feb 26, 2024
* languages: add CEL language and grammar

* languages: add spicedb schema language

* chore: docgen

* runtime/queries: refine spicedb & cel highlights

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* languages: update spicedb

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
shortc pushed a commit to shortc/helix that referenced this pull request Mar 31, 2024
* languages: add CEL language and grammar

* languages: add spicedb schema language

* chore: docgen

* runtime/queries: refine spicedb & cel highlights

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* languages: update spicedb

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
postsolar pushed a commit to postsolar/helix that referenced this pull request Apr 4, 2024
* languages: add CEL language and grammar

* languages: add spicedb schema language

* chore: docgen

* runtime/queries: refine spicedb & cel highlights

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>

* languages: update spicedb

---------

Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages S-waiting-on-review Status: Awaiting review from a maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants