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

Problem with syntax highlighting for non typescript project #1192

Closed
lukaskleinschmidt opened this issue Apr 14, 2022 · 7 comments
Closed

Problem with syntax highlighting for non typescript project #1192

lukaskleinschmidt opened this issue Apr 14, 2022 · 7 comments
Labels
bug Something isn't working upstream

Comments

@lukaskleinschmidt
Copy link

I'm having some trouble getting syntax highlighting work for a non typescript project.
Strangely enough the error only occurs when defining props using defineProps.

Animation

vscode: v1.66.2
volor: v0.34.6

@johnsoncodehk
Copy link
Member

With lang="ts" it is working, but with js type calculation is limited.

// test.js

import { defineComponent } from 'vue';

const A = defineComponent({
    setup() {
        return {
            HelloWorld: HelloWorld,
        };
    },
});
const B = defineComponent({
    props: [],
    setup() {
        return {
            HelloWorld: HelloWorld,
        };
    },
});

type A_Keys = keyof InstanceType<typeof A>; // "HelloWorld" | "$" | "$data" | "$props" | "$attrs" | "$refs" | "$slots" | "$root" | "$parent" | "$emit" | "$el" | "$options" | "$forceUpdate" | "$nextTick" | "$watch"
type B_Keys = keyof InstanceType<typeof B>; // string | number | symbol

@sirichart
Copy link

So is there any fix for this? or is there any way to temporarily turn off the red highlighting on the component tag. Thank you!

@lukaskleinschmidt
Copy link
Author

@sirichart downgrading volar to 0.34.4 worked for me for now.

@sirichart
Copy link

Ah that's great, thank you for this!

@flatoy
Copy link

flatoy commented May 12, 2022

After the publisher was changed to Vue I'm not able to downgrade anymore.

@johnsoncodehk
Copy link
Member

johnsoncodehk commented May 12, 2022

@itpropro
Copy link

itpropro commented Sep 5, 2022

So is there any fix for this? or is there any way to temporarily turn off the red highlighting on the component tag. Thank you!

Just use lang="ts". It's just for that component and Vue 3 without Typescript is just half the fun ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

5 participants