-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Color Picker not working in VS Code with Svelte Extension #309
Comments
hmm... that works for me. Can you provide the content in your style? |
oh! only the top-level one would have that. If it's under another tag it won't have CSS language feature. Only the component style would. |
Thanks for the reply. Could you clarify what you mean by "top-level"? The style tag above is inside of a Header.svelte component. Is that not the same as a "component style"? Thank you. Update: Okay I see what's happening here, my <style> tag is actually on the bottom of my file. When I moved the <style> tag to the top the picker appeared. Is there a reason why it won't work when the style tag is at the bottom? Thanks. |
not a child of any tag. <!-- this one -->
<style>
</style>
<svelte:head>
<!-- not this one -->
<style>
.a {}
</style>
</svelte:head> https://svelte.dev/repl/6bdac66b78064f57ab2d12e425ff60f1?version=3.24.0 |
This bug seems to be related to the Svelte prettier plugin. My current configuration is as follows: "svelteSortOrder" : "scripts-markup-styles", Since my <style> tag is located at the bottom of my .svelte file, it loses the color picker. When I move the <style> tag all the way to the top of the file, the color picker re-appears. |
if it's not under any tag? Do you have any self-close tag before it? |
No, it is not under any tag. The <style> tag is independent. |
Can you provide the entire file or just the reproduable |
Sure, here it is on REPL: |
This is another form of #194 once you have an end tag of svelte:window instead of self-close the error would be gone. |
I was wrong. It's somewhat related topics to it. The actual problem is the arrow function. The parser thinks the tag has ended so it treat anything after it as text until it encounter a opening/closing tag again. So the self-close is ignored because it thinks it is just a text. |
I don't think this can be fixed soon. Maybe you can work around it by moving the event handler to the script. |
The REPL link shows me an empty file so I cannot reproduce this. Could you post the failing sample code directly in this issue @ejoflo ? |
minimal reproducible <svelte:body on:click={() => {}} />
<style>
div {
background-color: #ffffff
}
</style> |
Maybe we could allow multiple style sections in a single document in <svelte:head>
<style>
</style>
</svelte:head> and also pave the way for language features in the style attribute of #381 |
According to the feature list for the Svelte for VS Code extension:
CSS / SCSS / LESS
"Color highlighting and color picker"
However, when I open a .svelte file, and add a color or background-color property to under the <style> tag of said .svelte file, there is no color picker displayed.
The settings have the following enabled:
svelte.plugin.css.colorPresentations.enable - TRUE
The text was updated successfully, but these errors were encountered: