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

Even Better TOML crashes on ruff.toml due to allOf usage #15978

Closed
DavisVaughan opened this issue Feb 5, 2025 · 3 comments · Fixed by #15992
Closed

Even Better TOML crashes on ruff.toml due to allOf usage #15978

DavisVaughan opened this issue Feb 5, 2025 · 3 comments · Fixed by #15992
Labels
bug Something isn't working configuration Related to settings and configuration

Comments

@DavisVaughan
Copy link

Description

Not sure if you all know this yet, but Even Better TOML in VS Code crashes for me on any ruff.toml, it looks like this:

Untitled.mov

I manually bisect-ed my way through your schema file and figured out it has to do with usage of allOf in these two spots:

ruff/ruff.schema.json

Lines 882 to 890 in c816542

"allOf": [
{
"$ref": "#/definitions/LineWidth"
}
]
},
{
"description": "Respect the line length limit setting for the surrounding Python code.",
"allOf": [

It is nothing ruff is doing wrong, and in fact there is a PR on the taplo side that does fix this exact issue (I confirmed by installing the PR rebased on master and trying again). But it is quite old and we probably need to remind them about it. tamasfe/taplo#644

Feel free to close since there is probably nothing actionable on y'alls part, but I didn't see any issues about this and figured you might want to know.

(Side note that taplo / even better toml is in an interesting spot, as it needs a new active maintainer, but is extremely useful for TOML autocompletion and I'd hate to see that extension die)

@MichaReiser
Copy link
Member

Thanks for the report. We weren't aware that even better TOML crashes on the schema and I can confirm that it is due to the use of allOf. Removing the Schema visitor that moves all $ref into an allOf when generating the schema fixes the crash

    let gen = schemars::gen::SchemaGenerator::new(
        schemars::gen::SchemaSettings::draft07().with(|config| config.visitors.clear()),
    );

However, this now leads to an invalid schema because all other properties on an object are ignored if it has a $ref property. But we could consider using oneOf instead of allOf

@MichaReiser MichaReiser added bug Something isn't working configuration Related to settings and configuration labels Feb 6, 2025
@MichaReiser
Copy link
Member

Hmm, or not. I'm confused. I can still reproduce that even better toml crashes whenever I add a new [ (individual settings is fine) but even removing the allOf won't help.

@MichaReiser
Copy link
Member

Okay, I had to set the even better TOML cache timeouts to a low value or it just keeps the schemas cached

    "evenBetterToml.schema.cache.memoryExpiration": 5,
    "evenBetterToml.schema.cache.diskExpiration": 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants