tamasfe / taplo

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

VSCode: Hugo theme toml configuration file shows 96 errors in 30-line file #696

Closed aa956 closed 1 week ago

aa956 commented 1 week ago

Visual Studio Code with Even Better TOML extension, version 0.19.2.

Shows a lot of errors opening the Hugo theme configuration file generated using hugo new theme themename.

File theme.toml:

name = 'Theme name'
license = 'MIT'
licenselink = 'https://github.com/owner/repo/LICENSE'
description = 'Theme description'

# The home page of the theme, where the source can be found
homepage = 'https://github.com/owner/repo'

# If you have a running demo of the theme
demosite = 'https://owner.github.io/repo'

# Taxonomy terms
tags = ['blog', 'company']
features = ['some', 'awesome', 'features']

# If the theme has multiple authors
authors = [
  {name = 'Name of author', homepage = 'Website of author'},
  {name = 'Name of author', homepage = 'Website of author'}
]

# If the theme has a single author
[author]
  name = 'Your name'
  homepage = 'Your website'

# If porting an existing theme
[original]
  author = 'Name of original author'
  homepage = 'Website of original author'
  repo = 'https://github.com/owner/repo'

Errors are the following, repeated 48 times each line (96 error total - this extreme verbosity is probably a separate bug in itself):

"version" is a required property
Additional properties are not allowed ('name', 'license', 'licenselink', 'homepage', 'demosite', 'tags', 'features', 'authors', 'author', 'original' were unexpected)

What is wrong?

Application using this configuration file does not complain.

aa956 commented 1 week ago

I see, it's schema validation bug and was mentioned in hugo issues too:

https://github.com/gohugoio/hugo/issues/11412

So created a .taplo.toml in the theme.toml directory:

[schema]
#path = "./path/to/schema.json"
enabled = false

Error still persist, so looks like the documentation is wrong?

https://taplo.tamasfe.dev/configuration/file.html#schema

Disabling VS Code extension setting worked:

Even Better Toml › Schema: Enabled

I will close this, works for me.