Vetur: Support analyzing vue-class-component

Created on 19 Feb 2019  路  6Comments  路  Source: vuejs/vetur

Continuing #1083

ComponentInfo is not able to analyze vue-class-component yet.

The source looks like below, so it needs a different AST visitor. Maybe we can use typing from vue-class-component to analyze it.

@Component({
  props: {
    propMessage: String
  }
})
export default class App extends Vue {
  // initial data
  msg = 123

  // use prop values for initial data
  helloMsg = 'Hello, ' + this.propMessage

  // lifecycle hook
  mounted () {
    this.greet()
  }

  // computed
  get computedMsg () {
    return 'computed ' + this.msg
  }

  // method
  greet () {
    alert('greeting: ' + this.msg)
  }
}
completion

Most helpful comment

It is also important to note that vue-class-component is often used along with the vue-property-decorator for defining props

All 6 comments

It is also important to note that vue-class-component is often used along with the vue-property-decorator for defining props

Is this going to be a tough one or are we likely to see it in a near-future release?

I'd like to limit this issue to only vue-class-component, which is officially supported.

There are many decorator libraries such as https://github.com/kaorun343/vue-property-decorator, https://github.com/itsFrank/vue-typescript, and one in the upcoming Vue 3 https://github.com/vuejs/rfcs/pull/17. Supporting them all is likely a lot of maintenance.

I'd like to limit this issue to only vue-class-component, which is officially supported.

There are many decorator libraries such as https://github.com/kaorun343/vue-property-decorator, https://github.com/itsFrank/vue-typescript, and one in the upcoming Vue 3 vuejs/rfcs#17. Supporting them all is likely a lot of maintenance.

I think that's a reasonable compromise.

@octref @dennis2k
Any news? or workaround? Its a critical bug for me. I can't use vetur with vscode due to this bug.

Here the bug:
https://github.com/vuejs/vue-class-component/issues/360

Hi anyone, I publish self-maintenance vscode extension.
This extension will be maintained until Vetur is reactivated.

https://marketplace.visualstudio.com/items?itemName=yoyo930021.vuter

Was this page helpful?
0 / 5 - 0 ratings