Open BusterNeece opened 1 year ago
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.
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:
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.
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 🤔
I wonder if it would be OK to just update the type declarations in this repo to use
declare module @vue/runtime-core
instead ofdeclare 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.
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.