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

Add support for Vue and Svelte files #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fristys
Copy link

@fristys fristys commented Aug 20, 2019

Potentially closes #3 .

I'm not completely certain templateLanguages should be where it is right now, but if you want it somewhere else I can move it easily.

I'm using a regex that only matches the code encased in the <style> tags. This takes into account various Vue-esque attributes like lang and such (You can test it here), then TextDocument.positionAt to determine which lines the start and end indexes of the match are located on, and from there I simply check if the line you're hovering is between the start and the end of the <style> tag, and if it is, the usual initial value code is ran.

I've only tested this briefly and on Vue files (I don't know Svelte), so I hope that it works in all scenarios. :)

@dzhavat
Copy link
Owner

dzhavat commented Aug 21, 2019

Thank you for your contribution! It’s quite nice :)

Something I’m concerned about is whether adding logic for checking HTML, Vue or whatever framework will have an impact on the performance. The reason being that these checks will run every time there’s hover. And this happens a lot. I wonder if there’s a way to measure the impact? Will try to investigate and share what I’ve found.

@dougwl
Copy link

dougwl commented Oct 20, 2021

@dzhavat , any chance of adding this as an experimental feature? Something like a 'toggle' warning for the possible drawback.
Having it not enabled by default would prevent normal users from being affected and give a chance to others aware of the consequences to at least try it out.

@dzhavat
Copy link
Owner

dzhavat commented Oct 26, 2021

@dougwl Adding this feature behind a toggle sounds like a good idea, though I haven't yet looked at how to do it.

There's another way to try it too. VS Code extensions can be installed from a vsix file. If you want, I can build an extension with this feature in it and you can install it manually. Another option is to share some guidelines for how you can build the extension yourself, it's not complicated at all. What do you think about it?

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

Successfully merging this pull request may close these issues.

Hope support in the style tag in HTML and .vue file
3 participants