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

web-types.json does not load for IntelliJ IDEA 2024.1 #82

Open nemsjulie opened 2 months ago

nemsjulie commented 2 months ago

I'm currently working on a Vue 3 project that imports a package of Vue 3 components from node_modules. This package is released using npm and serves as a plugin library, enabling me to install the components as global components within my Vue 3 project as shown below.

Vue 3 project:

import {plugin} from 'privatecomponentsplugin''

const app = createApp(App)

app
.use(router)
.use(vuetify)
.use(store)
.use(plugin)

Components plugin:

export const plugin = {
    install: (app: App) => {
        Object.keys(Components).forEach(name => {
            app.component(name, Components[name])
        })
    }
}

The components plugin npm library package.json includes this:

"web-types": "./web-types.json"

and the web-types.json file exists in the same root as package.json which has been created by using vue-docgen-web-types version 0.1.8.

By doing so, the components that were imported into the Vue project were recognized in IntelliJ IDEA 2020(2020.2.4 and 2020.3.4), 2021(2021.1.3) and 2022(2022.1.4). However, it is not recognized in 2024.1. I've also tested in version 2023.1.6 and 2023.3.6 which do not work either but gives me this file problem Unknown html tag n-button-add.

I've also checked if the npm package has been excluded from the indexing, but the package is gray which indicates that it is not excluded.

Is this a bug on the newer versions of IntelliJ or do we need to do some more work for it to be recognizable? I find it kinda weird how vuetify components are still recognized though, so it could be that I've missed something that are needed for it to work in the newer IntelliJ versions.

piotrtomiak commented 1 month ago

@nemsjulie - could you please share small reproduction library? It's hard to say what may be wrong.

dld-r00f commented 1 month ago

I have same issue with PyCharm 2024.1.1 and vuetify.js web-types. It works with .vue files. And don't work with "Vue template" language injection or file type overriding to "Vue template". And still works if use Edit "Vue template" Fragment on the injection!

nemsjulie commented 1 month ago

@piotrtomiak

Here's small reproduction libraries. I was not sure how to set this up as the other one ( Components plugin) is published on npm, and then installed using npm

App: https://stackblitz.com/edit/vitejs-vite-g6psir?file=package.json Plugin package: https://stackblitz.com/edit/vitejs-vite-e7wfda?file=package.json