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 air.toml's json schema to schemastore for autocompletion and diagnostics #106

Open
DavisVaughan opened this issue Dec 15, 2024 · 2 comments

Comments

@DavisVaughan
Copy link
Collaborator

This is a bit of a future looking goal once things stabilize.

We should create a "json schema" for our toml file and get it on https://www.schemastore.org/json/ by sending a PR to https://github.com/SchemaStore/schemastore. We can do this by tagging our TomlOptions fields using the schemars crate which integrates with serde-json, and then emitting a json schema for that struct to a file.

The reason we'd want to do this is to get autocompletion and diagnostics in our air.toml file. With the Even Better TOML extension in VS Code and in some IDEs natively like PyCharm, if you have a json schema for your file on schemastore, then it will automatically start providing autocompletions and diagnostics for that file. Super useful so you don't have to guess if your toml config is right or not.

pypa/hatch#731 (comment)

@lionel-
Copy link
Collaborator

lionel- commented Dec 16, 2024

ooh that's nice!

@DavisVaughan
Copy link
Collaborator Author

IIUC in our vs code extension we can even register our schemastore as the toml validator and even better toml will pick it up. ruff doesn't do this from what I can tell so we'd be experimenting a bit but it would be nice if that made it mostly automatic https://taplo.tamasfe.dev/configuration/developing-schemas.html#visual-studio-code-extensions

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

No branches or pull requests

2 participants