Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nkev opened this issue Aug 12, 2022 · 16 comments
Open

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

nkev opened this issue Aug 12, 2022 · 16 comments

Comments

@nkev
Copy link

nkev commented Aug 12, 2022

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
Copy link
Collaborator

@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
Copy link
Author

nkev commented Aug 26, 2022

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
Copy link
Collaborator

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

@nkev
Copy link
Author

nkev commented Sep 2, 2022

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
Copy link
Collaborator

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
Copy link
Author

nkev commented Sep 2, 2022

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
Copy link

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

@brainfoolong
Copy link

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:

  • Having separate files with a naming convention that are automatically detected by the IDE, like .editorconfig (This would i prefer)
  • Having all package.json sum up and not override each other web-types
  • Additionally having an option in the scheme, to decide if it is a "root" node, so if this will reset inheritance of parents or not

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
Copy link
Collaborator

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

@brainfoolong
Copy link

brainfoolong commented Apr 9, 2024

@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
Copy link
Collaborator

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

@brainfoolong
Copy link

@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
Copy link

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
Copy link

kirach commented Jun 12, 2024

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
Copy link
Collaborator

@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.

@brainfoolong
Copy link

@piotrtomiak Hi, back again :) I'm currently testing 2024.3 EAP. Had you time to implement this thing? Can't see changelog news for anything related. Greetz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants