Go To definition does not work in same file with VSCODE + VETUR

2.6k Views Asked by At

My vue.js configuration is

  • vue.js 2.0
  • use vue.cli
  • webpack
  • javascript not typescript
  • use multiple root
    • server : server project
    • client/dashboard : web client project(this is vue project)

On follow code, "go definition" does not work with "could not find definition"

<template>
<div>
<button @click="clickEvent"/>
</div>
</template>

<script>
export default {
  ...
  methods: {
    clickEvent() {
      this.function1()
      ...
    },
    function1() {
      ...
    }
  }
  ...
}
</script>
  • when go to definition on @click="clickEvent"
  • when go to definition on this.function1()
  • computed, props is same
3

There are 3 best solutions below

1
nononohup On BEST ANSWER

vetur is look like no this function. Maybe you can try use vue-helper.

enter image description here

0
hoyche On

You can try this extension: js-jumper

0
Sandee007 On

Use vue-helper or Vetur-extended.

https://stackoverflow.com/a/76565821/13147506