JetBrains / web-types

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

Can I use web-types in Goland without package.json? #55

Open nkev opened 2 years ago

nkev commented 2 years ago

Does the web-types system have a dependency on NPM?

I don't use npm or package.json but I want to use the HTMX webtype in JetBrains Goland.

Is this possible?

piotrtomiak commented 2 years ago

@nkev so far web-types support in WebStorm works only with package.json. But I would love to extend that. Could you please explain a little bit more on how are you using HTMX in your project, specifically, what kind of a build system manages the HTMX dependency?

nkev commented 2 years ago

Thanks @piotrtomiak. My build system is very simple and uses Goland's built-in File Watchers to process SCSS and JS bundles:

image

I don't like having hundreds of NPM dependencies, so I manually keep a lib folder with subfolders of libraries. Whenever there is a change in my source files or library files the Goland File Watchers run automatically. I just followed the IntelliJ docs to achieve this and it works well for me. Here is my library structure (scss folder is hidden here, below lib folder):

image
piotrtomiak commented 2 years ago

Thanks for the explanation. I assume that in lib/htmx for instance there is just the JS file, isn't it?

nkev commented 2 years ago

No problem. No, the lib/htmx package is actually quite complex with many extensions in the ext folder. It even has a web-types file in the jetbrains folder :)

image
piotrtomiak commented 2 years ago

Thank you for the example! It looks like any autodetection mechanism wouldn't work for you. You would need a preference page, where you can explicitly specify, which web-types file to enable, correct?

nkev commented 2 years ago

Yes, I think a generic Jetbrains "Web Types" dialog would be more configurable and more explicit than automatically traversing project files to find **/*.web-types files. Maybe the dialog could list the *.web-types files it found as a starting point.

anderssv commented 8 months ago

I second this need. :-) Doing a pure HTML/JS page with some custom web-components and getting a lot of "Unknown html tag".

brainfoolong commented 6 months ago

Hi there. We also need such a feature, really much. Current "package.json" implementation lacks a lot of power.

For example, a package.json in subfolder overrides the web-types from it parents. You have a root folder with web-types in package.json, you have a subfolder with no web-types in package.json. Result: In all files edited in this subfolder you will have no web-types support what so ever. Bad for a module based development, where your root contains all base features and components.

In can think of ways to solve this:

Our current workaround is: We have the same "web-types" linked in all subfolders that have a package.json. As well as in the root node. Otherwise this wouldn't work. As we have multiple files, it's a bit struggling when a new file arrives...

piotrtomiak commented 5 months ago

@brainfoolong - could you please share some example project, so that I can better understand what's the problem and experiment with possible solutions?

brainfoolong commented 5 months ago

@piotrtomiak I have prepared a super simple basic project with a root folder and submodules, each of which can (but not must) have a package.json. Control or changing package.json in submodules is not (always) possible

You have 2 test.html files, on have autocompletion for the expected web-types, one have not.

image

web-types-test.zip

Conclusion: The thing i would really prefer is some sort of explicit file convention, that is auto-detected as a web-types.json file. For that i don't have to manage or even create package.json files just for that reason.

piotrtomiak commented 4 months ago

@brainfoolong Thanks! I am looking at some new options to provide Web Types wihtout package.json to implement in 2024.2

brainfoolong commented 4 months ago

@brainfoolong Thanks! I am looking at some new options to provide Web Types wihtout package.json to implement in 2024.2

That sounds great, if i am finally able to kick all unnecessary package.json only existing for web-types :)

brainfoolong commented 4 months ago

Hey @piotrtomiak - Can we see a preview of some new options in the PhpStorm 2024.2 EAP program? Don't find a trace for that in the release notes.

kirach commented 3 months ago

Just wanted to +1 on this, I'm also using htmx and shoelace in my project (which is a super simple app using ktor with server side rendering). I'm including htmx and shoelace in my index.html using <script ... tag and I don't use any build tools. The only way to add autocomplete support is to create package.json file with only one line "web-types": "./web-types.json"

piotrtomiak commented 2 months ago

@brainfoolong - I had in plans to add this support, but I have spent 3 months on implementing new solution for type checking in Angular. It was hell. I am going for vacations for few weeks. I want to add the support for 2024.3 and maybe we could cherrypick it to 2024.2.x.