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

instanceof & typeof inside templates break syntax highlighting for the rest of the file #1854

Open
3 tasks done
WofWca opened this issue Apr 16, 2020 · 4 comments
Open
3 tasks done

Comments

@WofWca
Copy link

WofWca commented Apr 16, 2020

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

Info

  • Platform: Win
  • Vetur version: 0.24.0
  • VS Code version: 1.44.1

Problem

Using instanceof inside templates breaks syntax highlighting.

image

Reproducible Case

<template>
  <p v-show="p instanceof Array"></p>
</template>
@JoelFeiner
Copy link

A good and reasonable workaround would be to use a computed property instead, rather than have interesting logic inside the template.

@WofWca WofWca changed the title instanceof inside templates breaks syntax highlighting instanceof inside templates breaks syntax highlighting for the rest of the file Apr 21, 2020
@toshiya14
Copy link

I am facing the same issue, and I found an resolution is below:

<span v-if="!!(item.createdTime instanceof Date)"></span>

I think this would help you before the issue is fixed.

@Eternal-Rise
Copy link

same issue with typeof

@WofWca WofWca changed the title instanceof inside templates breaks syntax highlighting for the rest of the file instanceof & typeof inside templates breaks syntax highlighting for the rest of the file Feb 27, 2023
@WofWca WofWca changed the title instanceof & typeof inside templates breaks syntax highlighting for the rest of the file instanceof & typeof inside templates break syntax highlighting for the rest of the file Feb 27, 2023
@liplum
Copy link

liplum commented Apr 10, 2023

I can reproduce this in Volar too.
My solution is to wrap the expression with parentheses.

<template v-if="(file instanceof LocalFile)">

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

No branches or pull requests

6 participants