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

Support class name intellisense (links) without scoped attribute #1038

Closed
zardoy opened this issue Mar 13, 2022 · 5 comments
Closed

Support class name intellisense (links) without scoped attribute #1038

zardoy opened this issue Mar 13, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@zardoy
Copy link
Contributor

zardoy commented Mar 13, 2022

Is it feasible to support class links in vue2 without scoped?
It would be extremely handly if I could just jump into class declaration in style block.
As I can understand it only works with vue3 & composition API.

Related: pranaygp/vscode-css-peek#126

@zardoy
Copy link
Contributor Author

zardoy commented Mar 13, 2022

Oops my bad, everything works fine in vue2 setup. I just noticed that absense of scoped attribtes breaks it. Can I ask you to support these links even without scoped styles?

@zardoy zardoy changed the title Support class name intellisense (links) in vue2 Support class name intellisense (links) in without scoped attribute Mar 13, 2022
@zardoy zardoy changed the title Support class name intellisense (links) in without scoped attribute Support class name intellisense (links) without scoped attribute Mar 13, 2022
@johnsoncodehk
Copy link
Member

johnsoncodehk commented Mar 13, 2022

It can do but I think we should not do it, because the class name is globally, if it can linking users will misunderstand that volar resolved to the accurate class location. But volar only check current SFC but not try to search global classes.

@zardoy
Copy link
Contributor Author

zardoy commented Mar 13, 2022

Yes, I understand that. I'm just asking to do this, because I have extremely large legacy codebase that I'm working on, and for several reasons we can't just enable scoped styles everywhere. Hover every class that we define in style we also use in template.

Please can we add a setting, that would be disabled by default with the description that it won't be accurate. This way I would understand what I'm doing.

Also, I just switched to volar-starter/vue2, and can see that it doesn't suggest classes (even with scoped). However it does work with vue3/composition API setup.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label Mar 13, 2022
@zardoy
Copy link
Contributor Author

zardoy commented Mar 21, 2022

Doesn't experimentalRsolveNonScopedCssClasses mean to have resolve?
Also, since it's must be enabled from jsconfig/tsconfig, it is configurable only on project-level. However, I'd higly appreciate I could somehow enable it globally 🙏 (maybe via extension object setting like globalJsconfig?).

Also, as I said the completion still doesn't work in vue2 setups. Is it also by design?
image. I can open another issue with the original title, if there'd an easy way to enable them.

Anyway, thank you so much for your work and looking into that!

@johnsoncodehk
Copy link
Member

Also, since it's must be enabled from jsconfig/tsconfig, it is configurable only on project-level. However, I'd higly appreciate I could somehow enable it globally 🙏 (maybe via extension object setting like globalJsconfig?).

This is a quick implementation that doesn't currently do much premature optimization due to not being a stable design feature. (Actually based on some refactoring ideas, experimentalResolveNonScopedCssClasses will most likely change...)

Also, as I said the completion still doesn't work in vue2 setups. Is it also by design?

You need to typing first character t to get suggestion, this is bug from here. I can't check it today, if someone is interested to fix PR is welcome.

https://github.com/johnsoncodehk/volar/blob/4d7f5baff86d40563e229b9a247051438baea621/packages/vue-code-gen/src/generators/template.ts#L1440-L1456

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