sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.25k stars 199 forks source link

CSS class name autocompletion in HTML/Markup #2360

Open theetrain opened 6 months ago

theetrain commented 6 months ago

Description

When entering a class name in HTML, it would be nice to see autocompletion for global selectors defined in an outside .css file.

Proposed solution

Example:

<script>
  import '$lib/main.css'
</script>

<button class="">text</button>

When entering text in the class attribute, it'll pull available classes from a project-defined .css file; whether or not it's being imported explicitly in <script>.

Alternatives

No response

Additional Information, eg. Screenshots

Possibly relates to #84 and #521

jasonlyu123 commented 6 months ago

https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion This extension does support svelte and it does work well at first glance. It uses regex for class attributes, so it might sometimes have some false completion, though.