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

Use web-types from symlinked projects #1

Closed igisev closed 4 years ago

igisev commented 5 years ago

WebStorm 2019.2 EAP

We try to connect web types to our project as a local file.

  1. Created two Vue projects
  2. In the first project, we created the types/web-types.json file, and in the package.json we added the line "web-types": "types/web-types.json",
  3. In the second project, we connected the first project via yarn link

This does not work. In the second project there are no visible components from the first project. What are we doing wrong?

File types/web-types.json:

{
  "framework": "vue",
  "name": "ui",
  "version": "0.0.1",
  "contributions": {
    "html": {
      "types-syntax": "typescript",
      "tags": [
        {
          "name": "MyBtn",
          "attributes": [
            {
              "name": "disabled",
              "type": "boolean"
            },
            {
              "name": "title",
              "type": "string"
            }
          ],
          "events": [
            {
              "name": "click"
            }
          ],
          "slots": []
        }
      ],
      "attributes": [
      ]
    }
  }
}
piotrtomiak commented 5 years ago

@igisev It seems that the problem might be with yarn link. I will investigate how it works and let you know. It would be great if you can share both project's package.json files. Thanks for your interest in web-types!

igisev commented 5 years ago

It's my pleasure ) Both projects are created via @vue/cli. The difference between the two package.json:

"dependencies": {
   "-test": "file:../-test",
   ...
}

I performed "Invalidate caches / Restart" and suddenly it all worked! O_o The second project began to see <my-btn>.

The solution was in rebooting WebStorm =\ But this only gives rise to new questions.

In the first project in the types/web-types.json file, I changed MyBtn to NotMyBtn but the changes in the second draft did not apply. This is very bad.

I believe that changes should be applied on the fly during development. Do you agree with me? =)

piotrtomiak commented 5 years ago

@igisev That's actually great! The changes should definitely be updated, but I haven't foreseen that someone will use web-types for his own code development! So the caches are adjusted for more static node_modules behaviour :) I'll definitely fix the issue. You can follow up the issue in WebStorm tracker https://youtrack.jetbrains.com/issue/WEB-40166 as well

igisev commented 5 years ago

Thanks so much for the quick response. We are waiting for bugfix =)

piotrtomiak commented 4 years ago

@igisev the issue has been fixed. The fix will be available in the 2019.2.1 release and EAPs

h311x commented 4 years ago

Hey there! Thanks for your work!

So for some reason I'm experiencing the same issue, even though I'm using WebStorm 2019.3 EAP Build #WS-193.5096.13.

I have basically the same setup. 2 project, one connected to another with yarn link. I noticed that only when I do "File > Reload All From Disk" everything is getting reindexed and webstorm recognizes new types.

gejgalis commented 4 years ago

I have the same issue using LernaJS which uses symlinks between multiple projects. IntelliJ IDEA 2019.3 EAP (Ultimate Edition) Build #IU-193.4932.9, built on October 30, 2019

piotrtomiak commented 4 years ago

@h311x @gejgalis unfortunately problems with stale symlinked folders are a known issue in IntelliJ platform - https://youtrack.jetbrains.com/issue/IDEA-65174 , https://youtrack.jetbrains.com/issue/WEB-25409 .

h311x commented 4 years ago

@piotrtomiak these issues, it seems, have been created a really long time ago... One of them is even ten years ago

Are they going to be solved any time soon? Or is there any info about it?

piotrtomiak commented 4 years ago

@h311x I honestly don't know. The issue has been recognized as a very important now and it seems that it may be resolved in the next release cycle (2020.x). Please vote it and maybe put some comments. It may build up pressure on the core team to fix this. I am sorry for the inconvenience! If possible I'll try to get involved into fixing this.