css-initial-value icon indicating copy to clipboard operation
css-initial-value copied to clipboard

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

Open tjx666 opened this issue 6 years ago • 8 comments

as title...

tjx666 avatar Aug 18 '19 08:08 tjx666

Hey, can you provide an example for how CSS looks like in a .vue file? I haven't tried Vue before.

dzhavat avatar Aug 18 '19 09:08 dzhavat

Hey, can you provide an example for how CSS looks like in a .vue file? I haven't tried Vue before.

You can see my vue code in codeSandbox example.

The effect in codeSandbox is the same as my local VSCode: Snipaste_2019-08-18_18-37-47

tjx666 avatar Aug 18 '19 10:08 tjx666

If this ends up being implemented, we should also support .svelte which uses almost identical css definitions:

<style>
	p {
		color: purple;
		font-family: 'Comic Sans MS';
		font-size: 2em;
	}
</style>

<p>These styles...</p>

Both .vue and .svelte are effectively just html files with custom file extensions.

dwelle avatar Aug 18 '19 10:08 dwelle

Support for both Vue and Svelte will be quite awesome. One problem with the extension right now is that it doesn't take the context (document) into consideration because it assumes that everything is CSS. Right now it just checks if a word matches a certain regex pattern.

.vue and .svelte, or other similar frameworks, mix CSS, HTML and JS so a property named text: this is a test will also match the regex pattern even though it won't return anything on hover.

So in order to make this work, there should be some logic that checks whether the hover is inside <style> or style="" and return the relevant information.

If you have any suggestions for how to do that, you're welcome to share them. I'll think about it as well.

dzhavat avatar Aug 18 '19 12:08 dzhavat

any progress?

tjx666 avatar Jul 26 '21 07:07 tjx666

Hey @tjx666 I'm sorry but I haven't looked into this. Do you still need it?

dzhavat avatar Jul 31 '21 05:07 dzhavat

@dzhavat Yes, it would be helpful for vue and svelte users. Maybe we should also update the latest data. @johnsoncodehk any simple way to support it in vue?

tjx666 avatar Feb 19 '23 14:02 tjx666

I guess you can implement a plugin to https://github.com/volarjs/plugins.

johnsoncodehk avatar Mar 20 '23 00:03 johnsoncodehk