Vetur: Literal String Union Autocomplete now working inside .vue file

Created on 21 Sep 2020  路  5Comments  路  Source: vuejs/vetur

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

Info

  • Platform: Win10 Home
  • Vetur version: 0.27.3
  • VS Code version: 1.49.1

Problem

Autocomplete for string literal union type not working inside .vue file (with <script lang="ts"> ). But working just fine inside .ts file.

Working nice in test.ts
working

No autocomplete, only information in test.vue
not_working

Reproducible Case

Declare any kind of type with string literal union type.
Expected: Give autocomplete just as in a .ts file.
Reality: No autocomplete in .vue file

Note: I'm not really sure where to post this: vue, vetur or vscode. And i also not really sure whether this should be a bug report or feature request. But since in the vetur doc they said that

The IntelliSense should be almost the same to the IntelliSense in js/ts files
So maybe this is the right place to post this.

bug completion

Most helpful comment

https://github.com/vuejs/vetur/commit/aaff6be212d24ef25ba0156b825504fb1c250521

I cannot recall why I made this change. I'll revert it for now. If I do encounter the bug I'll fix it again...

All 5 comments

https://github.com/vuejs/vetur/commit/aaff6be212d24ef25ba0156b825504fb1c250521

I cannot recall why I made this change. I'll revert it for now. If I do encounter the bug I'll fix it again...

I remember the reason now...

If I do make ' a trigger character, when I type over 'black'|, I get unwanted completion.

image

I'll have to find another fix.

@octref Have you been able to fix it without giving unwanted completion ?
How about make ' and " a trigger character only if they are immediately after a ( ?
Also how about open this issue because I don't think it have really been fix ?

I forgot to reopen.

@octref any news on this ?
In the meantime i think i would rather has that unwanted completion than not auto-complete at all.
Literal String Union is a great way to restraint option, I use them alot and auto-complete will help alot in vue file.
Unwanted completion can be cancel with a simple Esc. The benefit outweight the uncomfortable IMO

Was this page helpful?
0 / 5 - 0 ratings