mirror of
https://github.com/martinvonz/jj.git
synced 2025-05-05 23:42:50 +00:00
docs: Expose config-schema.json in the docs site
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.
This commit is contained in:
parent
be9483b1cf
commit
9ed1fde364
@ -85,6 +85,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
useful for defining disabled tools in user configuration that can be enabled
|
useful for defining disabled tools in user configuration that can be enabled
|
||||||
in individual repositories with one config setting.
|
in individual repositories with one config setting.
|
||||||
|
|
||||||
|
* 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](/docs/config.md#json-schema-support)
|
||||||
|
for more on this.
|
||||||
|
|
||||||
### Fixed bugs
|
### Fixed bugs
|
||||||
|
|
||||||
* Fixed diff selection by external tools with `jj split`/`commit -i FILESETS`.
|
* Fixed diff selection by external tools with `jj split`/`commit -i FILESETS`.
|
||||||
|
1
docs/config-schema.json
Symbolic link
1
docs/config-schema.json
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../cli/src/config-schema.json
|
@ -23,12 +23,17 @@ These are listed in the order they are loaded; the settings from earlier items
|
|||||||
in the list are overridden by the settings from later items if they disagree.
|
in the list are overridden by the settings from later items if they disagree.
|
||||||
Every type of config except for the built-in settings is optional.
|
Every type of config except for the built-in settings is optional.
|
||||||
|
|
||||||
|
You can enable JSON Schema validation in your editor by adding a `$schema`
|
||||||
|
reference at the top of your TOML config files. See [JSON Schema
|
||||||
|
Support] for details.
|
||||||
|
|
||||||
See the [TOML site] and the [syntax guide] for a detailed description of the
|
See the [TOML site] and the [syntax guide] for a detailed description of the
|
||||||
syntax. We cover some of the basics below.
|
syntax. We cover some of the basics below.
|
||||||
|
|
||||||
[the user config file]: #user-config-file
|
[the user config file]: #user-config-file
|
||||||
[TOML site]: https://toml.io/en/
|
[TOML site]: https://toml.io/en/
|
||||||
[syntax guide]: https://toml.io/en/v1.0.0
|
[syntax guide]: https://toml.io/en/v1.0.0
|
||||||
|
[JSON Schema Support]: #json-schema-support
|
||||||
|
|
||||||
The first thing to remember is that the value of a setting (the part to the
|
The first thing to remember is that the value of a setting (the part to the
|
||||||
right of the `=` sign) should be surrounded in quotes if it's a string.
|
right of the `=` sign) should be surrounded in quotes if it's a string.
|
||||||
@ -1272,6 +1277,41 @@ default locations. For example,
|
|||||||
env JJ_CONFIG=/dev/null jj log # Ignores any settings specified in the config file.
|
env JJ_CONFIG=/dev/null jj log # Ignores any settings specified in the config file.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### JSON Schema Support
|
||||||
|
|
||||||
|
Many popular editors support TOML file syntax highlighting and validation. To
|
||||||
|
enable schema validation in your editor, add this line at the top of your TOML
|
||||||
|
config files:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
"$schema" = "https://jj-vcs.github.io/jj/latest/config-schema.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
This enables features like:
|
||||||
|
|
||||||
|
- Autocomplete for config keys
|
||||||
|
- Type checking of values
|
||||||
|
- Documentation on hover
|
||||||
|
- Validation of settings
|
||||||
|
|
||||||
|
Here are some popular editors with TOML schema validation support:
|
||||||
|
|
||||||
|
- VS Code
|
||||||
|
- Install [Even Better TOML](https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml)
|
||||||
|
|
||||||
|
- Neovim/Vim
|
||||||
|
- Use with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [taplo](https://github.com/tamasfe/taplo)
|
||||||
|
|
||||||
|
- JetBrains IDEs (IntelliJ, PyCharm, etc)
|
||||||
|
- Install [TOML](https://plugins.jetbrains.com/plugin/8195-toml) plugin
|
||||||
|
|
||||||
|
- Sublime Text
|
||||||
|
- Install [LSP](https://packagecontrol.io/packages/LSP) and [LSP-taplo](https://packagecontrol.io/packages/LSP-taplo)
|
||||||
|
|
||||||
|
- Emacs
|
||||||
|
- Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) and [toml-mode](https://github.com/dryman/toml-mode.el)
|
||||||
|
- Configure [taplo](https://github.com/tamasfe/taplo) as the LSP server
|
||||||
|
|
||||||
### Specifying config on the command-line
|
### Specifying config on the command-line
|
||||||
|
|
||||||
You can use one or more `--config`/`--config-file` options on the command line
|
You can use one or more `--config`/`--config-file` options on the command line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user