-
Notifications
You must be signed in to change notification settings - Fork 33
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
JSONC/JSON5, yaml, toml ... #647
Comments
Are there any links to issues in the TypeScript repo about this? Before implementing such a feature it is important for us to know where TS stands so we can ensure long term compatibility. |
Good thinking, but I haven't found any mention of this in the roadmap. There are two relevant entries in the Issues, this one, which requests support for JSON5 and this one, but that concerns itself with the format of specifically Neither have any satisfying resolution. The former is closed with a comment that I think is missing the point, the latter hasn't seem to have received any official response. Bun purportedly have support for toml imports, but it doesn't really seem to work as stated in the docs. I played around with it and most I could do is import the toml file, but it's For that to work, you need to create a |
Ok, after reading through the TS issues I think this is a good idea. Here's my thoughts:
I think this will strike a good balance between keeping the civet install small, keeping the config lookup/parsing quick, and allowing an intuitive flexibility of configuration. |
For type-checked imports we may be able to auto-generate a |
This sounds great! I imagine this would need to be done in the LSP, the CLI, the unplugin, and For typing, maybe we could use something like https://github.com/quicktype/quicktype if that's installed locally? Here's a little demo of quicktype from their website: |
Are we talking about To be honest, I'm not particularly concerned about the format of those particular config files, cause they are never(?) imported in the project and What I'm really after is to be able to import any "jsonc"/yaml/toml file in a type-checked way.
I'm not sure about this. Seems kinda weird. I don't recall any other package where other installed packages modify the behaviour. I do appreciate the benefits of this, I'm just not a fond of this kind of implicit magic. Come to think of it, pug has a feature where you can use installed It's not like I have a better idea though, so I guess it's fine.
🫶 |
Some of my thoughts on this are combining with #641 so sorry for any confusion. Just trying to think through the general case of "what kind of data/config files can I import in my project" a subset of which is the civet config. As for the magic lookups I think it would only really apply to the civet config part of this when no explicit config is specified. To opt out of the magic behavior just specify an explicit config. When importing Thanks for opening the issue and I hope this clarifies things! |
Sure, right, gotcha! |
For anyone looking for this, if you're using Bun, importing a JSON with comments does work.
|
... you know where this is going 😄
Do you see a future where Civet might support the type-checked imports of "JSON with Comments" files, or maybe even YAML or TOML? Like how TS already supports direct, type-checked JSON imports.
I'm one of those peeps that are heartbroken, heartbroken I tell ya, by the fact that JSON can't have comments. VSCode has its own "JSON with Comments" format to make it not flip out over the comments, but those files fail at runtime in TS when imported. I'd use other data formats, but those can't be imported nicely.
... pwetty pwease?
The text was updated successfully, but these errors were encountered: