JetBrains / web-types

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

Boolean type expect a value #16

Closed jonhuteau closed 3 years ago

jonhuteau commented 4 years ago

Hi,

I'm trying to generate a web-types.json for a custom Vue framework. I can get autocomplete from PHPStorm but boolean type expects a value.

Did I miss something ?

{
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
  "framework": "vue",
  "name": "npm package name",
  "version": "",
  "contributions": {
    "html": {
      "tags": [
        {
          "name": "aa-btn",
          "attributes": [
            {
              "name": "badge",
              "description": "If true, disable hover & active behaviors",
              "value": {
                "kind": "expression",
                "type": "boolean"
              }
            }
          ]
        }
      ]
    }
  }
}

image

piotrtomiak commented 3 years ago

@jonhuteau Thanks for asking! Sorry for late reply, but I was OOO for the last 3 weeks. Could you please let me know which version of IDE are you using? There is an old syntax with "type" property, which is required by some older versions of JB IDEs:

 {
              "name": "appear",
              "description": "Whether to apply transition on initial render.",
              "value": {
                "kind": "expression",
                "type": "boolean"
              },
              "type": "boolean"
            },
jonhuteau commented 3 years ago

No problem @piotrtomiak !

I also tried what you suggested but same result. I'm using PhpStorm 2020.2, Build #PS-202.6397.115, built on July 29, 2020.

piotrtomiak commented 3 years ago

@jonhuteau Thanks! I will investigate.

piotrtomiak commented 3 years ago

@jonhuteau - your web-types JSON is missing types-syntax property, so the types are not interpreted at all. Please try:

{
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
  "framework": "vue",
  "name": "npm package name",
  "version": "",
  "contributions": {
    "html": {
      "types-syntax": "typescript",
      "tags": [
        {
          "name": "aa-btn",
          "attributes": [
            {
              "name": "badge",
              "description": "If true, disable hover & active behaviors",
              "value": {
                "kind": "expression",
                "type": "boolean"
              }
            }
          ]
        }
      ]
    }
  }
}

I would like to avoid having an implicit types-syntax for a better readability of the JSON itself.

jonhuteau commented 3 years ago

Thanks a lot @piotrtomiak, it works as expected with "types-syntax": "typescript" attribute !

I was convinced it was only required if you write your library in TS...

Again, thanks for your help !