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

Intellisense not recognizing Vue SFC's component #1509

Closed
3 tasks done
lanyizi opened this issue Nov 20, 2019 · 9 comments
Closed
3 tasks done

Intellisense not recognizing Vue SFC's component #1509

lanyizi opened this issue Nov 20, 2019 · 9 comments
Labels

Comments

@lanyizi
Copy link

lanyizi commented Nov 20, 2019

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Windows
  • Vetur version: 0.22.6, installed through VSIX from VSCode in administrator mode
  • VS Code version: 1.39.2 (System setup)

Problem

Looks like VSCode won't recognize my Vue component in the SFC file, but just an ordinary object:
image

When I write this., computed properties predefinedTags, computedTags etc. are suggested as methods because like mode, they are all declared as computed's member, but I can't get any intellisense suggestions from data().

Output from Vue Language Server log:

Loaded bundled typescript@3.6.3.
Vetur initialized
@Soresu
Copy link

Soresu commented Nov 30, 2019

I've just noticed the same thing. I've checked it in the previous verisons, it stopped working after version 0.22.2.

@octref
Copy link
Member

octref commented Feb 11, 2020

image

<template>
  <div></div>
</template>

<script>
export default {
  data() {
    return {
      tags: ['CMS']
    }
  },
  computed: {
    mode() {
      this.
    }
  }

};
</script>

Please provide a minimal reproducible case.

@Soresu
Copy link

Soresu commented Feb 12, 2020

@octref Currently with Vetur 0.23.0 and VSCode 1.42.0 it is working fine. Although in the template tag, the nested properties are not visible.

image

It knows that there is an obj variable with test and test2 properties, but there is no intellisense after the dot. Also there is no info about the Vue instance properties, like $router. It is visible in the script tag.

@octref
Copy link
Member

octref commented Feb 12, 2020

@Soresu That's a different issue, tracked in #1129.

@Soresu
Copy link

Soresu commented Feb 13, 2020

@octref Ah fine, thanks for the info.
Meanwhile, the issue happened again. When you define the "props" property on the Vue instance and you return a property from a computed, the intellisense stop working in computed fields. And in the tooltip, it is labeled as method instead of property.

image

Without "props" property (or returning a local variable), it is working, which is interesting.

image

@octref
Copy link
Member

octref commented Feb 13, 2020

Can you create a minimal repro by forking https://github.com/octref/veturpack and open a new issue?

image

@yoyo930021
Copy link
Member

yoyo930021 commented Mar 23, 2020

If vetur.useWorkspaceDependencies: true,
you will use typescript@2.9.2 in vetur and not have any error.
The error is happened when using typescript@^3.x.x.
It's a type definition error in Vue lib.
Ref: vuejs/vue#11235

@octref
Copy link
Member

octref commented Jun 7, 2020

@yoyo930021 Thanks a lot for finding the issue and providing a fix!
I'll mark this as upstream and close it then.

@ZhengXiaowei
Copy link

why dosen't it work for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants