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

docs: Expose config-schema.json in the docs site #5347

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rwjblue
Copy link

@rwjblue rwjblue commented Jan 12, 2025

When landed and published, this will expose the config file as:

https://jj-vcs.github.io/jj/latest/config-schema.json

Exposing the schema like that will allow users to reference in their ~/.config/jj/config.toml like:

"$schema" = 'https://jj-vcs.github.io/jj/latest/config-schema.json'

At which point any user with a configured LSP for TOML files will get inline documentation, suggestions on valid keys, &c.

Examples

Some example screenshots of this working in my local NeoVim setup (using a local mkdocs serve of these changes), but the same works in any editor with an LSP setup for TOML files.

Screenshot 2025-01-11 at 10 04 32 PM Screenshot 2025-01-11 at 10 06 41 PM Screenshot 2025-01-11 at 10 05 32 PM

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

Copy link

google-cla bot commented Jan 12, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@rwjblue
Copy link
Author

rwjblue commented Jan 12, 2025

There are a few other ways to do this (by adding other mkdocss plugins that would copy the file into place after the build), but this is the simplest path forward and I figured it'd give a good starting point for conversation. Let me know if we don't want a symlink in the repo like this, and I can work another version.

@rwjblue rwjblue force-pushed the rwjblue/expose-config-schema.json branch 2 times, most recently from 2ec04dd to 41f7e15 Compare January 12, 2025 14:38
@rwjblue rwjblue changed the title docs: Expose config-schema.json in the docs site docs: Expose config-schema.json in the docs site Jan 12, 2025
@rwjblue rwjblue marked this pull request as ready for review January 12, 2025 14:40
@rwjblue
Copy link
Author

rwjblue commented Jan 12, 2025

OK, just updated and marked as ready for review. I added a brief blurb to the CHANGELOG and also added a section to docs/config.md.

When landed and published, this will expose the config file as:

https://jj-vcs.github.io/jj/latest/config-schema.json

Exposing the schema like that will allow users to reference in their
`~/.config/jj/config.toml` like:

```toml
"$schema" = 'https://jj-vcs.github.io/jj/latest/config-schema.json'
```

At which point any user with a configured LSP for TOML files will get
inline documentation, suggestions on valid keys, &c.
@rwjblue rwjblue force-pushed the rwjblue/expose-config-schema.json branch from 41f7e15 to 3af6142 Compare January 12, 2025 15:17
Copy link
Member

@thoughtpolice thoughtpolice left a comment

Choose a reason for hiding this comment

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

This is a really cool feature I didn't know existed, thanks!


```toml
# Get editor completions based on the config schema
"$schema" = "https://jj-vcs.github.io/jj/latest/config-schema.json"
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, users would be able to target the version of the tool they have, but that's probably not always possible (i.e. git compiled versions?) We could figure that out later on, in any case!

Copy link
Author

Choose a reason for hiding this comment

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

Once we have it deployed for a tagged release we can start updating to use the version (the same way the rest of the docs are versioned), it just won't work for any versions prior (unless we have a system for back porting that kind of thing?).

@@ -77,6 +77,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* New `git.sign-on-push` config option to automatically sign commits which are being
pushed to a Git remote.

* Publish `config-schema.json` in the documentation site. Users can now reference
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably say:

The Jujutsu documentation site now publishes a schema for the official configuration file, which can be integrated into your editor for autocomplete, inline errors, and more. Please see the documentation for more on this.

i.e. we normally would link to the docs elsewhere, rather than including the example inline.

Copy link
Author

Choose a reason for hiding this comment

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

Sounds good, thank you!! I wasn't quite sure about how specific to be here. Will update shortly.

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.

2 participants