Does autocomplete/intellisense only work with TS? #531
-
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 4 replies
-
Thanks 😃 It should work with JS too but note your |
Beta Was this translation helpful? Give feedback.
-
I have the same problem |
Beta Was this translation helpful? Give feedback.
-
See documentation for adding TS intellisense in WebStorm:
Although I don't have this IDE to try, creating a {
"include": [
"./src/**/*"
],
"compilerOptions": {
"allowJs": true
}
} Make sure to restart the service after these changes:
|
Beta Was this translation helpful? Give feedback.
-
I seem to be having a very similar issue where even going by the examples in docs, I can access my store properties, getters, and actions just fine in the script. I return the whole store from setup() to use in my templates, which works except WebStorm Intellisense does not detect any of my custom properties and functions. When I use the properties, getters, or actions in the template, they work as one would expect but WebStorm just can't seem to find them even though it sees the other built-in properties of the store (see pic). Adding This is my simple test store: export const useResources = defineStore('resources', {
state: (): Resources => ({
name: "name",
money: 100
}),
getters: {
getMoney(state) {
return state.money
}
},
actions: {
addMoney() {
this.money++
},
addMoreMoney(value: number) {
this.money += value
}
}
}) which I then use in my Vue component like so: <script lang="ts">
import { useResources } from "@/stores/resources";
import { defineComponent } from "vue";
export default defineComponent({
name: "TheResources",
setup() {
const resourcesStore = useResources()
return {
resourcesStore,
increment: resourcesStore.addMoney
}
}
})
</script> |
Beta Was this translation helpful? Give feedback.
-
I managed to find the issue and a workaround for it, more details in this opened issue: #772 |
Beta Was this translation helpful? Give feedback.
-
I had to do a couple of things to get autocompletion working. I'm using PHPStorm 2021.2.3 (WebStorm under the hood), it is also worth noting I'm not using Typescript in my projects.
Adding a EDIT: Just realised that autocompletion inside of the store in actions and getters does not work, even with the |
Beta Was this translation helpful? Give feedback.
-
This is OK. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
how fix it ? |
Beta Was this translation helpful? Give feedback.
See documentation for adding TS intellisense in WebStorm:
Although I don't have this IDE to try, creating a
jsconfig.json
with"allowJs": true
set should be enough. Examplejsconfig.json
:Make sure to restart the service after these changes: