JetBrains / web-types

JSON standard for documenting web component libraries for IDEs, documentation generators and other tools
Apache License 2.0
278 stars 25 forks source link

Add attribute to existing tag #77

Open hasn-prevas opened 6 months ago

hasn-prevas commented 6 months ago

Is it possible to add a new attribute to an existing HTML tag?

I have tried the following:

{
  "$schema": "https://json.schemastore.org/web-types",
  "name": "Foo attribute",
  "version": "0.0.1",
  "contributions": {
    "html": {
      "elements": [
        {
          "name": "Foo attribute on script tag",
          "extension": true,
          "pattern": {
            "or": ["script"]
          },
          "attributes": [
            {
              "name": "foo",
              "value": {
                "required": false
              }
            }
          ]
        }
      ]
    }
  }
}

foo attribute are now allowed on script tags, but existing attributes (e.g. defer, src etc.) are now marked as errors (in IntelliJ IDEA 2023.3.1 - Build #IU-233.11799.300):

image

piotrtomiak commented 5 months ago

@hasn-prevas This is correct Web Types definition. It looks like there is a bug on our side. I've filed an issue, please follow: https://youtrack.jetbrains.com/issue/WEB-65042