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

Unused script setup directives #327

Closed
jods4 opened this issue Jul 23, 2021 · 6 comments
Closed

Unused script setup directives #327

jods4 opened this issue Jul 23, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@jods4
Copy link

jods4 commented Jul 23, 2021

Volar doesn't seem to be aware that imported directives inside script-setup are used in template.

(Maybe it's because the final version of script setup was changed to require a v prefix to local directives?)

image

@johnsoncodehk
Copy link
Member

I can't reproduce, please provide a repro case by https://github.com/johnsoncodehk/volar-starter.

@jods4
Copy link
Author

jods4 commented Jul 25, 2021

@johnsoncodehk do you have TS option noUnusedLocals active?
The most basic example does it for me, see this repro:
https://github.com/jods4/bug-volar-directive/blob/master/main.vue

Which looks like this in my VS Code:
image

TS 4.3.5
Volar 0.26.8

@jods4
Copy link
Author

jods4 commented Aug 4, 2021

I found a possibly related bug (mentioned above) in the vue compiler itself that would ignore imported local directives with a capital V when lang="ts" (yes, I know, it's pretty specific).

Just want to point out that this is not the complete issue when it comes to Volar.
Using a lowercase v works around the problem in Vue SFC compiler, but not in Volar as demonstrated in the following screenshot:
image

@johnsoncodehk
Copy link
Member

This use case is not yet support in volar, I don't know how this working currently. I will check it, if you can provide more use cases I can resolve it earlier. (I need to confirm how should type-checking working in directives expression.)

@jods4
Copy link
Author

jods4 commented Aug 4, 2021

I'm sorry, I don't think I can help more than that.
I suppose it should work as local components?

@johnsoncodehk
Copy link
Member

I did not use this before so I can't say. I will check it.

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

No branches or pull requests

2 participants