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 for event modifiers in html #780

Closed
marbuser opened this issue May 5, 2018 · 5 comments · Fixed by #1326
Closed

IntelliSense for event modifiers in html #780

marbuser opened this issue May 5, 2018 · 5 comments · Fixed by #1326

Comments

@marbuser
Copy link

marbuser commented May 5, 2018

  • [YES] I have searched through existing issues
  • [YES] I have read through docs
  • [YES] I have read FAQ

Info

  • Platform: Both macOS and Windows 10. (Primarily macOS)
  • Vetur version: 0.11.7
  • VS Code version: 1.23.0

Problem

Not entirely sure if this is a "bug". However, if it isn't then consider this a suggestion.
When operating in VScode's default JavaScript "Language mode", Intellisense works perfectly as seen below;
image

However, when trying to achieve the same thing in the Vue "Language mode" that Vetur provides, Intellisense suddenly breaks with vanilla JS code like below;
image

Something else I've noticed is that directives themselves get suggested in intellisense, but modifiers and other options for them don't. Is this intended? For example;
image

image

Both cases have had quite a bit of coverage as I've seen a few posts on the VueJS reddit recently and I've also been discussing with some friends and this is something we all mutually agree is a huge pain in the butt.

Reproducible Case

  1. Install Vetur.
  2. Open a new file and change the "Language mode" to Vue.
@HerringtonDarkholme
Copy link
Member

I believe this is an inherent limitation.

Vue language service requires users to open a file in project. If you open a new file in vscode, vetur will not provide intellisense since no project exists.

@marbuser
Copy link
Author

marbuser commented May 7, 2018

Thanks for that. For the first case, I will just use projects for everything from now on, not that big of a deal.

For the second case, do you think we can ever expect directive modifiers in Intellisense since even in projects they are still absent.

For example;
v-on:click.prevent

The ".prevent" and other modifiers don't get suggested. Not necessarily that big of a deal, but I think a lot of users would welcome this with open arms if it was to be implemented. :)

@marbuser
Copy link
Author

To further add onto the above, there is also another "vital" part of Vue that doesn't have intellisense working as expected.

When using an expression such as;

this.$router
this.$refs
etc...

Intellisense does not work at all. Basically if you use $, intellisense breaks. Not sure if this is a vetur problem or a VSCode problem, but again I think this is another feature/(maybe bug?) a lot of users would welcome.

@octref octref changed the title Better Intellisense Implementation IntelliSense for event modifiers in html May 15, 2018
@octref
Copy link
Member

octref commented May 15, 2018

For your 1st question, add dom to tsconfig.json/jsconfig.json 's compilerOptions.lib. For example, see: https://github.com/octref/veturpack/blob/master/tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "strict": true,
    "noUnusedLocals": true,
    "noImplicitAny": true,
    "outDir": "dist",
    "sourceMap": true,
    "lib": [
      "es5", "es2015.collection", "es2015.promise", "dom", "es2016.array.include"
    ],
    "allowJs": true
  }
}

For your 2nd question, we do offer @ intellisense, but we current don't have intellisense for event modifiers.

image

I'll just use this issue to track event modifiers intellisense.

@octref
Copy link
Member

octref commented Aug 10, 2018

Need to have a better default jsconfig/tsconfig for projects without one.

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

Successfully merging a pull request may close this issue.

3 participants