Skip to content

Add tree-sitter injections for jj config files #13926

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bryceberger
Copy link
Contributor

@bryceberger bryceberger commented Jul 10, 2025

The config file for jj has some tables that canonically contain a few domain-specific languages: all keys in [revsets] and [revset-aliases] are revsets, and similar for templates in [templates] and [template-aliases].

This injects those languages where appropriate.

screenshot
screenshot

@bryceberger
Copy link
Contributor Author

I assumed unconditionally injecting based on the table name was appropriate, given the same is done in yaml/injections.scm for GitHub/GitLab/Buildkit CI.

If that's not appropriate, I can change it. One option would be to detect a top-level "$schema" = "https://jj-vcs.github.io/jj/prerelease/config-schema.json", or similar.

@kpbaks
Copy link
Contributor

kpbaks commented Jul 10, 2025

I assumed unconditionally injecting based on the table name was appropriate, given the same is done in yaml/injections.scm for GitHub/GitLab/Buildkit CI.

If that's not appropriate, I can change it. One option would be to detect a top-level "$schema" = "https://jj-vcs.github.io/jj/prerelease/config-schema.json", or similar.

Maybe we can make a specialisation for the file format, which uses the same toml grammar, similar to what is done in #13925, and have it be selected using file-types = [{glob = "..."}] selectors.

@the-mikedavis
Copy link
Member

Yeah, injecting into all TOML isn't ideal. We should also consider splitting out the GitHub actions yaml injections into a separate language that globs for a .github directory which would reuse the yaml parser and add those injections.

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

Successfully merging this pull request may close these issues.

3 participants