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

Implement JetBrains web-types.json file for Vue template type hinting #33

Open
BusterNeece opened this issue Dec 26, 2022 · 4 comments
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@BusterNeece
Copy link

I've been implementing vue3-gettext in my application, and I've noticed that the $gettext calls in templates themselves, while they resolve correctly within Vue, are being treated by the JetBrains IDE as unknown function calls, which causes them to appear as warnings, show up in inspection results, etc...

JetBrains has a standardized file type to define types in Vue component files (which is particularly useful for templates), and as long as such a file exists for it to reference, it'll be able to smartly identify the $gettext and other related function calls.

The schema for this file is here: https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json

Another project, BootstrapVue, automatically generates this file (along with type-hinting for the VSCode Vetur extension) with this script: https://github.com/bootstrap-vue/bootstrap-vue/blob/dev/scripts/create-web-types.js

If there's interest in adding support for this, I'd be happy to look into possibly submitting a PR.

@lzurbriggen lzurbriggen added the enhancement New feature or request label Jan 3, 2023
@lzurbriggen
Copy link
Collaborator

Hi @BusterNeece, we provide types for the functions etc. here, these should be picked up by the IDE (VSCode Vue Language Features/Volar does this, Vetur should only be used for Vue 2 projects afaik).

I'm unfamiliar with the JetBrains Vue integration, but it seems to work out of the box for one of our customers working in IDEA, so maybe there is some project configuration issue?

I'll leave this open for now, so if others have the same issue they can notify us here. I probably wouldn't decline a PR but I would like to make sure that it really is something the package should provide.

@lzurbriggen lzurbriggen added the help wanted Extra attention is needed label Jan 3, 2023
@BusterNeece
Copy link
Author

Perhaps it could be a misconfiguration on my part...on Vue single page component files, inside the template component, each of the $gettext calls look like this:

2023-01-03 10_42_36-AzuraCast – Stations_Branding vue

Of course, anywhere I directly import $gettext via composition calls, that works and resolves just fine, it just seems like my IDE doesn't recognize that $gettext is a global function available in all templates.

@saifahn
Copy link

saifahn commented May 30, 2024

Hi, we've been having the same issue with our project.

We are in the middle of migrating to Vue 3.4 from 2.6.

@lzurbriggen Actually I just found another post you made in the language tools repo - I found the same thing.

I wonder if it would be OK to just update the type declarations in this repo to use declare module @vue/runtime-core instead of declare module vue, and then open an issue in vuejs/core to get clarification on why this happens 🤔

@lzurbriggen
Copy link
Collaborator

I wonder if it would be OK to just update the type declarations in this repo to use declare module @vue/runtime-core instead of declare module vue, and then open an issue in vuejs/core to get clarification on why this happens 🤔

Yes, we could do that. It feels like which one works changed a few times and I haven't delved deep enough into the Vue source to figure out why that could be.

We're quite busy so please be patient if you open a PR, it could be a while until we get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants