tamasfe / taplo

A TOML toolkit written in Rust
https://taplo.tamasfe.dev
MIT License
1.43k stars 114 forks source link

Problems detected on vscode in hugo.toml #481

Open TIT8 opened 1 year ago

TIT8 commented 1 year ago

Hi folks, thanks for your extension, it's really useful.

I report an issue that maybe is not related to the extension itself, maybe I am wrong writing toml file. I'm trying Hugo to build a website, so I'm writing the toml configuration file. I don't know why, I write the configurations as Hugo doc says (here for menus), but I've got too many "Problems" in VSCode when the extension is enabled.

Screenshot (7)

Screenshot (8)

Where am I wrong? Thanks in advance for your time.

PS - The website woks as expected.

Othmane-ElAlami commented 1 year ago

Me too, this is so weird, just yesterday my config file was clean and now there's 1001 errors without changing anything

image

ksmithdev commented 1 year ago

~My 8 line diesel.toml file is also now producing 72 errors.~ Somehow the cargo.toml spec was selected. I don't recall seeing that spec selection indicator before but now that I know it's there, I set it correctly and it's fine.

ia0 commented 1 year ago

Please provide reproduction steps and full file content in addition (or in place) of screenshots which are not enough to reproduce. Please also provide which version of Even Better TOML you are using.

TIT8 commented 1 year ago

Step to reproduce

  1. Open the linked file in VScode (its version doesn't matter for me, "Problems" will appear always)
  2. With Even better TOML extensions installed and enabled (version 0.19.2 as in the image)
  3. That Hugo's config file work as expected, the site will behave correct, but the extension throw "VScode Problems" when there aren't errors (or maybe I am missing something stupid)

Linked file to try the steps

Please change the file extension to toml: hugo.txt. It is the basic configuration file to use the Fixit theme in Hugo's generated website. In the first message I've linked the official documentation on Hugo's website which raise my issue: the toml is correct but Taplo throws you errors.

Image with details about the version:

Screenshot (7)

Screenshot (6)

panekj commented 1 year ago

From the first post screenshot, there's no schema selected: image

TIT8 commented 1 year ago

From the first post screenshot, there's no schema selected: image

I don't know why, if I click on that and select Taplo, nothing change and "no schema selected" remain. I don't know what the schema does, but still I cannot figure out why Taplo throws errors only on specific part of the toml and not other.

Othmane-ElAlami commented 1 year ago

I haven't done anything and now it's fixed. Strange

ia0 commented 1 year ago

I'm able to reproduce the issue with the provided file. The errors are legitimate. If there's a problem then the schema must be updated. For example the menu table disables additional properties and doesn't list params: https://github.com/SchemaStore/schemastore/blob/cfed08a0424492ae5d2fa32ca553a6cb10c55325/src/schemas/json/hugo.json#L1830. However in your file you have menu.main.params. That's just one example. I suggest opening a bug to https://github.com/SchemaStore/schemastore to fix the hugo.json.

TIT8 commented 1 year ago

Thanks for your help @ia0! I will update the schema and in case open an issue on SchemaStore.

Lruihao commented 11 months ago

I fixed the following options via SchemaStore/schemastore#3411 and SchemaStore/schemastore#3420:

The hugo configuration required by the FixIt theme is basically OK now.

Lruihao commented 10 months ago

Hi @ia0, I tried fixing the following error via https://github.com/SchemaStore/schemastore/pull/3463, but it doesn't seem to work, could you help me?

image
ia0 commented 10 months ago

Thanks @Lruihao for having done those 3 PRs to fix the hugo.toml schema.

I just tried the hugo.toml file provided in your last PR and it works for me, so I suspect you are victim of the schema caching mechanism of Taplo which seems to be specific to VS Code, see #347. I'm not sure what's the best way to refresh the cache. In theory it should only be cached for 10 minutes, but if you have internet problems and it cannot fetch the schema it will use the cached one even if expired. Maybe just deleting the file mentioned in #347 would work. Otherwise, just try again 10 minutes later making sure you can download schemas.